Skip to content

Bar chart

Shows the differences or similarities between values. Bar chart data answers the question of "how many?" in each category.

Usage

Use it to perform a comparison of values across different subgroups of data. From a bar chart, it can be seen which groups are highest or most common, and how groups compare against each other.

Basic variant

The basic bar chart shows numerical comparisons across categories. One axis of the chart shows the specific categories being compared and the other axis is numeric in nature.

Basic bar chart

Multi-set variant

This variation is used when two or more data series are plotted side-by-side and grouped together under categories, all on the same axis.

Multi-set bar chart

Stacked variant

The stacked bar chart is used to show how a category is divided. It helps to understand what relationship each part has with the total amount.

Stacked bar chart

Best practices

  • Plot the bars against a zero-value baseline to accurately reflect the difference in the data.
  • Use colors with purpose. Select accent colors to highlight meaningful changes.
  • Bar charts can be vertical or horizontal. Horizontal bar charts work best when there are lots of different categories with long labels.
  • Use common sense and adjust the width of the bars according to the amount of elements. The minimum bar width is 16px.

Design

bar chart elements

  1. Bars, 2. Y axis, 3.Legend, 4.Grid lines, 5. X axis

Code

Usage

Required Packages
import { SiChartCartesianComponent } from '@siemens/charts-ng/cartesian';

@Component({
  imports: [SiChartCartesianComponent, ...]
})

Simple bar chart

Stacked bar chart

The same component can also be used in a stacked configuration.

SiChartCartesianComponent API Documentation

Source
import { SiChartCartesianComponent } from '@siemens/charts-ng/cartesian';

Input Properties

NameTypeDefaultDescription
additionalOptionsinherited
EChartOption | undefined

Used to override specific properties set in options.

Inherited from SiChartBaseComponent

autoZoomSeriesIndexinherited
number -1

No auto dataZoom update) by default. Use together with visibleEntries.

Inherited from SiChartBaseComponent

axisPointerinherited
string | boolean | undefined false

Used to display axisPointer line either by click or mouse-move.

Inherited from SiChartBaseComponent

customLegendActioninherited
boolean | undefined

Enable custom legend click actions exposed by the selectionChanged event.

Inherited from SiChartBaseComponent

dataZoomFilterModeinherited
FilterMode 'none'

The data zoom filter mode. (see https://echarts.apache.org/en/option.html#dataZoom-inside.filterMode)

The value 'filter' will cause the lines to be disconnected to the outside of the chart.

Inherited from SiChartBaseComponent

dataZoomMaxValueSpaninherited
number | undefined

The upper limit of the data zoom slider (see https://echarts.apache.org/en/option.html#dataZoom-slider.maxValueSpan).

Inherited from SiChartBaseComponent

dataZoomMinValueSpaninherited
number | undefined

The lower limit of the data zoom slider (see https://echarts.apache.org/en/option.html#dataZoom-slider.minValueSpan).

Inherited from SiChartBaseComponent

dataZoomRangeinherited
DataZoomRange | undefined

Apply a specific zoom range (see https://echarts.apache.org/en/option.html#dataZoom-inside).

Inherited from SiChartBaseComponent

eChartContainerHeightinherited
string | null | undefined

The height of the ECharts container as decimal.

Inherited from SiChartBaseComponent

externalXAxisFormatterinherited
((value: any, visibleRange: number) => string) | undefined

External XAxis Formatter from consumer

Inherited from SiChartBaseComponent

externalZoomSliderinherited
boolean false

Flag to use external zoom slider

Inherited from SiChartBaseComponent

maxEntriesinherited
number 1000

Maximum number of series data points shown in the chart.

Inherited from SiChartBaseComponent

optionsinherited
EChartOption | undefined

See [ECharts 5.x Documentation]https://echarts.apache.org/en/option.html for all available options.

Inherited from SiChartBaseComponent

paletteinherited
string | undefined undefined

The name of the color palette (if any) of the loaded theme.

Inherited from SiChartBaseComponent

rendererinherited
"canvas" | "svg" 'canvas'

the renderer to use: canvas or svg

Inherited from SiChartBaseComponent

selectedIteminherited
SelectedLegendItem { legendItemName: '' }

Specify selected legend item.

Inherited from SiChartBaseComponent

series
CartesianChartSeries[] | undefined

The series for the chart.

showCustomLegendinherited
boolean false

Enable to show a custom legend. The custom legend offers additional features such as, scroll bar to avoid legend and chart overlapping, Left and right alignment of legends based on y-axis, etc and many more.

Inherited from SiChartBaseComponent

showLegendinherited
boolean true

Show Echarts legend

Inherited from SiChartBaseComponent

showTimeRangeBarinheriteddeprecated
boolean false

If true, add consumer-provided time range bar. Use together with zoomSlider.

Deprecated: The input will be removed in future versions as the time range bar slot is deprecated.

Inherited from SiChartBaseComponent

stacked
boolean false

Used to display the chart as a stacked one.

subChartGrids
SubchartGrid[] | undefined

Grid definitions for rendering series in subcharts.

subTitleinherited
string | undefined

The subtitle of the chart.

Inherited from SiChartBaseComponent

themeinherited
any

The desired theme to load.

Inherited from SiChartBaseComponent

themeCustomizationinherited
any

Used to override specific options of loaded theme.

Inherited from SiChartBaseComponent

titleinherited
string | undefined

The title of the chart.

Inherited from SiChartBaseComponent

tooltipFormatter
string | TooltipComponentFormatterCallback<TooltipComponentFormatterCallbackParams> | undefined

The content formatter of the tooltip's floating layer, supporting string templates and callbacks. Custom formatters are responsible for escaping untrusted values with echarts.format.encodeHTML before inserting them into HTML. Built-in formatters display names and values as plain text. See https://echarts.apache.org/en/option.html#tooltip.formatter.

visibleEntriesinherited
number -1

No auto dataZoom update) by default. Use together with autoZoomSeriesIndex.

Inherited from SiChartBaseComponent

visibleRangeinherited
number -1

No auto dataZoom update) by default. Use together with autoZoomSeriesIndex.

Inherited from SiChartBaseComponent

xAxis
ChartXAxis | ChartXAxis[] | undefined

The x axis in cartesian(rectangular) coordinate.

yAxis
ChartYAxis | ChartYAxis[] | undefined

The y axis in cartesian(rectangular) coordinate.

zoomInsideinherited
boolean false

Enables zooming inside the chart with the mouse wheel/touch.

Whether zooming inside the chart is possible with mouse.

Inherited from SiChartBaseComponent

zoomMode
boolean | undefined

Whether brush zoom mode is enabled.

zoomSliderinherited
boolean false

Enables the zoom slider below the chart.

Inherited from SiChartBaseComponent

zoomSliderBrushinherited
boolean true

enable brush mode for zoom slider

Inherited from SiChartBaseComponent

zoomSliderRealtimeinherited
boolean true

realtime update mode for zoom slider

Inherited from SiChartBaseComponent

zoomSliderShadowinherited
boolean true

Shows data shadow in dataZoom slider, use together with zoomSlider.

Inherited from SiChartBaseComponent

Output Properties

NameTypeDescription
chartGridResizedinherited
GridRectCoordinate

Event emitted when chart grid is resized.

Inherited from SiChartBaseComponent

chartSeriesClickinherited
LegendItem

Event emitted when a chart series is clicked.

Inherited from SiChartBaseComponent

customLegendMultiLineInfoEventinherited
CustomLegendMultiLineInfo[]

Event emitted when custom legend multi-line info changes.

Inherited from SiChartBaseComponent

dataZoominherited
DataZoomEvent

Event emitted when data zoom changes.

Inherited from SiChartBaseComponent

pointerinherited
AxisPointerEvent

Event emitted when axis pointer moves.

Inherited from SiChartBaseComponent

selectionChangedinherited
any

Event emitted when selection changes e.g. clicking on a legend item.

Inherited from SiChartBaseComponent

showLegendChangeinherited
boolean

Show Echarts legend

Inherited from SiChartBaseComponent

timeRangeChangeinherited
number

Emitted when data zoom changes, indicating the time range in milliseconds, 0 for full range

Inherited from SiChartBaseComponent

visibleEntriesChangeinherited
number

No auto dataZoom update) by default. Use together with autoZoomSeriesIndex.

Inherited from SiChartBaseComponent

visibleRangeChangeinherited
number

No auto dataZoom update) by default. Use together with autoZoomSeriesIndex.

Inherited from SiChartBaseComponent

Attributes and Methods

NameTypeDescription
startProgressIndication()inherited
() => void

Show loading indicator.

Inherited from SiChartBaseComponent

stopProgressIndication()inherited
() => void

Hide loading indicator.

Inherited from SiChartBaseComponent

Types Documentation

Properties
Index Signatures
Properties
Index Signatures

FilterMode

'none' | 'filter' | 'weakFilter' | 'empty'
type alias
Properties
  • If enable animation

    animation?: boolean

    inherited
  • Delay of initialize animation Can be a callback to specify duration of each element

    animationDelay?: number | AnimationDelayCallback

    inherited
  • Delay of data update animation. Can be a callback to specify duration of each element

    animationDelayUpdate?: number | AnimationDelayCallback

    inherited
  • Duration of initialize animation. Can be a callback to specify duration of each element

    animationDuration?: number | AnimationDurationCallback

    inherited
  • Delay of data update animation. Can be a callback to specify duration of each element

    animationDurationUpdate?: number | AnimationDurationCallback

    inherited
  • Easing of initialize animation

    animationEasing?: ("linear" | "quadraticIn" | "quadraticOut" | "quadraticInOut" | "cubicIn" | "cubicOut" | "cubicInOut" | "quarticIn" | "quarticOut" | "quarticInOut" | "quinticIn" | "quinticOut" | "quinticInOut" | "sinusoidalIn" | "sinusoidalOut" | "sinusoidalInOut" | "exponentialIn" | "exponentialOut" | "exponentialInOut" | "circularIn" | "circularOut" | "circularInOut" | "elasticIn" | "elasticOut" | "elasticInOut" | "backIn" | "backOut" | "backInOut" | "bounceIn" | "bounceOut" | "bounceInOut" | ((percent: number) => number))

    inherited
  • Easing of data update animation.

    animationEasingUpdate?: ("linear" | "quadraticIn" | "quadraticOut" | "quadraticInOut" | "cubicIn" | "cubicOut" | "cubicInOut" | "quarticIn" | "quarticOut" | "quarticInOut" | "quinticIn" | "quinticOut" | "quinticInOut" | "sinusoidalIn" | "sinusoidalOut" | "sinusoidalInOut" | "exponentialIn" | "exponentialOut" | "exponentialInOut" | "circularIn" | "circularOut" | "circularInOut" | "elasticIn" | "elasticOut" | "elasticInOut" | "backIn" | "backOut" | "backInOut" | "bounceIn" | "bounceOut" | "bounceInOut" | ((percent: number) => number))

    inherited
  • Disable animation when the number of elements exceeds the threshold

    animationThreshold?: number

    inherited
  • area?: boolean

  • areaStyle?: (AreaStyleOption<Color> & { origin?: "auto" | "start" | "end" | number; })

    inherited
  • blendMode?: string

    inherited
  • Blur states.

    blur?: (LineStateOption<DefaultLabelFormatterCallbackParams> & { lineStyle?: LineStyleOption<Color>; areaStyle?: AreaStyleOption<Color>; })

    inherited
  • clip?: boolean

    inherited
  • color?: Color | Color[]

    inherited
  • colorBy?: ("data" | "series")

    inherited
  • colorLayer?: Color[][]

    inherited
  • connectNulls?: boolean

    inherited
  • coord?: (Date | (string | number)) | (null | undefined) | ((Date | (string | number)) | (null | undefined))[] | ((Date | (string | number)) | (null | undefined) | (Date | (string | number))[])[]

    inherited
  • coordinateSystem?: "cartesian2d" | "polar"

    inherited
  • coordinateSystemUsage?: ("data" | "box")

    inherited
  • Cursor when mouse on the elements

    cursor?: string

    inherited
  • customLegendToolTip?: string Inherited from SiSeriesOption

  • data?: (((string | number | Date | null | undefined) | (string | number | Date | null | undefined)[]) | LineDataItemOption)[]

    inherited
  • groupId of data. can be used for doing drilldown / up animation It will be ignored if:

    • groupId is specified in each data

    • encode.itemGroupId is given.

    dataGroupId?: (string | number)

    inherited
  • datasetId?: string | number

    inherited
  • datasetIndex?: number

    inherited
  • dimensions?: (string | { type?: "number" | "time" | "float" | "int" | "ordinal"; name?: string; displayName?: string; } | undefined)[]

    inherited
  • displayName?: string Inherited from SiSeriesOption

  • Emphasis states

    emphasis?: (LineStateOption<DefaultLabelFormatterCallbackParams> & { focus?: "none" | "series" | "self"; scale?: boolean | number; } & { lineStyle?: Omit<LineStyleOption<Color>, "width"> & { width?: (number | undefined) | "bolder"; }; areaStyle?: AreaStyleOption<Color>; } & { blurScope?: "coordinateSystem" | "series" | "global"; disabled?: boolean; })

    inherited
  • encode?: OptionEncode

    inherited
  • endLabel?: LineEndLabelOption

    inherited
  • hoverLayerThreshold?: number

    inherited
  • id?: (string | number)

    inherited
  • itemStyle?: ItemStyleOption<DefaultLabelFormatterCallbackParams>

    inherited
  • label?: SeriesLabelOption<DefaultLabelFormatterCallbackParams, { positionExtra: never; }>

    inherited
  • Overall label layout option in label layout stage.

    labelLayout?: LabelLayoutOption | LabelLayoutOptionCallback

    inherited
  • labelLine?: LabelLineOption

    inherited
  • lineStyle?: LineStyleOption<Color>

    inherited
  • mainType?: "series"

    inherited
  • markArea?: MarkAreaComponentOption

    inherited
  • markLine?: MarkLineComponentOption

    inherited
  • markPoint?: MarkPointComponentOption

    inherited
  • name?: (string | number)

    inherited
  • polarId?: (string | number)

    inherited
  • polarIndex?: number

    inherited
  • Configurations about progressive rendering

    progressive?: number | false

    inherited
  • progressiveChunkMode?: "mod"

    inherited
  • progressiveThreshold?: number

    inherited
  • sampling?: "none" | "average" | "min" | "max" | "minmax" | "sum" | "lttb" | ((frame: ArrayLike<number>) => number)

    inherited
  • Select states

    select?: (LineStateOption<DefaultLabelFormatterCallbackParams> & { disabled?: boolean; })

    inherited
  • Map of selected data key is name or index of data.

    selectedMap?: { [key: string]: boolean; } | "all"

    inherited
  • selectedMode?: boolean | "series" | "single" | "multiple"

    inherited
  • When dataset is used, seriesLayoutBy specifies whether the column or the row of dataset is mapped to the series namely, the series is "layout" on columns or rows

    seriesLayoutBy?: "column" | "row" = 'column'

    inherited
  • showAllSymbol?: boolean | "auto"

    inherited
  • showSymbol?: boolean

    inherited
  • silent?: boolean

    inherited
  • smooth?: number | boolean

    inherited
  • smoothMonotone?: "none" | "x" | "y"

    inherited
  • sourceHeader?: (number | boolean | "auto")

    inherited
  • stack?: string

    inherited
  • stackOrder?: "seriesAsc" | "seriesDesc"

    inherited
  • stackStrategy?: "all" | "samesign" | "positive" | "negative"

    inherited
  • Animation config for state transition.

    stateAnimation?: AnimationOption$1

    inherited
  • step?: false | "start" | "end" | "middle"

    inherited
  • type of symbol, like cirlce, rect, or custom path and image.

    symbol?: string | ((rawValue: any, params: DefaultLabelFormatterCallbackParams) => string)

    inherited
  • symbolKeepAspect?: boolean

    inherited
  • symbolOffset?: string | number | (string | number)[] | ((rawValue: any, params: DefaultLabelFormatterCallbackParams) => string | number | (string | number)[])

    inherited
  • symbolRotate?: number | ((rawValue: any, params: DefaultLabelFormatterCallbackParams) => number)

    inherited
  • Size of symbol.

    symbolSize?: number | number[] | ((rawValue: any, params: DefaultLabelFormatterCallbackParams) => number | number[])

    inherited
  • tooltip?: (CommonTooltipOption<DefaultLabelFormatterCallbackParams> & { trigger?: "item" | "axis" | boolean | "none"; })

    inherited
  • Whether to trigger event when hovering on the line or the area

    @since: v6.0.1

    triggerEvent?: boolean | "line" | "area"

    inherited
  • Deprecated: This option has been deprecated since v6.0.1. Use triggerEvent: 'line' for only line event or triggerEvent: true for both line and area event.

    triggerLineEvent?: boolean

    inheriteddeprecated
  • type?: "line"

    inherited
  • If enabled universal transition cross series.

    Example:

    universalTransition: true
     universalTransition: { enabled: true }
    

    universalTransition?: boolean | UniversalTransitionOption

    inherited
  • visible?: boolean Inherited from SiSeriesOption

  • xAxisId?: (string | number)

    inherited
  • xAxisIndex?: number

    inherited
  • yAxisId?: (string | number)

    inherited
  • yAxisIndex?: number

    inherited
  • z?: number

    inherited
  • zlevel?: number

    inherited

YAxisPosition

'left' | 'right'
type alias

AxisType

'value' | 'category' | 'time' | 'log'
type alias

XAxisPosition

'top' | 'bottom'
type alias
Properties
Properties
Properties
Properties

Except where otherwise noted, content on this site is licensed under MIT License.