From 8bdc07e041262df6f80afca0e01b1bfdc5b6a547 Mon Sep 17 00:00:00 2001 From: liugq Date: Fri, 12 Aug 2022 20:59:44 +0800 Subject: [PATCH] fixed no seriesField in options --- plugin/api/insight/metadata.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/plugin/api/insight/metadata.go b/plugin/api/insight/metadata.go index 494cd0e2..22219421 100644 --- a/plugin/api/insight/metadata.go +++ b/plugin/api/insight/metadata.go @@ -298,17 +298,9 @@ func getMetadataByIndexPattern(clusterID, indexPattern, timeField string, filter var ( metas []insight.Visualization seriesType string - options = map[string]interface{}{ - "yField": "value", - } + aggTypes []string ) - if timeField != "" { - options["xAxis"] = util.MapStr{ - "type": "time", - } - options["xField"] = "timestamp" - } var fieldNames []string for fieldName := range fieldsMeta.Aggregatable { fieldNames = append(fieldNames, fieldName) @@ -325,7 +317,15 @@ func getMetadataByIndexPattern(clusterID, indexPattern, timeField string, filter return nil, err } for fieldName, count := range counts { - delete(options, "seriesField") + options := map[string]interface{}{ + "yField": "value", + } + if timeField != "" { + options["xAxis"] = util.MapStr{ + "type": "time", + } + options["xField"] = "timestamp" + } if count <= 1 { continue }