Bullet chart
Compare measures against targets using the BulletChart component.
A bullet chart is a variation of a bar chart that displays performance of a measure (primary measure) and its progress towards a goal (target measure). Optionally, the primary measure can also be compared to another measure (comparative measure). Use it to track results against a goal, for example, actual sales against the sales target.

Buckets
| Prop | Required | Takes | What it does |
|---|---|---|---|
primaryMeasure | Yes | One measure | Draws the primary bar. |
targetMeasure | No | One measure | Draws the target value as a thick line to reach. Empty target values aren’t drawn. |
comparativeMeasure | No | One measure | Draws a secondary bar to compare the primary measure against. |
viewBy | No | One or two attributes | Draws one bullet per attribute value along the Y axis. With two attributes, the values of the second attribute are grouped under each value of the first. Extra attributes are ignored. |
filters | No | Filters | Limits the data the bullet chart shows. |
Sorting
BulletChart applies no default sorting. To sort the data, pass sort items in the sortBy prop. 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 measures. See Colors. |
legend | Whether the legend shows and where. |
xaxis, yaxis | Visibility, labels, rotation, and name of the axes. xaxis is the horizontal value axis, where min and max set the scale. yaxis is the vertical axis with the viewBy values. |
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 bars 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. |
Colors
To appropriately visualize the displayed data, bullet charts use colors provided by a color array or a palette in the config in the following way:
- For the primary measure, the first color from the color array/palette is used.
- For the target measure, a darker shade of the first color is used.
- For the comparative measure, gray is used.
To override the default coloring scheme and set a custom color for each measure, use color mapping.
Limits
- A bullet chart renders up to 10,000 bullets. With more, the chart shows an error and
onErrorreceives aDataTooLargeToDisplaySdkError. Filter the data to fit. BulletChartdoesn’t show measures in % (computeRatio). It turnscomputeRatiooff on all three measures.
Structure
import "@gooddata/sdk-ui-charts/styles/css/main.css";
import { BulletChart } from "@gooddata/sdk-ui-charts";
<BulletChart
primaryMeasure={<primaryMeasure>}
targetMeasure={<targetMeasure>}
comparativeMeasure={<comparativeMeasure>}
config={<chart-config>}
…
/>
Example
import "@gooddata/sdk-ui-charts/styles/css/main.css";
import { BulletChart } from "@gooddata/sdk-ui-charts";
import * as Md from "./catalog.js";
const style = { height: 300 };
<div style={style}>
<BulletChart
primaryMeasure={Md.$FranchiseFeesAdRoyalty}
targetMeasure={Md.$FranchiseFees}
comparativeMeasure={Md.$FranchiseFeesOngoingRoyalty}
viewBy={Md.LocationResort}
/>
</div>
Props
| Prop | Type | Required | Description | Inherited from |
|---|---|---|---|---|
primaryMeasure | AttributeMeasureOrPlaceholder | Yes | Specify primary measure. This will be charted as the primary bar. | IBulletChartBucketProps |
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 |
comparativeMeasure | AttributeMeasureOrPlaceholder | No | Specify measure to use for comparison. This will be charted as the secondary bar. | IBulletChartBucketProps |
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 | NullableFiltersOrPlaceholders | No | Specify filters to apply on the data to chart. | IBulletChartBucketProps |
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. | IBulletChartBucketProps |
sortBy | SortsOrPlaceholders | No | Specify how to sort the data to chart. | IBulletChartBucketProps |
targetMeasure | AttributeMeasureOrPlaceholder | No | Specify measure which contains the target/goal value. The value will be charted as the thick line to reach. | IBulletChartBucketProps |
viewBy | AttributeOrPlaceholder | AttributesOrPlaceholders | No | Specify one or two attributes to use for slicing the measures. | IBulletChartBucketProps |
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.
Display a single KPI value or comparison with the Headline 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.