echarts.ts 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. import * as echarts from 'echarts/core';
  2. export const lineChartOption = {
  3. legend: { show: false },
  4. emphasis: { lineStyle: { width: 2 } },
  5. xAxis: {
  6. boundaryGap: false,
  7. type: 'value',
  8. axisLine: { lineStyle: { color: '#8C8C8C' } }
  9. },
  10. series: [
  11. {
  12. // name: '2011',
  13. type: 'bar',
  14. data: [0, 0, 0, 0],
  15. label: {
  16. show: true,
  17. position: 'right',
  18. fontSize: 10,
  19. color: '#777'
  20. },
  21. itemStyle: {
  22. normal: {
  23. color: (params: any) => {
  24. // 给出颜色组
  25. var colorList = ['#86BAFF', '#FFDB91', '#85DFCF', '#4E9BFF'];
  26. return colorList[params.dataIndex];
  27. }
  28. }
  29. }
  30. // itemStyle: {
  31. // normal: {
  32. // color: (params: any) => {
  33. // // 给出颜色组
  34. // let colorList = [
  35. // new echarts.graphic.LinearGradient(0, 1, 0, 1, [
  36. // { offset: 0, color: '#A1E8FF' },
  37. // { offset: 1, color: '#86BAFF' }
  38. // ]),
  39. // new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  40. // { offset: 0, color: '#69DCE8' },
  41. // { offset: 1, color: '#58A2FF' }
  42. // ]),
  43. // new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  44. // { offset: 0, color: '#69DCE8' },
  45. // { offset: 1, color: '#58A2FF' }
  46. // ]),
  47. // new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  48. // { offset: 0, color: '#69DCE8' },
  49. // { offset: 1, color: '#58A2FF' }
  50. // ])
  51. // ];
  52. // return colorList[params.dataIndex];
  53. // }
  54. // }
  55. // }
  56. // emphasis: {
  57. // itemStyle: {
  58. // color: (params: any) => {
  59. // // 给出颜色组
  60. // let colorList = [
  61. // new echarts.graphic.LinearGradient(0, 0, 0, 0, [
  62. // { offset: 0, color: '#A1E8FF' },
  63. // { offset: 1, color: '#86BAFF' }
  64. // ]),
  65. // new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  66. // { offset: 0, color: '#69DCE8' },
  67. // { offset: 1, color: '#58A2FF' }
  68. // ]),
  69. // new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  70. // { offset: 0, color: '#69DCE8' },
  71. // { offset: 1, color: '#58A2FF' }
  72. // ]),
  73. // new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  74. // { offset: 0, color: '#69DCE8' },
  75. // { offset: 1, color: '#58A2FF' }
  76. // ])
  77. // ];
  78. // return colorList[params.dataIndex];
  79. // }
  80. // }
  81. // }
  82. }
  83. ],
  84. title: { show: false },
  85. grid: {
  86. bottom: '3%',
  87. containLabel: true,
  88. left: '3%',
  89. right: '5%',
  90. top: '7%'
  91. },
  92. tooltip: {
  93. trigger: 'axis',
  94. confine: true
  95. },
  96. yAxis: {
  97. type: 'category',
  98. data: ['连连看', '单选题', '排序题', '多选题']
  99. },
  100. dataZoom: [{ type: 'inside', throttle: 100 }],
  101. toolbox: { feature: { saveAsImage: { show: false } } }
  102. };