BarConfig.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /**
  2. |--------------------------------------------------
  3. | 柱状图公共配置
  4. |--------------------------------------------------
  5. */
  6. let _BarOptions = {
  7. tooltip: {
  8. trigger: 'axis',
  9. axisPointer: {
  10. type: 'shadow',
  11. },
  12. },
  13. legend: {
  14. data: [],
  15. },
  16. grid: {
  17. left: '2%',
  18. right: '2%',
  19. top: 0,
  20. bottom: 0,
  21. containLabel: true,
  22. },
  23. xAxis: {
  24. show: true,
  25. type: 'value',
  26. boundaryGap: [0, 0],
  27. axisTick: {
  28. show: false,
  29. },
  30. axisLine: {
  31. lineStyle: {
  32. color: 'transparent',
  33. },
  34. },
  35. axisLabel: {
  36. show: false,
  37. color: '#fff',
  38. },
  39. splitLine: {
  40. lineStyle: {
  41. type: 'dotted',
  42. },
  43. },
  44. },
  45. yAxis: {
  46. type: 'category',
  47. axisLine: {
  48. lineStyle: {
  49. color: '#fff',
  50. },
  51. },
  52. axisLabel: {
  53. show: true,
  54. color: '#fff',
  55. },
  56. axisTick: {
  57. show: false,
  58. },
  59. data: [],
  60. },
  61. series: [
  62. {
  63. name: '',
  64. type: 'bar',
  65. barMaxWidth: 10,
  66. itemStyle: {
  67. normal: {
  68. color: '#a856f8',
  69. },
  70. },
  71. data: [],
  72. },
  73. ],
  74. }
  75. let handlerBarColor = colors => {
  76. return function(params) {
  77. let colorList = colors.reverse()
  78. return colorList[params.dataIndex]
  79. }
  80. }
  81. let BarOptions = JSON.parse(JSON.stringify(_BarOptions))
  82. export { BarOptions, handlerBarColor }