fixed no seriesField in options

This commit is contained in:
liugq 2022-08-12 20:59:44 +08:00
parent 1bb10dce50
commit 8bdc07e041
1 changed files with 10 additions and 10 deletions

View File

@ -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
}