From fecc4fd533d948a12966c335da62b5aee4cc8e47 Mon Sep 17 00:00:00 2001 From: Deniz Kusefoglu Date: Sun, 16 Aug 2020 23:14:18 -0700 Subject: [PATCH] feat(bandChart): Update backend --- dashboard.go | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/dashboard.go b/dashboard.go index bfdec50d38..9a84bd5e75 100644 --- a/dashboard.go +++ b/dashboard.go @@ -376,6 +376,7 @@ const ( ViewPropertyTypeTable = "table" ViewPropertyTypeXY = "xy" ViewPropertyTypeMosaic = "mosaic" + ViewPropertyTypeBand = "band" ) // ViewProperties is used to mark other structures as conforming to a View. @@ -491,6 +492,12 @@ func UnmarshalViewPropertiesJSON(b []byte) (ViewProperties, error) { return nil, err } vis = mv + case ViewPropertyTypeBand: + var bv BandViewProperties + if err := json.Unmarshal(v.B, &bv); err != nil { + return nil, err + } + vis = bv } case "empty": var ev EmptyViewProperties @@ -545,6 +552,15 @@ func MarshalViewPropertiesJSON(v ViewProperties) ([]byte, error) { XYViewProperties: vis, } + case BandViewProperties: + s = struct { + Shape string `json:"shape"` + BandViewProperties + }{ + Shape: "chronograf-v2", + + BandViewProperties: vis, + } case LinePlusSingleStatProperties: s = struct { Shape string `json:"shape"` @@ -726,6 +742,24 @@ type XYViewProperties struct { HoverDimension string `json:"hoverDimension"` } +// BandViewProperties represents options for the band view +type BandViewProperties struct { + Queries []DashboardQuery `json:"queries"` + Axes map[string]Axis `json:"axes"` + Type string `json:"type"` + Legend Legend `json:"legend"` + Geom string `json:"geom"` + ViewColors []ViewColor `json:"colors"` + Note string `json:"note"` + ShowNoteWhenEmpty bool `json:"showNoteWhenEmpty"` + TimeFormat string `json:"timeFormat"` + HoverDimension string `json:"hoverDimension"` + XColumn string `json:"xColumn"` + YColumn string `json:"yColumn"` + UpperColumn string `json:"upperColumn"` + LowerColumn string `json:"lowerColumn"` +} + // CheckViewProperties represents options for a view representing a check type CheckViewProperties struct { Type string `json:"type"` @@ -880,6 +914,7 @@ type LogColumnSetting struct { } func (XYViewProperties) viewProperties() {} +func (BandViewProperties) viewProperties() {} func (LinePlusSingleStatProperties) viewProperties() {} func (SingleStatViewProperties) viewProperties() {} func (HistogramViewProperties) viewProperties() {} @@ -893,6 +928,7 @@ func (LogViewProperties) viewProperties() {} func (CheckViewProperties) viewProperties() {} func (v XYViewProperties) GetType() string { return v.Type } +func (v BandViewProperties) GetType() string { return v.Type } func (v LinePlusSingleStatProperties) GetType() string { return v.Type } func (v SingleStatViewProperties) GetType() string { return v.Type } func (v HistogramViewProperties) GetType() string { return v.Type }