Column chart
Display vertical bar comparisons with the ColumnChart component.
A column chart shows data in vertical columns. Column charts can display one or multiple measures side by side, divided by either attribute values or by a single measure stacked by attribute values. Use it to compare values across categories or over time, for example, revenue by month.

Buckets
| Prop | Required | Takes | What it does |
|---|---|---|---|
measures | Yes | One or more measures | Sets the height of the columns, one column per measure. |
viewBy | No | One or two attributes | Slices the measures by the attribute values along the X axis. With two attributes, the values of the second attribute are grouped under each value of the first. Extra attributes are ignored. |
stackBy | No | One attribute | Splits each column into segments, one per attribute value. Works only with a single measure. |
filters | No | Filters | Limits the data the column chart shows. |
Sorting
ColumnChart applies no default sorting. To sort the data, pass sort items in the sortBy prop. To sort stacked columns by their totals, use an attribute area sort (newAttributeAreaSort) on the viewBy attribute. See Sort items.
Configuration
Pass these options in the config prop. See Chart configuration for details.
| Option | What it changes |
|---|---|
colors, colorPalette, colorMapping | Colors of the columns: one per measure, or one per stackBy value. |
legend | Whether the legend shows and where. |
dataLabels | visible shows or hides the labels. totalsVisible shows or hides the totals of stacked columns. style: "backplate" adds a background behind the labels. |
stackMeasures, stackMeasuresToPercent | stackMeasures stacks the measures into one column. stackMeasuresToPercent stacks the measures, or the stackBy segments, to 100% and overrides stackMeasures. |
xaxis, yaxis | Visibility, labels, rotation, and name of the axes. yaxis.min and yaxis.max set the scale of the value axis. |
secondary_yaxis | Shows the measures listed in measures (local identifiers) on a secondary axis on the right. Takes the same options as yaxis. |
enableJoinedAttributeAxisName | With two viewBy attributes, their axis has no name by default. This option shows the attribute names joined by › as the name. |
grid | enabled shows or hides the grid lines. |
chartFill | type sets how columns are filled: "solid", "pattern", or "outline". |
separators | Thousands and decimal separators in the number format. |
zoomInsight | Lets users zoom and pan along the axis with the viewBy values. |
enableCompactSize | Hides axis labels and names when the chart is too small for them. Has no effect when zoomInsight is on. |
Limits
- A column chart renders up to 6,000 data points, counted as the number of
viewByvalues times the number of series (measures orstackByvalues), including empty combinations. With more, the chart shows an error andonErrorreceives aDataTooLargeToDisplaySdkError. Filter the data to fit. - A stacked column chart renders up to 1,000 series:
stackByvalues, or measures stacked withstackMeasuresorstackMeasuresToPercent. With more, the chart shows the same error. - A measure shown in % (
computeRatio) works only when it’s the only measure. With two or more measures, the chart turnscomputeRatiooff on all of them. See Show a measure as a percentage.
Structure
import "@gooddata/sdk-ui-charts/styles/css/main.css";
import { ColumnChart } from "@gooddata/sdk-ui-charts";
<ColumnChart
measures={<measures>}
config={<chart-config>}
…
/>
Example
import "@gooddata/sdk-ui-charts/styles/css/main.css";
import { ColumnChart } from "@gooddata/sdk-ui-charts";
import * as Md from "./catalog.js";
const style = { height: 300 };
<div style={style}>
<ColumnChart
measures={[Md.$TotalSales]}
viewBy={Md.DateMonth.Short}
/>
</div>
Props
| Prop | Type | Required | Description | Inherited from |
|---|---|---|---|---|
measures | AttributesMeasuresOrPlaceholders | Yes | Specify one or more measures to display on the column chart. | IColumnChartBucketProps |
backend | IAnalyticalBackend | No | Analytical backend, from which the chart will obtain data to visualize If you do not specify instance of analytical backend using this prop, then you MUST have BackendProvider up in the component tree. | IBucketChartProps |
config | IChartConfig | No | Configure chart’s behavior and appearance. | ICommonChartProps |
drillableItems | ExplicitDrill[] | No | Configure drillability; e.g. which parts of the visualization can be interacted with. | IVisualizationProps |
ErrorComponent | ComponentType<IErrorProps> | No | React component to display in the event when there is an error with either obtaining the data from backend or with the data itself. | IVisualizationProps |
execConfig | IExecutionConfig | No | Execution configuration, will provide the execution with necessary config before initiating execution. | ICommonChartProps |
exportTitle | string | No | Set title to use for exported files. | IVisualizationProps |
filters | FiltersOrPlaceholders | No | Specify filters to apply on the data to chart. | IColumnChartBucketProps |
height | number | No | Set height of the chart (in pixels). | ICommonChartProps |
LoadingComponent | ComponentType<ILoadingProps> | No | React component to display while loading data from the backend. | IVisualizationProps |
locale | string | No | Set Locale for visualization localization. | IVisualizationProps |
onDataView | OnDataView | No | (Alpha) Called when the visualization loads a DataView, i.e. it receives data from the backend. | IVisualizationCallbacks |
onDrill | OnFiredDrillEvent | No | Called when user triggers a drill on a visualization. | IVisualizationCallbacks |
onError | OnError | No | Called when an error occurs while loading data for the visualization. | IVisualizationCallbacks |
onExportReady | OnExportReady | No | Called when the visualization is ready to be exported. | IVisualizationCallbacks |
onLegendReady | OnLegendReady | No | Called when legend is rendered. | IChartCallbacks |
onLoadingChanged | OnLoadingChanged | No | Called when loading status of the visualization changes - vis starts or stops loading | IVisualizationCallbacks |
placeholdersResolutionContext | any | No | Resolution context for composed placeholders. | IColumnChartBucketProps |
sortBy | SortsOrPlaceholders | No | Specify how to sort the data to chart. | IColumnChartBucketProps |
stackBy | AttributeOrPlaceholder | No | Specify attribute to stack the bars by. | IColumnChartBucketProps |
viewBy | AttributeOrPlaceholder | AttributesOrPlaceholders | No | Specify one or two attributes to slice the measures along the X axis. | IColumnChartBucketProps |
width | number | No | Set width of the chart (in pixels). | ICommonChartProps |
workspace | string | No | Identifier of analytical workspace, from which the chart will obtain data to visualize. If you do not specify workspace identifier, then you MUST have WorkspaceProvider up in the component tree. | IBucketChartProps |
Related
Display horizontal bar comparisons with the BarChart component.
Combine bars and lines in a single visualization with the ComboChart component.
Display data trends as connected points with the LineChart component.
Configure chart appearance, axes, legends, colors, and data labels.
Shared behavior of GoodData.UI visual components — responsive sizing, the style and data props model, and the visualization lifecycle callbacks.