dashboard.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 option = {
  7. title: {
  8. text: '',
  9. subtext: ''
  10. },
  11. color: [
  12. "#18d1b1",
  13. "#3fb1e3",
  14. "#626c91",
  15. "#a0a7e6",
  16. "#c4ebad",
  17. "#96dee8"
  18. ],
  19. tooltip: {
  20. trigger: 'axis'
  21. },
  22. legend: {
  23. data: [__('Register user')]
  24. },
  25. toolbox: {
  26. show: false,
  27. feature: {
  28. magicType: {show: true, type: ['stack', 'tiled']},
  29. saveAsImage: {show: true}
  30. }
  31. },
  32. xAxis: {
  33. type: 'category',
  34. boundaryGap: false,
  35. data: Config.column
  36. },
  37. yAxis: {},
  38. grid: [{
  39. left: 'left',
  40. top: 'top',
  41. right: '10',
  42. bottom: 30
  43. }],
  44. series: [{
  45. name: __('Register user'),
  46. type: 'line',
  47. smooth: true,
  48. areaStyle: {
  49. normal: {}
  50. },
  51. lineStyle: {
  52. normal: {
  53. width: 1.5
  54. }
  55. },
  56. data: Config.userdata
  57. }]
  58. };
  59. // 使用刚指定的配置项和数据显示图表。
  60. myChart.setOption(option);
  61. $(window).resize(function () {
  62. myChart.resize();
  63. });
  64. $(document).on("click", ".btn-refresh", function () {
  65. setTimeout(function () {
  66. myChart.resize();
  67. }, 0);
  68. });
  69. }
  70. };
  71. return Controller;
  72. });