From 1ca01d1ec79524c56884adad1699b2185b409479 Mon Sep 17 00:00:00 2001 From: Fine Date: Wed, 2 Nov 2022 17:27:03 +0800 Subject: [PATCH] add legend types --- src/types/dashboard.d.ts | 12 +++++++++++ .../widget/graph-styles/Line.vue | 21 ++++++++++++++----- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src/types/dashboard.d.ts b/src/types/dashboard.d.ts index ceabab34..9ae422cd 100644 --- a/src/types/dashboard.d.ts +++ b/src/types/dashboard.d.ts @@ -95,6 +95,7 @@ export type GraphConfig = export interface BarConfig { type?: string; showBackground?: boolean; + LegendOptions?: LegendOptions; } export interface LineConfig extends AreaConfig { type?: string; @@ -110,6 +111,7 @@ export interface LineConfig extends AreaConfig { export interface AreaConfig { type?: string; opacity?: number; + LegendOptions?: LegendOptions; } export interface CardConfig { @@ -180,3 +182,13 @@ export type EventParams = { value: number | number[]; color: string; }; +export type LegendOptions = { + showLegend: boolean; + total: boolean; + min: boolean; + max: boolean; + mean: boolean; + asTable: boolean; + toTheRight: boolean; + width: number; +}; diff --git a/src/views/dashboard/configuration/widget/graph-styles/Line.vue b/src/views/dashboard/configuration/widget/graph-styles/Line.vue index 9b131250..65f1b973 100644 --- a/src/views/dashboard/configuration/widget/graph-styles/Line.vue +++ b/src/views/dashboard/configuration/widget/graph-styles/Line.vue @@ -44,7 +44,7 @@ limitations under the License. --> class="inputs" size="small" placeholder="Please input the width" - @change="updateLegendConfig({ toTheRight: legend.width })" + @change="updateLegendConfig({ width: legend.width })" />
@@ -68,14 +68,14 @@ limitations under the License. --> v-model="legend.mean" active-text="Yes" inactive-text="No" - @change="updateLegendConfig({ avg: legend.mean })" + @change="updateLegendConfig({ mean: legend.mean })" /> {{ t("total") }}
@@ -125,9 +125,10 @@ limitations under the License. -->