index.ts 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. import { EChartsOption } from "echarts"
  2. // 颜色预设集合
  3. export const colorPreset = [
  4. {
  5. name: '清新',
  6. color: ['#00a8e1', '#99cc00', '#e30039', '#fcd300', '#800080']
  7. },
  8. {
  9. name: '复古',
  10. color: ['#FFA69E', '#FAE3D9', '#B8F2E6', '#56E39F', '#3A837D']
  11. },
  12. {
  13. name: '商务',
  14. color: ['#194f97', '#555555', '#bd6b08', '#00686b', '#c82d31']
  15. },
  16. {
  17. name: '经典',
  18. color: ['#002c53', '#ffa510', '#0c84c6', '#ffffff', '#f74d4d']
  19. },
  20. {
  21. name: '怀旧',
  22. color: ['#3b6291', '#943c39', '#779043', '#624c7c', '#388498']
  23. }
  24. ]
  25. // 图表默认配置项
  26. export const chartDefaultConfig: EChartsOption = {
  27. // 调色盘-预设颜色
  28. color: colorPreset[0].color,
  29. // 标题
  30. title: {
  31. left: "center",
  32. top: 8,
  33. textStyle: {
  34. color: "#fff",
  35. fontSize: 16,
  36. },
  37. },
  38. // 图例
  39. legend: {
  40. textStyle: {
  41. color: "#fff",
  42. },
  43. top: 32,
  44. },
  45. // 布局
  46. grid: {
  47. bottom: 34,
  48. right: 20,
  49. top: 60,
  50. },
  51. // 提示框
  52. tooltip: {},
  53. // x轴
  54. xAxis: {
  55. type: "category",
  56. axisLabel: {
  57. color: "#9fadbf",
  58. },
  59. },
  60. // y轴
  61. yAxis: {
  62. axisLabel: {
  63. color: "#9fadbf",
  64. },
  65. splitLine: {
  66. lineStyle: {
  67. type: "dashed",
  68. color: "#36485f",
  69. },
  70. },
  71. },
  72. }
  73. // 组件容器基本设置
  74. export const containerDefaultConfig = {
  75. /* ===================================== 通用容器样式 ============================================ */
  76. style: {
  77. background: {
  78. type: "color", // none, color, image
  79. color: "rgba(0, 0, 0, 0.1)",
  80. image: "",
  81. fillType: "",
  82. },
  83. border: {
  84. type: "none",
  85. color: "#000",
  86. width: 0,
  87. },
  88. borderRadius: {
  89. type: "all", // all, custom
  90. value: 2, // 整体圆角值
  91. unit: "px", // 单位
  92. units: ["px", "%"], // 单位列表
  93. topLeft: 0,
  94. topRight: 0,
  95. bottomLeft: 0,
  96. bottomRight: 0,
  97. },
  98. boxShadow: {
  99. enabled: false,
  100. color: "#000",
  101. offsetX: 0,
  102. offsetY: 0,
  103. blurRadius: 0,
  104. spreadRadius: 0,
  105. inset: false,
  106. },
  107. backdropFilter: {
  108. enabled: false,
  109. blur: 0,
  110. }
  111. },
  112. /* ===================================== 通用容器属性 ============================================ */
  113. props: {
  114. width: 0,
  115. height: 0,
  116. x: 0,
  117. y: 0,
  118. paddingLeft: 0,
  119. paddingRight: 0,
  120. paddingTop: 0,
  121. paddingBottom: 0,
  122. rotateX: 0,
  123. rotateY: 0,
  124. rotateZ: 0,
  125. opacity: 1,
  126. },
  127. };