Geen omschrijving

index.js 3.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /**
  2. * Created by TT on 2017/4/19.
  3. */
  4. ;
  5. spa_define(function () {
  6. return $.use(["spa", "code", "form", "util", "dict"], function (spa, code, form, util, dict) {
  7. return {
  8. main: function () {
  9. var root = spa.findInMain(".sys_chart_index");
  10. var qf = form.build(root.find(".queryForm"));
  11. var queryBtn = root.find(".queryForm .icon-search");
  12. var myChart1 = echarts.init(document.getElementById('type'));
  13. var tableData = {data: []}, tableData2 = {data: []},
  14. allData = [];
  15. var load = function () {
  16. util.get("../ajax/operation/statist/user", null, function (data) {
  17. allData = data || [];
  18. query();
  19. query2();
  20. var option = {
  21. color: colors,
  22. title: {
  23. text: '用户流量统计',
  24. subtext: '最近7天'
  25. },
  26. tooltip: {
  27. trigger: 'axis'
  28. },
  29. legend: {
  30. data: ['新增用户', '新增激活用户']
  31. },
  32. xAxis: {
  33. data: allData.map(function (item) {
  34. return item.createTime;
  35. }),
  36. boundaryGap: false
  37. },
  38. yAxis: {
  39. splitLine: {
  40. show: false
  41. },
  42. boundaryGap: false,
  43. type: "value",
  44. interval: 1,
  45. min: 0
  46. },
  47. toolbox: {
  48. show: true,
  49. feature: {
  50. dataZoom: {
  51. yAxisIndex: 'none'
  52. },
  53. dataView: {readOnly: true},
  54. magicType: {type: ['line', 'bar']},
  55. restore: {},
  56. saveAsImage: {}
  57. }
  58. },
  59. dataZoom: [{
  60. startValue: ""
  61. }, {
  62. type: 'inside'
  63. }],
  64. visualMap: {
  65. top: 10,
  66. right: 10,
  67. },
  68. series: [{
  69. name: '新增用户',
  70. type: 'line',
  71. data: allData.map(function (item) {
  72. return item.znum;
  73. }),
  74. }, {
  75. name: '新增激活用户',
  76. type: 'line',
  77. data: allData.map(function (item) {
  78. return item.jnum;
  79. })
  80. }
  81. ]
  82. };
  83. myChart1.setOption(option1);
  84. }, {});
  85. };
  86. },
  87. mainDestory: function () {
  88. }
  89. };
  90. });
  91. });