diff --git a/charts/series.go b/charts/series.go index 25910022..74dd0362 100644 --- a/charts/series.go +++ b/charts/series.go @@ -120,6 +120,12 @@ type SingleSeries struct { Data interface{} `json:"data,omitempty"` DatasetIndex int `json:"datasetIndex,omitempty"` + // Gauge + Progress *opts.Progress `json:"progress,omitempty"` + AxisTick *opts.AxisTick `json:"axisTick,omitempty"` + Detail *opts.Detail `json:"detail,omitempty"` + Title *opts.Title `json:"title,omitempty"` + // Shared below ===================================================== Large types.Bool `json:"large,omitempty"` LargeThreshold int `json:"largeThreshold,omitempty"` diff --git a/opts/charts.go b/opts/charts.go index e74a23be..be0de330 100644 --- a/opts/charts.go +++ b/opts/charts.go @@ -608,6 +608,37 @@ type CustomChart struct { RenderItem types.FuncStr } +// Progress is the options set for progress. +type Progress struct { + // Wether to show the progress + Show types.Bool `json:"show,omitempty"` + // Width of the progress in px + Width int `json:"width,omitempty"` +} + +// Detail is the options set for detail (e.g. on a gauge). +type Detail struct { + // The content formatter of value + // + // 1. String template + // The template variable is {value}. + // + // 2. Callback function + // The format of callback function: + // (value: number) => string + Formatter types.FuncStr `json:"formatter,omitempty"` + + // Font size of the value in px + FontSize int `json:"fontSize,omitempty"` + + // Value position relative to the center of chart + // OffceCenter is provided as [x, y] where x and y are either a number (px, provided + // as string) or a percentage. + // Positive values move the chart value to [right, bottom], negative values vice + // versa. + OffsetCenter []string `json:"offsetCenter,omitempty"` +} + // CustomData // https://echarts.apache.org/en/option.html#series-custom.data type CustomData struct { diff --git a/opts/title.go b/opts/title.go index fbef857f..79d0ad6f 100644 --- a/opts/title.go +++ b/opts/title.go @@ -79,4 +79,11 @@ type Title struct { // borderRadius: [5, 5, 0, 0] // (clockwise upper left, upper right, bottom right and bottom left) // FYI, use [1] is same to number 1 BorderRadius []int `json:"borderRadius,omitempty"` + + // Value position relative to the center of chart + // OffceCenter is provided as [x, y] where x and y are either a number (px, provided + // as string) or a percentage. + // Positive values move the chart value to [right, bottom], negative values vice + // versa. + OffsetCenter []string `json:"offsetCenter,omitempty"` }