index_echarts.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // 表单统计
  2. var dom = document.getElementById("container");
  3. var myChart = echarts.init(dom);
  4. var app = {};
  5. option = null;
  6. option = {
  7. title : {
  8. text: '某站点用户访问来源',
  9. subtext: '纯属虚构',
  10. x:'center'
  11. },
  12. tooltip : {
  13. trigger: 'item',
  14. formatter: "{a} <br/>{b} : {c} ({d}%)"
  15. },
  16. legend: {
  17. orient: 'vertical',
  18. left: 'left',
  19. data: ['直接访问','邮件营销','联盟广告','视频广告','搜索引擎']
  20. },
  21. series : [
  22. {
  23. name: '访问来源',
  24. type: 'pie',
  25. radius : '55%',
  26. center: ['50%', '60%'],
  27. data:[
  28. {value:335, name:'直接访问'},
  29. {value:310, name:'邮件营销'},
  30. {value:234, name:'联盟广告'},
  31. {value:135, name:'视频广告'},
  32. {value:1548, name:'搜索引擎'}
  33. ],
  34. itemStyle: {
  35. emphasis: {
  36. shadowBlur: 10,
  37. shadowOffsetX: 0,
  38. shadowColor: 'rgba(0, 0, 0, 0.5)'
  39. }
  40. }
  41. }
  42. ]
  43. };
  44. ;
  45. if (option && typeof option === "object") {
  46. myChart.setOption(option, true);
  47. }