Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add tick generation properties and legendColorizeRows #19839

Merged
merged 1 commit into from
Oct 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 64 additions & 12 deletions dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -716,12 +716,20 @@ type LinePlusSingleStatProperties struct {
DecimalPlaces DecimalPlaces `json:"decimalPlaces"`
Note string `json:"note"`
ShowNoteWhenEmpty bool `json:"showNoteWhenEmpty"`
GenerateAxisTicks bool `json:"generateAxisTicks"`
XColumn string `json:"xColumn"`
XTotalTicks int `json:"xTotalTicks"`
XTickStart float64 `json:"xTickStart"`
XTickStep float64 `json:"xTickStep"`
YColumn string `json:"yColumn"`
YTotalTicks int `json:"yTotalTicks"`
YTickStart float64 `json:"yTickStart"`
YTickStep float64 `json:"yTickStep"`
ShadeBelow bool `json:"shadeBelow"`
Position string `json:"position"`
TimeFormat string `json:"timeFormat"`
HoverDimension string `json:"hoverDimension"`
LegendColorizeRows bool `json:"legendColorizeRows"`
LegendOpacity float64 `json:"legendOpacity"`
LegendOrientationThreshold int `json:"legendOrientationThreshold"`
}
Expand All @@ -736,12 +744,20 @@ type XYViewProperties struct {
ViewColors []ViewColor `json:"colors"`
Note string `json:"note"`
ShowNoteWhenEmpty bool `json:"showNoteWhenEmpty"`
GenerateAxisTicks bool `json:"generateAxisTicks"`
XColumn string `json:"xColumn"`
XTotalTicks int `json:"xTotalTicks"`
XTickStart float64 `json:"xTickStart"`
XTickStep float64 `json:"xTickStep"`
YColumn string `json:"yColumn"`
YTotalTicks int `json:"yTotalTicks"`
YTickStart float64 `json:"yTickStart"`
YTickStep float64 `json:"yTickStep"`
ShadeBelow bool `json:"shadeBelow"`
Position string `json:"position"`
TimeFormat string `json:"timeFormat"`
HoverDimension string `json:"hoverDimension"`
LegendColorizeRows bool `json:"legendColorizeRows"`
LegendOpacity float64 `json:"legendOpacity"`
LegendOrientationThreshold int `json:"legendOrientationThreshold"`
}
Expand All @@ -758,11 +774,19 @@ type BandViewProperties struct {
ShowNoteWhenEmpty bool `json:"showNoteWhenEmpty"`
TimeFormat string `json:"timeFormat"`
HoverDimension string `json:"hoverDimension"`
GenerateAxisTicks bool `json:"generateAxisTicks"`
XColumn string `json:"xColumn"`
XTotalTicks int `json:"xTotalTicks"`
XTickStart float64 `json:"xTickStart"`
XTickStep float64 `json:"xTickStep"`
YColumn string `json:"yColumn"`
YTotalTicks int `json:"yTotalTicks"`
YTickStart float64 `json:"yTickStart"`
YTickStep float64 `json:"yTickStep"`
UpperColumn string `json:"upperColumn"`
MainColumn string `json:"mainColumn"`
LowerColumn string `json:"lowerColumn"`
LegendColorizeRows bool `json:"legendColorizeRows"`
LegendOpacity float64 `json:"legendOpacity"`
LegendOrientationThreshold int `json:"legendOrientationThreshold"`
}
Expand All @@ -773,24 +797,30 @@ type CheckViewProperties struct {
CheckID string `json:"checkID"`
Queries []DashboardQuery `json:"queries"`
ViewColors []string `json:"colors"`
GenerateAxisTicks bool `json:"generateAxisTicks"`
XTotalTicks int `json:"xTotalTicks"`
XTickStart float64 `json:"xTickStart"`
XTickStep float64 `json:"xTickStep"`
YTotalTicks int `json:"yTotalTicks"`
YTickStart float64 `json:"yTickStart"`
YTickStep float64 `json:"yTickStep"`
LegendColorizeRows bool `json:"legendColorizeRows"`
LegendOpacity float64 `json:"legendOpacity"`
LegendOrientationThreshold int `json:"legendOrientationThreshold"`
}

// SingleStatViewProperties represents options for single stat view in Chronograf
type SingleStatViewProperties struct {
Type string `json:"type"`
Queries []DashboardQuery `json:"queries"`
Prefix string `json:"prefix"`
TickPrefix string `json:"tickPrefix"`
Suffix string `json:"suffix"`
TickSuffix string `json:"tickSuffix"`
ViewColors []ViewColor `json:"colors"`
DecimalPlaces DecimalPlaces `json:"decimalPlaces"`
Note string `json:"note"`
ShowNoteWhenEmpty bool `json:"showNoteWhenEmpty"`
LegendOpacity float64 `json:"legendOpacity"`
LegendOrientationThreshold int `json:"legendOrientationThreshold"`
Type string `json:"type"`
Queries []DashboardQuery `json:"queries"`
Prefix string `json:"prefix"`
TickPrefix string `json:"tickPrefix"`
Suffix string `json:"suffix"`
TickSuffix string `json:"tickSuffix"`
ViewColors []ViewColor `json:"colors"`
DecimalPlaces DecimalPlaces `json:"decimalPlaces"`
Note string `json:"note"`
ShowNoteWhenEmpty bool `json:"showNoteWhenEmpty"`
}

// HistogramViewProperties represents options for histogram view in Chronograf
Expand All @@ -806,6 +836,7 @@ type HistogramViewProperties struct {
BinCount int `json:"binCount"`
Note string `json:"note"`
ShowNoteWhenEmpty bool `json:"showNoteWhenEmpty"`
LegendColorizeRows bool `json:"legendColorizeRows"`
LegendOpacity float64 `json:"legendOpacity"`
LegendOrientationThreshold int `json:"legendOrientationThreshold"`
}
Expand All @@ -816,8 +847,15 @@ type HeatmapViewProperties struct {
Queries []DashboardQuery `json:"queries"`
ViewColors []string `json:"colors"`
BinSize int32 `json:"binSize"`
GenerateAxisTicks bool `json:"generateAxisTicks"`
XColumn string `json:"xColumn"`
XTotalTicks int `json:"xTotalTicks"`
XTickStart float64 `json:"xTickStart"`
XTickStep float64 `json:"xTickStep"`
YColumn string `json:"yColumn"`
YTotalTicks int `json:"yTotalTicks"`
YTickStart float64 `json:"yTickStart"`
YTickStep float64 `json:"yTickStep"`
XDomain []float64 `json:"xDomain,omitempty"`
YDomain []float64 `json:"yDomain,omitempty"`
XAxisLabel string `json:"xAxisLabel"`
Expand All @@ -829,6 +867,7 @@ type HeatmapViewProperties struct {
Note string `json:"note"`
ShowNoteWhenEmpty bool `json:"showNoteWhenEmpty"`
TimeFormat string `json:"timeFormat"`
LegendColorizeRows bool `json:"legendColorizeRows"`
LegendOpacity float64 `json:"legendOpacity"`
LegendOrientationThreshold int `json:"legendOrientationThreshold"`
}
Expand All @@ -840,8 +879,15 @@ type ScatterViewProperties struct {
ViewColors []string `json:"colors"`
FillColumns []string `json:"fillColumns"`
SymbolColumns []string `json:"symbolColumns"`
GenerateAxisTicks bool `json:"generateAxisTicks"`
XColumn string `json:"xColumn"`
XTotalTicks int `json:"xTotalTicks"`
XTickStart float64 `json:"xTickStart"`
XTickStep float64 `json:"xTickStep"`
YColumn string `json:"yColumn"`
YTotalTicks int `json:"yTotalTicks"`
YTickStart float64 `json:"yTickStart"`
YTickStep float64 `json:"yTickStep"`
XDomain []float64 `json:"xDomain,omitempty"`
YDomain []float64 `json:"yDomain,omitempty"`
XAxisLabel string `json:"xAxisLabel"`
Expand All @@ -853,6 +899,7 @@ type ScatterViewProperties struct {
Note string `json:"note"`
ShowNoteWhenEmpty bool `json:"showNoteWhenEmpty"`
TimeFormat string `json:"timeFormat"`
LegendColorizeRows bool `json:"legendColorizeRows"`
LegendOpacity float64 `json:"legendOpacity"`
LegendOrientationThreshold int `json:"legendOrientationThreshold"`
}
Expand All @@ -863,7 +910,11 @@ type MosaicViewProperties struct {
Queries []DashboardQuery `json:"queries"`
ViewColors []string `json:"colors"`
FillColumns []string `json:"fillColumns"`
GenerateAxisTicks bool `json:"generateAxisTicks"`
XColumn string `json:"xColumn"`
XTotalTicks int `json:"xTotalTicks"`
XTickStart float64 `json:"xTickStart"`
XTickStep float64 `json:"xTickStep"`
YSeriesColumns []string `json:"ySeriesColumns"`
XDomain []float64 `json:"xDomain,omitempty"`
YDomain []float64 `json:"yDomain,omitempty"`
Expand All @@ -876,6 +927,7 @@ type MosaicViewProperties struct {
Note string `json:"note"`
ShowNoteWhenEmpty bool `json:"showNoteWhenEmpty"`
TimeFormat string `json:"timeFormat"`
LegendColorizeRows bool `json:"legendColorizeRows"`
LegendOpacity float64 `json:"legendOpacity"`
LegendOrientationThreshold int `json:"legendOrientationThreshold"`
}
Expand Down
12 changes: 10 additions & 2 deletions dashboard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,20 @@ func TestView_MarshalJSON(t *testing.T) {
"geom": "",
"note": "",
"showNoteWhenEmpty": false,
"xColumn": "",
"yColumn": "",
"generateAxisTicks": false,
"xColumn": "",
"xTotalTicks": 0,
"xTickStart": 0,
"xTickStep": 0,
"yColumn": "",
"yTotalTicks": 0,
"yTickStart": 0,
"yTickStep": 0,
"shadeBelow": false,
"position": "",
"timeFormat": "",
"hoverDimension": "",
"legendColorizeRows": false,
"legendOpacity": 0,
"legendOrientationThreshold": 0
}
Expand Down
16 changes: 16 additions & 0 deletions http/dashboard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -464,8 +464,16 @@ func TestService_handleGetDashboard(t *testing.T) {
"showNoteWhenEmpty": false,
"timeFormat": "",
"type": "xy",
"generateAxisTicks": false,
"xColumn": "",
"xTotalTicks": 0,
"xTickStart": 0,
"xTickStep": 0,
"yColumn": "",
"yTotalTicks": 0,
"yTickStart": 0,
"yTickStep": 0,
"legendColorizeRows": false,
"legendOpacity": 0,
"legendOrientationThreshold": 0
},
Expand Down Expand Up @@ -983,9 +991,17 @@ func TestService_handlePostDashboard(t *testing.T) {
"showNoteWhenEmpty": false,
"timeFormat": "",
"type": "",
"generateAxisTicks": false,
"xColumn": "",
"xTotalTicks": 0,
"xTickStart": 0,
"xTickStep": 0,
"yColumn": "",
"yTotalTicks": 0,
"yTickStart": 0,
"yTickStep": 0,
"type": "xy",
"legendColorizeRows": false,
"legendOpacity": 0,
"legendOrientationThreshold": 0
},
Expand Down
Loading