echartsOption.js 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. import * as echarts from "echarts";
  2. import "echarts-wordcloud";
  3. // 时间分布
  4. export const getRiskTimeEchartsOption = () => {
  5. return {
  6. tooltip: { trigger: 'axis' },
  7. grid: { left: '8%', right: '2%', top: '10%', bottom: '18%' }, // 调整四周距离
  8. xAxis: {
  9. type: 'category',
  10. data: ['12/04', '12/05', '12/06', '12/07', '12/08', '12/09', '12/10'],
  11. axisLine: {
  12. lineStyle: {
  13. color: '#3FA7B6',
  14. width: 2, // 线宽
  15. dashOffset: 0, // 可能影响虚线样式,通常设为 0
  16. }
  17. }, // X 轴颜色
  18. axisTick: { show: false }, // 隐藏刻度线
  19. axisLabel: { color: '#9da8b8' } // X 轴文字颜色
  20. },
  21. yAxis: {
  22. type: 'value',
  23. axisLine: { lineStyle: { color: '#4A90E2' } }, // Y 轴颜色
  24. axisLabel: { color: '#7d8ba0' }, // Y 轴刻度值颜色
  25. splitLine: {
  26. lineStyle: {
  27. type: 'dashed', // 虚线
  28. color: '#3FA7B6',
  29. width: 1.5, // 线宽
  30. dashOffset: 0, // 可能影响虚线样式,通常设为 0
  31. }
  32. } // Y 轴背景横线虚线
  33. },
  34. series: [
  35. {
  36. type: 'bar',
  37. data: [3, 6, 2, 9, 5, 8, 10],
  38. barWidth: 17,
  39. itemStyle: {
  40. color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [
  41. { offset: 0, color: 'rgba(63, 174, 253, 0)' },
  42. { offset: 1, color: '#3FAEFD' }
  43. ])
  44. },
  45. barBackgroundStyle: { color: 'rgba(74, 144, 226, 0.2)' } // 背景透明色
  46. }
  47. ]
  48. };
  49. };
  50. export const getRiskAreaEchartsOption = () => {
  51. return {
  52. tooltip: { trigger: 'axis' },
  53. grid: { left: '10%', right: '5%', top: '10%', bottom: '18%' }, // 调整四周距离
  54. xAxis: {
  55. type: 'category',
  56. data: ['长宁区', '闵行区'],
  57. axisLine: {
  58. lineStyle: {
  59. color: '#3FA7B6',
  60. width: 2, // 线宽
  61. dashOffset: 0, // 可能影响虚线样式,通常设为 0
  62. }
  63. }, // X 轴颜色
  64. axisLabel: { color: '#9da8b8' } // X 轴文字颜色
  65. },
  66. yAxis: {
  67. type: 'value',
  68. axisLine: { lineStyle: { color: '#ccc' } }, // Y 轴颜色
  69. splitLine: {
  70. lineStyle: {
  71. type: 'dashed', // 虚线
  72. color: '#3FA7B6',
  73. width: 1.5, // 线宽
  74. dashOffset: 0, // 可能影响虚线样式,通常设为 0
  75. } } // Y 轴背景横线虚线
  76. },
  77. series: [
  78. {
  79. type: 'bar',
  80. data: [5, 9],
  81. barWidth: 17,
  82. itemStyle: {
  83. color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [
  84. { offset: 0, color: 'rgba(251,165,65,0)' },
  85. { offset: 1, color: '#FBA541' }
  86. ])
  87. }
  88. }
  89. ]
  90. };
  91. };