Learn about the BarChart component for use in UI extensions.
BarChart
component renders a bar chart for visualizing data. This type of chart is best suited for comparing categorical data. Alternatively, you can use a LineChart component for time series plots or visualizing trend data. Learn more about charts.
To see an example of how to implement charts in a UI extension, check out HubSpot’s Charts example project.
Parameter | Type | Description |
---|---|---|
data | Object | An object containing the chart’s data in an array.
|
axes | Object | Configures the chart’s axes. Using the x and y fields, you’ll configure each axis individually with field and fieldType parameters, along with an optional label parameter:
options field to further configure the axes with the following options:
|
options | Object | Additional chart configuration options. Options include:
|
groupFieldByColor
parameter within the axes options
. For example, the bar chart below use groupFieldByColor
to add colors to each Product
defined in the dataset.
groupFieldByColor
configured for the axes:
colorList
field in the options
prop, then specify the colors to pick from as shown below.
groupFieldByColor
. To do so, include the colors
field within the axes options
, then specify each field value and color, as shown below. Learn more about colors.
stacking
has been set to true
to visually combine the data into one bar.
dealstage
field data is not written in a human-readable format (e.g., appointmentScheduled
), the data prop includes propertyLabels
in its options
to convert the labels. Note that the data prop formatting is slightly different to accommodate both the dataset and its options
. Learn more about data options.