From ddf46fe8c1ad9da6435738680afe700219018ecd Mon Sep 17 00:00:00 2001 From: Fine Date: Thu, 3 Nov 2022 16:57:51 +0800 Subject: [PATCH] update --- src/hooks/useLegendProcessor.ts | 14 ++++++++++++++ .../widget/graph-styles/components/Legend.vue | 6 ++++-- src/views/dashboard/graphs/Area.vue | 3 ++- src/views/dashboard/graphs/Bar.vue | 4 +++- src/views/dashboard/graphs/Line.vue | 4 +++- 5 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/hooks/useLegendProcessor.ts b/src/hooks/useLegendProcessor.ts index 366cda74..3c0f3aa9 100644 --- a/src/hooks/useLegendProcessor.ts +++ b/src/hooks/useLegendProcessor.ts @@ -14,3 +14,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { LegendOptions } from "@/types/dashboard"; + +export default function useLegendProcess() { + function showEchartsLegend(keys: string[], legend?: LegendOptions) { + if (keys.length === 1) { + return false; + } + if (legend && legend.asTable) { + return false; + } + return true; + } + return { showEchartsLegend }; +} diff --git a/src/views/dashboard/configuration/widget/graph-styles/components/Legend.vue b/src/views/dashboard/configuration/widget/graph-styles/components/Legend.vue index f22f2ce6..9d76c5e6 100644 --- a/src/views/dashboard/configuration/widget/graph-styles/components/Legend.vue +++ b/src/views/dashboard/configuration/widget/graph-styles/components/Legend.vue @@ -14,14 +14,16 @@ See the License for the specific language governing permissions and limitations under the License. -->