From d1eef46af7c9b21a8d8f4cc6696a60419872a0e2 Mon Sep 17 00:00:00 2001 From: tanhao <2424726204@qq.com> Date: Thu, 25 May 2023 11:52:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20echarts=E5=85=AC=E5=85=B1=E5=9B=BE?= =?UTF-8?q?=E4=BE=8B=E6=96=B0=E5=A2=9E=E8=AF=A6=E7=BB=86=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Pages/ChartItemSetting/GlobalSetting.vue | 43 +++++++++++- .../chartConfiguration/echarts/index.ts | 3 +- .../chartConfiguration/echarts/legend.ts | 70 +++++++++++++++++++ src/settings/chartThemes/global.theme.json | 12 +++- 4 files changed, 123 insertions(+), 5 deletions(-) create mode 100644 src/packages/chartConfiguration/echarts/legend.ts diff --git a/src/components/Pages/ChartItemSetting/GlobalSetting.vue b/src/components/Pages/ChartItemSetting/GlobalSetting.vue index a416e69c..81f9d3d7 100644 --- a/src/components/Pages/ChartItemSetting/GlobalSetting.vue +++ b/src/components/Pages/ChartItemSetting/GlobalSetting.vue @@ -257,9 +257,36 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -309,9 +336,9 @@ diff --git a/src/packages/chartConfiguration/echarts/index.ts b/src/packages/chartConfiguration/echarts/index.ts index 29fa8f02..a8604e33 100644 --- a/src/packages/chartConfiguration/echarts/index.ts +++ b/src/packages/chartConfiguration/echarts/index.ts @@ -1,3 +1,4 @@ export * from './axis' export * from './line' -export * from './label' \ No newline at end of file +export * from './label' +export * from './legend' \ No newline at end of file diff --git a/src/packages/chartConfiguration/echarts/legend.ts b/src/packages/chartConfiguration/echarts/legend.ts new file mode 100644 index 00000000..c243431d --- /dev/null +++ b/src/packages/chartConfiguration/echarts/legend.ts @@ -0,0 +1,70 @@ +export const legendConfig = { + // X轴位置 + lengendX: [ + { + label: '靠左', + value: 'left' + }, + { + label: '居中', + value: 'center' + }, + { + label: '靠右', + value: 'right' + } + ], + // y轴位置 + lengendY: [ + { + label: '靠上', + value: 'top' + }, + { + label: '居中', + value: 'center' + }, + { + label: '靠下', + value: 'bottom' + } + ], + // 排列方向 + orient: [ + { + label: '水平', + value: 'horizontal' + }, + { + label: '垂直', + value: 'vertical' + } + ], + // 形状 + shape: [ + { + label: '圆形', + value: 'circle' + }, + { + label: '方形', + value: 'rect' + }, + { + label: '圆角方形', + value: 'roundRect' + }, + { + label: '三角形', + value: 'triangle' + }, + { + label: '钢笔形', + value: 'pin' + }, + { + label: '箭头形', + value: 'arrow' + } + ] +} diff --git a/src/settings/chartThemes/global.theme.json b/src/settings/chartThemes/global.theme.json index 1c099af8..0fd24712 100644 --- a/src/settings/chartThemes/global.theme.json +++ b/src/settings/chartThemes/global.theme.json @@ -86,8 +86,18 @@ }, "legend": { "show": true, - "top": "5%", + "type": "scroll", + "x": "center", + "y": "top", + "icon": "circle", + "orient": "horizontal", "textStyle": { + "color": "#B9B8CE", + "fontSize": 18 + }, + "itemHeight": 15, + "itemWidth": 15, + "pageTextStyle": { "color": "#B9B8CE" } },