Column.

COMMUNITY

Compare category values with vertical bars.

Live preview27 feature examples

LIVE EXAMPLE

Monthly revenue

Match the page theme
Interact with the chart to see selection and range-change results here.
OptionsChanges are reflected in the preview and code.
Appearance and style9
Axes and grid lines11
Legend and interaction15
Title and dimensions3

Compare two channels side by side over the same period. All values are sample data.

View code
Current preview
<div id="chart-container" style="width: 100%; min-width: 0;"></div>

<script type="module">
  import { defineCustomElement as define0 } from '@syidax/advanced/components/sy-column-chart.js';
  define0();

  const specs = [
    {
      "id": "example-chart",
      "tag": "sy-column-chart",
      "props": {
        "engine": "standard",
        "series": [
          {
            "name": "Online",
            "values": [24, 29, 27, 38, 43, 40],
            "color": "#8263d9"
          },
          {
            "name": "Store",
            "values": [15, 19, 17, 24, 22, 29],
            "color": "#239c91"
          }
        ],
        "xAxis": {
          "kind": "category",
          "categories": ["Jan", "Feb", "Mar", "Apr", "May", "Jun"]
        },
        "yAxis": {
          "kind": "linear",
          "min": 0
        },
        "legend": true,
        "width": 640,
        "height": 360,
        "brandPosition": "bottom-right",
        "brandLogo": ""
      }
    }
  ];
  const container = document.querySelector('#chart-container');
  const elements = specs.map(({ tag, id, props }) => {
    const element = document.createElement(tag);
    element.id = id;
    Object.assign(element, props);
    element.setAttribute('aria-label', 'column example chart');
    return element;
  });
  container.replaceChildren(...elements);
  const chart = elements.at(-1);
  const onEvent = event => {
    console.log('pointClick', event.detail);
  };
  chart.addEventListener('pointClick', onEvent);
  const observer = new ResizeObserver(([entry]) => {
    const width = Math.max(160, Math.floor(entry.contentRect.width));
    elements.forEach(element => { element.width = width; });
  });
  observer.observe(container);

  // In an SPA, call this function when the view is disposed.
  function disposeChart() {
    observer.disconnect();
    chart.removeEventListener('pointClick', onEvent);
    container.replaceChildren();
  }
</script>

Usage and data

#

Suitable for a small number of categories, such as monthly results or product quantities.

Bar lengths are most naturally compared from zero. Consider Bar when there are many categories.

Data contract

PropertyInput format
seriesNames, values, and colors for each group.
valuesUse a number array for a single series.
xAxiscategories determines the bar order.

Updating data

Assign a new array or object to the property instead of mutating values inside an array. Chart events provide selection results through event.detail. When disposing of the view, clean up ResizeObserver and event listeners registered by your app.

Feature examples

#

Try 27 interactive feature examples and inspect their code. Select “Edit in preview” to combine more options in the settings panel above.

Stacked bars

Stack series to see each category's total and composition.

Interact with the chart to see results here.
View code

100% stacked

Normalize each category to 100% to compare series proportions.

Interact with the chart to see results here.
View code

Bar outlines and corners

Adjust bar shapes with rounded corners and outlines.

Interact with the chart to see results here.
View code

Right-side legend

Place the legend on the right. Click items to hide or show series.

Interact with the chart to see results here.
View code

Inspect values with the pointer

Point to data to view the value at that location.

Interact with the chart to see results here.
View code

Crosshair tracking

Move the pointer to read horizontal and vertical coordinates alongside values.

Interact with the chart to see results here.
View code

Drag to zoom and pan

Drag to zoom and hold Shift to pan. Use Ctrl + wheel to zoom in or out.

Interact with the chart to see results here.
View code

Replay animation

Redraw the same example to inspect its initial display animation.

Interact with the chart to see results here.
View code

Animation

Compare 1 examples of Animation. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

Axis

Compare 10 examples of Axis. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

Border

Compare 7 examples of Border. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

Crosshair

Compare 5 examples of Crosshair. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

Engine Compare

Compare 2 examples of Engine Compare. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

Legend

Compare 2 examples of Legend. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

Null Values

Compare 1 examples of Null Values. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

Large datasets

Compare 1 examples of Large datasets. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

Highlight state

Compare 5 examples of Highlight state. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

Series

Compare 13 examples of Series. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

Stacking

Compare 5 examples of Stacking. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

Tooltip

Compare 12 examples of Tooltip. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

Zoom and pan

Compare 6 examples of Zoom and pan. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

Context menu

Compare 1 examples of Context menu. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

Data context menu

Compare 1 examples of Data context menu. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

Overview

Compare 1 examples of Overview. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

Streaming · Live updatesPRO

Select Start to add one data point at a time. The latest 40 items are shown, with controls for update speed, pause, and reset.

Interact with the chart to see results here.
View code

Streaming · Add batchesPRO

Select Start to add four data points at a time. The latest 40 items are shown, with controls for update speed, pause, and reset.

Interact with the chart to see results here.
View code

Streaming · Add and update live dataPRO

Compare 2 examples of Add and update live data. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

API reference

#

The full public API for sy-column-chart. Pass objects and arrays as JavaScript properties. Select a name to view usage code and type definitions.

Key properties

Attribute / PropertyType / DefaultDescription
ColumnChartSeries[]Default: undefinedNames, values, and colors for each group.
ColumnChartValuesDefault: new Float32Array(0)Use a number array for a single series.
numberDefault: 600Chart width in pixels. Update with ResizeObserver when the container changes.
numberDefault: 300Chart height in pixels.
brandLogostringDefault: undefinedThe default is the Syidax logo. With the Pro chart.branding entitlement, use none or a PNG, JPEG, or WebP data URL.
brandPosition'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'Default: 'bottom-right'The corner where the logo is anchored. Applies equally to Community and Pro, on screen and in image exports.
barPaddingnumberDefault: 0.1Set as an HTML attribute or JavaScript property. type: number.
seriesPaddingnumberDefault: 0.1Set as an HTML attribute or JavaScript property. type: number.
CartesianSeriesStackingModeDefault: undefinedAllowed values: normal, percent. Default: undefined.
borderRadiusCartesianSeriesCornerRadiusValueDefault: undefinedPass as a JavaScript property. type: CartesianSeriesCornerRadiusValue.
borderScopeColumnBorderScopeDefault: 'stack'Allowed values: point, stack, outline. Default: 'stack'.
borderColorstringDefault: undefinedSet as an HTML attribute or JavaScript property. type: string.
borderWidthnumberDefault: undefinedSet as an HTML attribute or JavaScript property. type: number.
animatedbooleanDefault: falseWhether to animate initial display and data changes.
animationDurationnumberDefault: 200Animation duration in milliseconds.
animationEasingColumnChartEasingDefault: 'ease-out'Allowed values: linear, ease-out, ease-in, ease-in-out. Default: 'ease-out'.
animationTypeColumnChartAnimationTypeDefault: undefinedAllowed values: initial, update. Default: undefined.
booleanDefault: falseWhether to show a legend for series or items.
legendPositionColumnChartLegendPositionDefault: 'bottom'Where the legend is positioned.
xAxisCartesianAxisInput | ReadonlyArray<CartesianAxisInput>Default: undefinedcategories determines the bar order.
yAxisCartesianYAxisInputDefault: undefinedAllowed values: auto, off. Default: undefined.
chartTitlestringDefault: undefinedThe title inside the chart. Explain the data's unit and meaning alongside it.
chartSubtitlestringDefault: undefinedThe subtitle inside the chart.
CartesianTooltipInputDefault: undefinedTooltip settings for pointer-driven values, position, and content.
CartesianCrosshairInputDefault: undefinedPass as a JavaScript property. type: CartesianCrosshairInput.
gridLinesCartesianGridLinesInputDefault: undefinedAllowed values: auto, off. Default: undefined.
CartesianZoomInputDefault: undefinedSettings for zooming and the visible range.
Other properties 26
Attribute / PropertyType / DefaultDescription
activeSeriesIndexnumberDefault: undefinedSet as an HTML attribute or JavaScript property. type: number.
seriesStateColumnChartSeriesStateOptionsDefault: undefinedPass as a JavaScript property. type: ColumnChartSeriesStateOptions.
seriesActiveTriggerColumnChartSeriesActiveTriggerDefault: 'hover'Allowed values: hover, click, custom. Default: 'hover'.
stringDefault: '#2563eb'Set as an HTML attribute or JavaScript property. type: string.
numberDefault: 0Set as an HTML attribute or JavaScript property. type: number.
numberDefault: 0Value the columns grow from. Always explicit (default `0`) so the start point of every column is never ambiguous — set to a non-zero anchor when the chart measures variance against something other than zero.
borderDashStyleCartesianSeriesBorderDashStyleDefault: undefinedAllowed values: Solid, Dash, Dot, DashDot, LongDash, LongDashDot. Default: undefined.
inactiveOtherPointsbooleanDefault: falseSet as an HTML attribute or JavaScript property. type: boolean.
inactivePointOpacitynumberDefault: 0.2Set as an HTML attribute or JavaScript property. type: number.
ColumnChartEngineModeDefault: 'auto'Renderer selection: auto, standard, or pro. Engine selection is separate from permission to use a Pro chart type.
proThresholdnumberDefault: 50_000Set as an HTML attribute or JavaScript property. type: number.
ColumnChartUnavailableBehaviourDefault: 'fallback'Allowed values: fallback, error. Default: 'fallback'.
streamSourceColumnChartStreamSourceDefault: undefinedA stream source for live data. Check the contract for the specific type.
streamWindownumberDefault: undefinedThe streaming data range to keep visible.
streamMaxnumberDefault: undefinedThe maximum number of streaming data points to retain.
legendItemsLegendItem[]Default: undefinedPass as a JavaScript property. type: LegendItem[].
seriesNamestringDefault: undefinedSet as an HTML attribute or JavaScript property. type: string.
legendFloatAlign'start' | 'center' | 'end'Default: 'end'Allowed values: start, center, end. Default: 'end'.
legendFloatVerticalAlign'top' | 'middle' | 'bottom'Default: 'top'Allowed values: top, bottom, middle. Default: 'top'.
legendDraggablebooleanDefault: falseSet as an HTML attribute or JavaScript property. type: boolean.
CartesianBrushInputDefault: undefinedAllowed values: auto, off, true, false, rect, lasso. Default: undefined.
ChartDrawingsInputDefault: undefinedPass as a JavaScript property. type: ChartDrawingsInput.
drawingModeDrawingModeInputDefault: undefinedAllowed values: none, off, true, false, draw, select. Default: undefined.
drawingToolstringDefault: undefinedSet as an HTML attribute or JavaScript property. type: string.
drawingSpaceDrawingSpaceDefault: undefinedAllowed values: data, pixel. Default: undefined.
visualMapVisualMapBinding | nullDefault: undefinedPass as a JavaScript property. type: VisualMapBinding | null.
Events 23
EventsDetail typeDescription
ColumnChartRenderResult & { tier: ColumnChartEngineTier }Emits rendering results in detail when chart drawing completes.
{ count: number }CustomEvent.detail type: { count: number }. Event names are case-sensitive.
{ dropped: number }CustomEvent.detail type: { dropped: number }. Event names are case-sensitive.
voidCustomEvent.detail type: void. Event names are case-sensitive.
voidCustomEvent.detail type: void. Event names are case-sensitive.
voidCustomEvent.detail type: void. Event names are case-sensitive.
CartesianCrosshairEventDetail | nullCustomEvent.detail type: CartesianCrosshairEventDetail | null. Event names are case-sensitive.
CartesianTooltipEventDetailWhether to display the built-in tooltip.
voidCustomEvent.detail type: void. Event names are case-sensitive.
CartesianTooltipActionEventDetailCustomEvent.detail type: CartesianTooltipActionEventDetail. Event names are case-sensitive.
CartesianZoomChangeEventDetailCustomEvent.detail type: CartesianZoomChangeEventDetail. Event names are case-sensitive.
CartesianBrushChangeEventDetailCustomEvent.detail type: CartesianBrushChangeEventDetail. Event names are case-sensitive.
CartesianBrushStartEventDetailCustomEvent.detail type: CartesianBrushStartEventDetail. Event names are case-sensitive.
CartesianBrushMoveEventDetailCustomEvent.detail type: CartesianBrushMoveEventDetail. Event names are case-sensitive.
CartesianBrushEndEventDetailCustomEvent.detail type: CartesianBrushEndEventDetail. Event names are case-sensitive.
DrawingsChangeEventDetailCustomEvent.detail type: DrawingsChangeEventDetail. Event names are case-sensitive.
DrawingSelectionChangeEventDetailCustomEvent.detail type: DrawingSelectionChangeEventDetail. Event names are case-sensitive.
CartesianPointEventDetail | nullCustomEvent.detail type: CartesianPointEventDetail | null. Event names are case-sensitive.
CartesianPointEventDetailA point selection event. Read the selected data and index from CustomEvent.detail.
ChartPointContextMenuEventDetail<CartesianPointEventDetail>CustomEvent.detail type: ChartPointContextMenuEventDetail<CartesianPointEventDetail>. Event names are case-sensitive.
CartesianSeriesOutsideClickEventDetailCustomEvent.detail type: CartesianSeriesOutsideClickEventDetail. Event names are case-sensitive.
ColumnChartLegendItemEventDetailCustomEvent.detail type: ColumnChartLegendItemEventDetail. Event names are case-sensitive.
ColumnChartSeriesToggledEventDetailCustomEvent.detail type: ColumnChartSeriesToggledEventDetail. Event names are case-sensitive.
Methods 51

Stencil methods return Promises. Use await within an async function to read the result.

Method / ArgumentsReturn typeDescription
Promise<ColumnChartRenderResult>An asynchronous method. Check the argument and return types below.
Promise<ColumnChartEngineTier>An asynchronous method. Check the argument and return types below.
value: numberPromise<void>An asynchronous method. Check the argument and return types below.
values: ReadonlyArray<number> | Float32ArrayPromise<void>An asynchronous method. Check the argument and return types below.
count: numberPromise<void>An asynchronous method. Check the argument and return types below.
values: ReadonlyArray<number> | Float32ArrayPromise<void>An asynchronous method. Check the argument and return types below.
Promise<ColumnChartStreamSource | undefined>An asynchronous method. Check the argument and return types below.
Promise<ChartEngineStatus>The requested engine, the engine that draws and why (ROADMAP-loading §5.3). A Chart Pro license decision names `chart.webgpu` and its state; renderer causes (not in this build, no WebGPU, a failed GPU) stay apart.
options: { duration?: number; easing?: ColumnChartEasing; enabled?: boolean; type?: ColumnChartAnimationType }Promise<void>An asynchronous method. Check the argument and return types below.
Promise<void>An asynchronous method. Check the argument and return types below.
Promise<void>An asynchronous method. Check the argument and return types below.
options: ColumnChartSeries, opts?: { redraw?: boolean; insertAt?: number }Promise<number>An asynchronous method. Check the argument and return types below.
idOrIndex: string | number, opts?: { redraw?: boolean }Promise<boolean>An asynchronous method. Check the argument and return types below.
idOrIndex: string | number, patch: Partial<ColumnChartSeries>, opts?: { redraw?: boolean }Promise<boolean>An asynchronous method. Check the argument and return types below.
idOrIndex: string | number, data: ColumnChartValues, opts?: { redraw?: boolean }Promise<boolean>An asynchronous method. Check the argument and return types below.
idOrIndex: string | number, point: number, opts?: { shift?: boolean; redraw?: boolean }Promise<boolean>An asynchronous method. Check the argument and return types below.
idOrIndex: string | number, opts?: { redraw?: boolean }Promise<boolean>An asynchronous method. Check the argument and return types below.
idOrIndex: string | number, opts?: { redraw?: boolean }Promise<boolean>An asynchronous method. Check the argument and return types below.
pointIndex: numberPromise<CartesianTooltipEventDetail | null>An asynchronous method. Check the argument and return types below.
Promise<void>An asynchronous method. Check the argument and return types below.
request: CartesianZoomRequestPromise<CartesianZoomChangeEventDetail | null>An asynchronous method. Check the argument and return types below.
factor: number, anchorFraction?: numberPromise<CartesianZoomChangeEventDetail | null>An asynchronous method. Check the argument and return types below.
delta: { x?: number; y?: number }Promise<CartesianZoomChangeEventDetail | null>An asynchronous method. Check the argument and return types below.
Promise<CartesianZoomChangeEventDetail | null>An asynchronous method. Check the argument and return types below.
Promise<CartesianZoomState | null>An asynchronous method. Check the argument and return types below.
request?: CartesianZoomExtentRequestPromise<CartesianZoomExtentDetail | null>An asynchronous method. Check the argument and return types below.
request: CartesianCrosshairShowRequestPromise<boolean>An asynchronous method. Check the argument and return types below.
Promise<void>An asynchronous method. Check the argument and return types below.
Promise<ChartDrawing[]>An asynchronous method. Check the argument and return types below.
drawings: ReadonlyArray<ChartDrawingInput> | nullPromise<DrawingsChangeEventDetail | null>An asynchronous method. Check the argument and return types below.
drawing: ChartDrawingInputPromise<ChartDrawing | null>An asynchronous method. Check the argument and return types below.
id: string, patch: Partial<Omit<ChartDrawing, 'id'>>Promise<ChartDrawing | null>An asynchronous method. Check the argument and return types below.
id: stringPromise<boolean>An asynchronous method. Check the argument and return types below.
ids: ReadonlyArray<string>Promise<DrawingsChangeEventDetail | null>An asynchronous method. Check the argument and return types below.
id: string, space: DrawingSpacePromise<ChartDrawing | null>An asynchronous method. Check the argument and return types below.
Promise<DrawingsChangeEventDetail | null>An asynchronous method. Check the argument and return types below.
Promise<DrawingsChangeEventDetail | null>An asynchronous method. Check the argument and return types below.
Promise<DrawingsChangeEventDetail | null>An asynchronous method. Check the argument and return types below.
Promise<DrawingLayerSnapshot | null>An asynchronous method. Check the argument and return types below.
Promise<string>An asynchronous method. Check the argument and return types below.
input: ChartDrawingsInputPromise<DrawingsChangeEventDetail | null>An asynchronous method. Check the argument and return types below.
ids: ReadonlyArray<string> | nullPromise<DrawingSelectionChangeEventDetail | null>An asynchronous method. Check the argument and return types below.
Promise<string[]>An asynchronous method. Check the argument and return types below.
areas: ReadonlyArray<CartesianBrushAreaInput> | nullPromise<CartesianBrushChangeEventDetail | null>An asynchronous method. Check the argument and return types below.
Promise<CartesianBrushChangeEventDetail | null>An asynchronous method. Check the argument and return types below.
Promise<CartesianBrushArea[]>An asynchronous method. Check the argument and return types below.
Promise<CartesianBrushSelectedSeries[]>An asynchronous method. Check the argument and return types below.
binding: VisualMapBinding | nullPromise<VisualMapBinding | null>Bind (or clear) a visual map: every mark is coloured through it on the next paint.
Promise<VisualMapBinding | null>An asynchronous method. Check the argument and return types below.
request?: VisualMapExtentRequestPromise<VisualMapExtent | null>The extent of a dimension over the visible points — what a bound `sy-visual-map` adopts as its domain.
cssX: number, cssY: numberPromise<{ pointIndex: number; seriesIndex: number } | null>An asynchronous method. Check the argument and return types below.