Sha256: 92aaba6742e10ac4f019de16858d53e20ec938a45ce40c93a4dc7fb4b3119bdf

Contents?: true

Size: 1.67 KB

Versions: 2

Compression:

Stored size: 1.67 KB

Contents

<div id="main" style="height: 400px;"></div>
<script type="application/javascript" src="/report/js/echarts.min.js"></script>
<script type="text/javascript">
  var myChart = echarts.init(document.getElementById('main'));
  var option = {
    title : {
      text: '某站点用户访问来源',
      x:'center'
    },
    tooltip : {
      trigger: 'item'
    },
    legend: {
      orient : 'vertical',
      x : 'left',
      data: [],
      textStyle:{
        color: '#000000'
      }
    },
    toolbox: {
      show : true,
      feature : {
        mark : {show: true},
        dataView : {show: true, readOnly: true},
        magicType : {
          show: true,
          type: ['pie'],
          option: {
            funnel: {
              x: '25%',
              width: '50%',
              funnelAlign: 'left'
            }
          }
        },
        restore : {show: true},
        saveAsImage : {show: true}
      }
    },
    calculable : true,
    series : []
  }

  var result = <%= raw @data[:charts].to_json %>;
  for(var i=0; i<result.length; i++){
    var data = result[i].data;
    var series = {
      type: "pie",
      radius: '55%',
      center: ['50%', '60%'],
      data: [],
      itemStyle: {
        emphasis: {
          shadowBlur: 10,
          shadowOffsetX: 0,
          shadowColor: 'rgba(0, 0, 0, 0.5)'
        }
      }
    }
    for(var j=0; j<data.length; j++){
      option.legend.data.push(data[j].category_name);
      series.data.push({value: data[j].value, name: data[j].category_name});
    }
    option.series.push(series);
  }

  myChart.setOption(option);

  function eConsole(param) {
    console.log(param);
  }

  myChart.on("click", eConsole);
</script>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
treport-0.2.0 app/views/templates/public_one.html.erb
treport-0.1.0 app/views/templates/public_one.html.erb