index.ts 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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. show: true,
  32. left: "center",
  33. top: 8,
  34. textStyle: {
  35. color: "#FFFFFFFF",
  36. fontSize: 16,
  37. fontWeight: "normal",
  38. },
  39. },
  40. // 图例
  41. legend: {
  42. show: true,
  43. textStyle: {
  44. color: "#FFFFFFFF",
  45. },
  46. top: 32,
  47. },
  48. // 布局
  49. grid: {
  50. bottom: 34,
  51. right: 20,
  52. left: 50,
  53. top: 60,
  54. },
  55. // x轴
  56. xAxis: {
  57. type: "category",
  58. name: '',
  59. nameLocation: "middle",
  60. nameTruncate: {
  61. ellipsis: "...",
  62. maxWidth: 80
  63. },
  64. nameTextStyle: {
  65. color: '#FFFFFFFF',
  66. fontSize: 12,
  67. fontWeight: 'normal',
  68. fontStyle: 'normal'
  69. },
  70. axisLabel: {
  71. show: true,
  72. color: "#9fadbf",
  73. fontSize: 12,
  74. fontWeight: "normal",
  75. fontStyle: "normal",
  76. },
  77. axisLine: {
  78. show: true,
  79. lineStyle: {
  80. width: 1
  81. }
  82. },
  83. axisTick: {
  84. show: true,
  85. lineStyle: {
  86. width: 1,
  87. color: "#ccc"
  88. }
  89. }
  90. },
  91. // y轴
  92. yAxis: {
  93. splitLine: {
  94. show: true,
  95. lineStyle: {
  96. type: "dashed",
  97. color: "#36485f",
  98. },
  99. },
  100. type: "category",
  101. name: '',
  102. nameLocation: "middle",
  103. nameTruncate: {
  104. ellipsis: "...",
  105. maxWidth: 80
  106. },
  107. nameTextStyle: {
  108. color: '#FFFFFFFF',
  109. fontSize: 12,
  110. fontWeight: 'normal',
  111. fontStyle: 'normal'
  112. },
  113. axisLabel: {
  114. show: true,
  115. color: "#9fadbf",
  116. fontSize: 12,
  117. fontWeight: "normal",
  118. fontStyle: "normal",
  119. rotate: 0,
  120. },
  121. axisLine: {
  122. show: false,
  123. lineStyle: {
  124. width: 1,
  125. color: "#ccc"
  126. }
  127. },
  128. axisTick: {
  129. show: false,
  130. lineStyle: {
  131. width: 1,
  132. color: "#ccc"
  133. }
  134. }
  135. },
  136. // 提示
  137. tooltip: {
  138. show: true,
  139. trigger: "axis",
  140. formatter: "{b}",
  141. // valueFormatter: "(value, dataIndex) => value",
  142. axisPointer: {
  143. type: "line",
  144. },
  145. textStyle: {
  146. color: "#FFFFFF",
  147. fontSize: 12,
  148. fontWeight: "normal",
  149. fontStyle: "normal",
  150. },
  151. padding: 10,
  152. borderWidth: 1,
  153. borderColor: "#ccc",
  154. borderRadius: 4,
  155. backgroundColor: "#fff",
  156. extraCssText: "",
  157. }
  158. }
  159. // 组件容器基本设置
  160. export const containerDefaultConfig = {
  161. /* ===================================== 通用容器样式 ============================================ */
  162. style: {
  163. background: {
  164. type: "color", // none, color, image
  165. color: "rgba(0, 0, 0, 0.1)",
  166. image: "",
  167. fillType: "",
  168. },
  169. border: {
  170. type: "none",
  171. color: "#000",
  172. width: 0,
  173. },
  174. borderRadius: {
  175. type: "all", // all, custom
  176. value: 2, // 整体圆角值
  177. unit: "px", // 单位
  178. units: ["px", "%"], // 单位列表
  179. topLeft: 0,
  180. topRight: 0,
  181. bottomLeft: 0,
  182. bottomRight: 0,
  183. },
  184. boxShadow: {
  185. enabled: false,
  186. color: "#000",
  187. offsetX: 0,
  188. offsetY: 0,
  189. blurRadius: 0,
  190. spreadRadius: 0,
  191. inset: false,
  192. },
  193. backdropFilter: {
  194. enabled: false,
  195. blur: 0,
  196. }
  197. },
  198. /* ===================================== 通用容器属性 ============================================ */
  199. props: {
  200. width: 0,
  201. height: 0,
  202. x: 0,
  203. y: 0,
  204. paddingLeft: 0,
  205. paddingRight: 0,
  206. paddingTop: 0,
  207. paddingBottom: 0,
  208. rotateX: 0,
  209. rotateY: 0,
  210. rotateZ: 0,
  211. opacity: 1,
  212. },
  213. };