Chart1.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. Ext.define('school.view.analysis.attence.Chart1', {
  2. extend: 'school.view.core.chart.ChartBase',
  3. xtype: 'attence-chart1',
  4. title: '初三年级本周准勤率',
  5. initComponent: function () {
  6. var me = this;
  7. Ext.apply(me, {
  8. items: [{
  9. xtype: 'echartsbase',
  10. bind: {
  11. store: '{chart1}',
  12. },
  13. createOption: me.createOption.bind(me)
  14. }]
  15. });
  16. me.callParent(arguments);
  17. },
  18. createOption: function (store) {
  19. var me = this,
  20. fields = [],
  21. cFields = ['一班', '二班', '三班', '四班'],
  22. c1 = [],
  23. c2 = [],
  24. c3 = [],
  25. c4 = [],
  26. cDatas = [],
  27. o;
  28. store.each(function (d) {
  29. var d = d.data;
  30. fields.push(d.day);
  31. c1.push(d.c1);
  32. c2.push(d.c2);
  33. c3.push(d.c3);
  34. c4.push(d.c4);
  35. });
  36. cDatas.push(c1, c2, c3, c4);
  37. return {
  38. grid: {
  39. left: 0,
  40. right: 0,
  41. top: 40,
  42. bottom: 5,
  43. borderColor: '#E5EAEF',
  44. containLabel: true
  45. },
  46. xAxis: {
  47. type: 'category',
  48. axisLine: {
  49. lineStyle: {
  50. color: '#E5EAEF',
  51. }
  52. },
  53. axisLabel: {
  54. color: '#485465',
  55. interval: 0
  56. },
  57. data: fields,
  58. },
  59. yAxis: {
  60. type: 'value',
  61. min: 85,
  62. axisLine: {
  63. lineStyle: {
  64. color: '#E5EAEF',
  65. }
  66. },
  67. splitLine: {
  68. lineStyle: {
  69. color: ['#E5EAEF']
  70. }
  71. },
  72. axisLabel: {
  73. color: '#485465'
  74. }
  75. },
  76. legend: {
  77. data: cFields
  78. },
  79. series: me.getSeries(cFields, cDatas)
  80. };
  81. },
  82. getSeries: function(fields, datas) {
  83. let series = [];
  84. for(let i = fields.length - 1; i >= 0 ; i--) {
  85. let s = {
  86. name: fields[i],
  87. type: 'line',
  88. label: {
  89. normal: {
  90. show: true
  91. }
  92. },
  93. data: datas[i]
  94. };
  95. series.push(s);
  96. }
  97. return series;
  98. }
  99. });