BarChart: Gradient Mode for Auto Max (#74122)

* BarChart: Gradient Mode for Auto Max

* add gdev panel

* clean

---------

Co-authored-by: Leon Sorokin <leeoniya@gmail.com>
This commit is contained in:
Drew Slobodnjak 2023-10-10 11:14:56 -07:00 committed by GitHub
parent 2a6c16d969
commit 5604305271
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 92 additions and 5 deletions

View File

@ -1121,6 +1121,93 @@
"title": "Hue",
"type": "barchart"
},
{
"datasource": {
"type": "testdata",
"uid": "PD8C576611E62080A"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "continuous-GrYlRd"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"fillOpacity": 100,
"gradientMode": "scheme",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineWidth": 0,
"scaleDistribution": {
"type": "linear"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green"
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 9,
"w": 5,
"x": 10,
"y": 18
},
"id": 15,
"options": {
"barRadius": 0,
"barWidth": 0.97,
"groupWidth": 0.7,
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"orientation": "auto",
"showValue": "auto",
"stacking": "none",
"tooltip": {
"mode": "single",
"sort": "none"
},
"xTickLabelRotation": 0,
"xTickLabelSpacing": 0
},
"targets": [
{
"csvContent": "label,value\nx,3\na,10\nb,20\nc,30",
"datasource": {
"type": "testdata",
"uid": "PD8C576611E62080A"
},
"refId": "A",
"scenarioId": "csv_content"
}
],
"title": "Green-Yellow-Red",
"type": "barchart"
},
{
"datasource": {
"type": "testdata",
@ -1239,7 +1326,7 @@
"type": "barchart"
}
],
"schemaVersion": 37,
"schemaVersion": 38,
"tags": [
"gdev",
"panel-tests",
@ -1257,6 +1344,6 @@
"timezone": "",
"title": "BarChart - Thresholds & Mappings",
"uid": "2I2uMSB7z",
"version": 32,
"version": 7,
"weekStart": ""
}
}

View File

@ -236,8 +236,8 @@ export const preparePlotConfigBuilder: UPlotConfigPrepFn<BarChartOptionsEX> = ({
thresholds: field.config.thresholds,
hardMin: field.config.min,
hardMax: field.config.max,
softMin,
softMax,
softMin: customConfig.axisSoftMin,
softMax: customConfig.axisSoftMax,
// The following properties are not used in the uPlot config, but are utilized as transport for legend config
// PlotLegend currently gets unfiltered DataFrame[], so index must be into that field array, not the prepped frame's which we're iterating here