mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
BarChart: value label sizing (#34229)
* Bar chart label positioning and sizing * Dev dashbard * Improve autosizing * Remove sync option * Unify text sizing options between stat-ish visualizations and bar chart * Add simple categorical data scenario and update dev dashboard * Remove unused options builder * Add docs annotations * Fix go lint
This commit is contained in:
@@ -39,6 +39,7 @@ const (
|
||||
serverError500Query queryType = "server_error_500"
|
||||
logsQuery queryType = "logs"
|
||||
nodeGraphQuery queryType = "node_graph"
|
||||
categoricalDataQuery queryType = "categorical_data"
|
||||
)
|
||||
|
||||
type queryType string
|
||||
@@ -188,6 +189,12 @@ Timestamps will line up evenly on timeStepSeconds (For example, 60 seconds means
|
||||
Name: "Node Graph",
|
||||
})
|
||||
|
||||
p.registerScenario(&Scenario{
|
||||
ID: string(categoricalDataQuery),
|
||||
Name: "Categorical Data",
|
||||
handler: p.handleCategoricalDataScenario,
|
||||
})
|
||||
|
||||
p.queryMux.HandleFunc("", p.handleFallbackScenario)
|
||||
}
|
||||
|
||||
@@ -688,6 +695,27 @@ func (p *testDataPlugin) handleLogsScenario(ctx context.Context, req *backend.Qu
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (p *testDataPlugin) handleCategoricalDataScenario(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error) {
|
||||
resp := backend.NewQueryDataResponse()
|
||||
for _, q := range req.Queries {
|
||||
frame := data.NewFrame(q.RefID,
|
||||
data.NewField("location", nil, []string{}),
|
||||
data.NewField("temperature", nil, []int64{}),
|
||||
data.NewField("humidity", nil, []int64{}),
|
||||
data.NewField("pressure", nil, []int64{}),
|
||||
)
|
||||
|
||||
for i := 0; i < len(houseLocations); i++ {
|
||||
frame.AppendRow(houseLocations[i], rand.Int63n(40+40)-40, rand.Int63n(100), rand.Int63n(1020-900)+900)
|
||||
}
|
||||
respD := resp.Responses[q.RefID]
|
||||
respD.Frames = append(respD.Frames, frame)
|
||||
resp.Responses[q.RefID] = respD
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func randomWalk(query backend.DataQuery, model *simplejson.Json, index int) *data.Frame {
|
||||
timeWalkerMs := query.TimeRange.From.UnixNano() / int64(time.Millisecond)
|
||||
to := query.TimeRange.To.UnixNano() / int64(time.Millisecond)
|
||||
|
||||
Reference in New Issue
Block a user