dashboard.js 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. define(['jquery', 'bootstrap', 'backend', 'addtabs', 'table', 'echarts', 'echarts-theme'], function ($, undefined, Backend, Datatable, Table, Echarts) {
  2. var Controller = {
  3. index: function () {
  4. // 基于准备好的dom,初始化echarts实例
  5. var myChart = Echarts.init(document.getElementById('echart'), 'walden');
  6. // 指定图表的配置项和数据
  7. var option = {
  8. title: {
  9. text: '',
  10. subtext: ''
  11. },
  12. tooltip: {
  13. trigger: 'axis'
  14. },
  15. legend: {
  16. data: ['下单', '成交']
  17. },
  18. toolbox: {
  19. show: false,
  20. feature: {
  21. magicType: {show: true, type: ['stack', 'tiled']},
  22. saveAsImage: {show: true}
  23. }
  24. },
  25. xAxis: {
  26. type: 'category',
  27. boundaryGap: false,
  28. data: Orderdata.column
  29. },
  30. yAxis: {
  31. },
  32. grid: [{
  33. left: 'left',
  34. top: 'top',
  35. right: '10',
  36. bottom:30
  37. }],
  38. series: [{
  39. name: '成交',
  40. type: 'line',
  41. smooth: true,
  42. areaStyle: {
  43. normal: {
  44. }
  45. },
  46. lineStyle: {
  47. normal: {
  48. width:1.5
  49. }
  50. },
  51. data: Orderdata.paydata
  52. },
  53. {
  54. name: '下单',
  55. type: 'line',
  56. smooth: true,
  57. areaStyle: {
  58. normal: {
  59. }
  60. },
  61. lineStyle: {
  62. normal: {
  63. width:1.5
  64. }
  65. },
  66. data: Orderdata.createdata
  67. }]
  68. };
  69. // 使用刚指定的配置项和数据显示图表。
  70. myChart.setOption(option);
  71. $(window).resize(function(){
  72. myChart.resize();
  73. });
  74. }
  75. };
  76. return Controller;
  77. });