overview.js 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. define(['jquery', 'bootstrap', 'backend', 'addtabs', 'table', 'echarts', 'echarts-theme', 'template'], function ($, undefined, Backend, Datatable, Table, Echarts, undefined, Template) {
  2. var Controller = {
  3. index: function () {
  4. // 基于准备好的dom,初始化echarts实例
  5. var myChart = Echarts.init(document.getElementById('echart'), 'walden');
  6. var myChart1 = Echarts.init(document.getElementById('echart1'), 'walden');
  7. // 指定图表的配置项和数据
  8. var option = {
  9. xAxis: {
  10. type: 'category',
  11. data: Config.type_column
  12. },
  13. yAxis: {
  14. type: 'value'
  15. },
  16. series: [
  17. {
  18. data: Config.type_data,
  19. type: 'bar',
  20. showBackground: true,
  21. backgroundStyle: {
  22. color: 'rgba(180, 180, 180, 0.2)'
  23. }
  24. }
  25. ]
  26. };
  27. var option1 = {
  28. title: {
  29. text: '支付方式占比',
  30. left: 'center'
  31. },
  32. tooltip: {
  33. trigger: 'item'
  34. },
  35. legend: {
  36. orient: 'vertical',
  37. left: 'left'
  38. },
  39. series: [
  40. {
  41. type: 'pie',
  42. radius: '50%',
  43. data: [
  44. { value: Config.type_data[0], name: Config.type_column[0] },
  45. { value: Config.type_data[1], name: Config.type_column[1]},
  46. { value: Config.type_data[2], name: Config.type_column[2]},
  47. { value: Config.type_data[3], name: Config.type_column[3]},
  48. { value: Config.type_data[4], name: Config.type_column[4]},
  49. { value: Config.type_data[5], name: Config.type_column[5]}
  50. ],
  51. emphasis: {
  52. itemStyle: {
  53. shadowBlur: 10,
  54. shadowOffsetX: 0,
  55. shadowColor: 'rgba(0, 0, 0, 0.5)'
  56. }
  57. }
  58. }
  59. ]
  60. };
  61. // 使用刚指定的配置项和数据显示图表。
  62. myChart.setOption(option);
  63. myChart1.setOption(option1);
  64. }
  65. };
  66. return Controller;
  67. });