Chart2.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. Ext.define('school.view.analysis.attence.Chart2', {
  2. extend: 'school.view.core.chart.ChartBase',
  3. xtype: 'attence-chart2',
  4. title: '初三年级今日迟到人数',
  5. initComponent: function () {
  6. var me = this;
  7. Ext.apply(me, {
  8. items: [{
  9. xtype: 'echartsbase',
  10. bind: {
  11. store: '{chart2}',
  12. },
  13. createOption: me.createOption
  14. }]
  15. });
  16. me.callParent(arguments);
  17. },
  18. createOption: function (store) {
  19. var fields = [],
  20. data = [];
  21. store.each(function (d) {
  22. var d = d.data;
  23. fields.push(d.class);
  24. data.push(d.count);
  25. });
  26. return {
  27. color: [
  28. '#34BAF6'
  29. ],
  30. grid: {
  31. left: 0,
  32. right: 0,
  33. top: 40,
  34. bottom: 5,
  35. borderColor: '#E5EAEF',
  36. containLabel: true
  37. },
  38. tooltip: {
  39. trigger: 'axis',
  40. formatter: function (params, ticket, callback) {
  41. var name = '',
  42. series = [];
  43. for(var x = 0; x < params.length; x++) {
  44. var p = params[x],
  45. marker = p.marker,
  46. seriesName = p.seriesName,
  47. name = p.name,
  48. value = p.value;
  49. value = school.util.BaseUtil.numberFormat(value, 4, true);
  50. series.push(marker + value);
  51. }
  52. if(name.length > 9) {
  53. name = Ext.String.insert(name, '<br/>', 7)
  54. }
  55. return name + ': ' + '<br/>' + series.join('<br/>');
  56. }
  57. },
  58. xAxis: {
  59. type: 'category',
  60. axisLine: {
  61. lineStyle: {
  62. color: '#E5EAEF',
  63. }
  64. },
  65. axisLabel: {
  66. color: '#485465',
  67. interval: 0
  68. },
  69. data: fields,
  70. },
  71. yAxis: {
  72. type: 'value',
  73. interval: 1,
  74. axisLine: {
  75. lineStyle: {
  76. color: '#E5EAEF',
  77. }
  78. },
  79. splitLine: {
  80. lineStyle: {
  81. color: ['#E5EAEF']
  82. }
  83. },
  84. axisLabel: {
  85. color: '#485465'
  86. }
  87. },
  88. series: [{
  89. type: 'bar',
  90. barWidth: 25,
  91. data: data,
  92. label: {
  93. normal: {
  94. show: true,
  95. position: 'outside'
  96. }
  97. },
  98. }]
  99. };
  100. }
  101. });