Configuring Bar Chart Panels
1. Setting Bar Orientation
| Property | Values | Description |
|---|---|---|
| orientation | "horizontal" | "vertical" |
Determines the orientation of the bars in the chart. Defaults to "vertical". |
Example: Configuring Horizontal Bar Chart
{
"panels": [
{
"type": "graph",
"options": {
"orientation": "horizontal"
}
}
]
}
2. Configuring Bar Grouping
| Option | Values | Description |
|---|---|---|
| barGrouping | "stacked", "grouped" |
Determines how bars are grouped in the chart. stacked stacks bars on top of each other, while grouped places them side-by-side. |
| stacking | false, true |
Enables or disables stacking of bars. When enabled, bars are stacked vertically. |
3. Setting Legend Options
| Option | Values | Description |
|---|---|---|
| legend.show | true | false |
Controls whether the legend is displayed. |
| legend.position | "right" | "bottom" |
Determines the position of the legend relative to the chart. |
| legend.calcs | Array of calculation types | Specifies which calculations to display in the legend (e.g., "mean", "max"). |
Example: Configuring Legend Options
{
"legend": {
"show": true,
"position": "right",
"calcs": ["mean", "max"]
}
}
4. Configuring Tooltip Format
| Property | Description | Values | Notes |
|---|---|---|---|
| tooltipMode | Controls how tooltips are displayed | "single", "multi", "none" |
Default: "single" |
| tooltipSort | Sorts tooltip values by | "none", "asc", "desc" |
Applies to multi-tooltip mode |
Note: The tooltip format is configurable in the panel's JSON editor or via the UI under the "Tooltip" section.
5. Setting Color by Series
| Property | Values | Description |
|---|---|---|
| series.color | string |
Defines the color for a specific series. Can be a hex code, named color, or CSS variable. |
| series.colorBy | 'series' or 'value' |
Determines how series are colored. 'series' applies a color per series; 'value' applies color based on value. |
Example: Setting Series Colors
{
"series": [
{
"name": "CPU Usage",
"color": "#ff6384"
},
{
"name": "Memory Usage",
"color": "#36a2eb"
}
]
}
6. Using Value Display
| Property | Description | Values | Notes |
|---|---|---|---|
| valueDisplay | Controls how values are displayed in the bar chart | none, all, first, last |
Default is none |
| valueDisplay.mode | Mode for displaying value labels | auto, always, never |
Use auto to show labels only when space allows |
Note: The
valueDisplay setting affects how numeric values are shown on bars, particularly useful for bar charts where labels help interpret data at a glance.
7. Configuring X-Axis Labels
| Property | Description | Values | Notes |
|---|---|---|---|
| xAxis.labels | Controls display of X-axis labels | true / false |
Default: true |
| xAxis.labelRotation | Rotates X-axis labels | Number in degrees (e.g., -45) |
Use negative values to rotate left |
| xAxis.labelFormat | Formats X-axis labels | time, number, string |
Applies to numeric and time series data |
| xAxis.labelWidth | Width of X-axis labels in pixels | Number (e.g., 100) |
Useful for preventing label overflow |
8. Setting Bar Width
| Property | Values | Description |
|---|---|---|
| barWidth | 0.0 - 1.0 |
Controls the width of bars as a fraction of the available space. Default is 0.6. |
Example: Configuring Bar Width in JSON
{
"panels": [
{
"id": 1,
"type": "graph",
"barWidth": 0.4
}
]
}
9. Using Gradient Mode
| Property | Values | Description |
|---|---|---|
| gradientMode | "none" | "opacity" |
Defines how the gradient is applied to the bar chart. "none" uses solid color, "opacity" applies a gradient based on bar height. |
Note: The
gradientMode property is supported in Grafana v9.0 and later.
10. Configuring Group Width
| Property | Description | Values | Notes |
|---|---|---|---|
| groupWidth | Controls the width of each group in the bar chart | 0.5, 1.0, 1.5 |
Default is 1.0. Values less than 1.0 compress the bars, values greater than 1.0 expand them |