Marimekko.

COMMUNITY

Show group size and internal proportions together.

Live preview22 feature examples

LIVE EXAMPLE

Market composition

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 style4
Axes and grid lines5
Legend and interaction14
Title and dimensions3

Read column widths together with segment proportions within each column. 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-marimekko-chart.js';
  define0();

  const specs = [
    {
      "id": "example-chart",
      "tag": "sy-marimekko-chart",
      "props": {
        "engine": "standard",
        "categories": ["Domestic", "Asia", "Europe"],
        "series": [
          {
            "name": "A",
            "values": [40, 30, 20],
            "color": "#8263d9"
          },
          {
            "name": "B",
            "values": [25, 45, 15],
            "color": "#239c91"
          }
        ],
        "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', 'marimekko 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

#

Compare market totals alongside product shares.

Both width and vertical proportions vary. Supplement precise values with tooltips or a table.

Data contract

PropertyInput format
seriesAn array of { name, values }. Columns in values correspond to categories.
categoriesNames of the groups whose widths are compared.

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 22 interactive feature examples and inspect their code. Select “Edit in preview” to combine more options in the settings panel above.

Show column shares

Read each group's share of the whole.

Interact with the chart to see results here.
View code

Section spacing

Separate group boundaries with spacing.

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

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

Color

Compare 4 examples of Color. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

Column share

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

Interact with the chart to see results here.
View code

Crosshair

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

Interact with the chart to see results here.
View code

Gap

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

Interact with the chart to see results here.
View code

Legend

Compare 4 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 2 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

Series

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

Interact with the chart to see results here.
View code

Size

Compare 2 examples of Size. 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

Data input

Compare 2 examples of Data input. 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

Runtime API

Compare 1 examples of Runtime API. 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 · Add and update live dataPRO

Compare 1 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-marimekko-chart. Pass objects and arrays as JavaScript properties. Select a name to view usage code and type definitions.

Key properties

Attribute / PropertyType / DefaultDescription
ReadonlyArray<MarimekkoSeries>Default: []An array of { name, values }. Columns in values correspond to categories.
ReadonlyArray<string>Default: undefinedNames of the groups whose widths are compared.
numberDefault: 680Chart width in pixels. Update with ResizeObserver when the container changes.
numberDefault: 380Chart 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.
columnGapnumberDefault: 0.01Horizontal gap between columns as a fraction of each slot (0..0.3).
showColumnSharebooleanDefault: trueShow the per-column total percentage above each column.
xLabelMode'auto' | 'all' | 'thin' | 'rotate' | 'none'Default: undefinedHow crowded category-axis (column) labels are decluttered. Default 'auto' thins labels horizontally.
xLabelRotationnumberDefault: undefinedExplicit category-label rotation in degrees (respected as a floor).
valueAxisLabelstringDefault: undefinedSet as an HTML attribute or JavaScript property. type: string.
gridLinesCartesianGridLinesInputDefault: undefinedAllowed values: auto, off. Default: undefined.
CartesianCrosshairInputDefault: undefinedCrosshair that follows the cursor across the plot. `true`/`'auto'` enables a snapping line; pass an object to set mode/snap/color/dash.
chartTitlestringDefault: undefinedThe title inside the chart. Explain the data's unit and meaning alongside it.
chartSubtitlestringDefault: undefinedThe subtitle inside the chart.
booleanDefault: trueWhether to show a legend for series or items.
legendPositionMarimekkoChartLegendPositionDefault: 'top'Where the legend is positioned.
tooltipEnabledbooleanDefault: trueSet as an HTML attribute or JavaScript property. type: boolean.
CartesianTooltipInputDefault: undefinedTooltip settings for pointer-driven values, position, and content.
animatedbooleanDefault: falseWhether to animate initial display and data changes.
animationDurationnumberDefault: 600Animation duration in milliseconds.
animationEasingMarimekkoChartEasingDefault: 'ease-out'Allowed values: linear, ease-out, ease-in, ease-in-out. Default: 'ease-out'.
animationTypeMarimekkoChartAnimationTypeDefault: undefinedAllowed values: initial, update. Default: undefined.
Other properties 10
Attribute / PropertyType / DefaultDescription
xLabelMaxCountnumberDefault: undefinedHard cap on the number of category labels shown.
string | ReadonlyArray<string>Default: '#2563eb'Segment colours. Overrides the built-in per-series palette: a single CSS colour, an array, or a comma-separated string. Colour `i` applies to segment `i`; where the list is shorter than the segment count the built-in palette fills the remaining indices. A segment's own `color` (in `series`) always wins over this attribute.
tooltipFormat(detail: MarimekkoChartPointerEventDetail) => stringDefault: undefinedPass as a JavaScript property. type: (detail: MarimekkoChartPointerEventDetail) => string.
enableMouseTrackingbooleanDefault: trueSet as an HTML attribute or JavaScript property. type: boolean.
streamSourceMarimekkoChartStreamSourceDefault: 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.
MarimekkoChartEngineModeDefault: '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.
MarimekkoChartUnavailableBehaviourDefault: 'fallback'Allowed values: fallback, error, throw. Default: 'fallback'.
Events 16
EventsDetail typeDescription
MarimekkoChartRenderResult & { tier: MarimekkoChartEngineTier }Emits rendering results in detail when chart drawing completes.
MarimekkoChartPointerEventDetailA point selection event. Read the selected data and index from CustomEvent.detail.
MarimekkoChartPointerEventDetail | nullCustomEvent.detail type: MarimekkoChartPointerEventDetail | null. Event names are case-sensitive.
CartesianCrosshairEventDetail | nullCustomEvent.detail type: CartesianCrosshairEventDetail | null. Event names are case-sensitive.
ChartPointContextMenuEventDetail<MarimekkoChartPointerEventDetail>CustomEvent.detail type: ChartPointContextMenuEventDetail<MarimekkoChartPointerEventDetail>. 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.
CartesianSeriesOutsideClickEventDetailCustomEvent.detail type: CartesianSeriesOutsideClickEventDetail. Event names are case-sensitive.
MarimekkoChartLegendItemEventDetailCustomEvent.detail type: MarimekkoChartLegendItemEventDetail. Event names are case-sensitive.
{ index: number; seriesId: string; disabled: boolean }CustomEvent.detail type: { index: number; seriesId: string; disabled: boolean }. Event names are case-sensitive.
{ 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.
Methods 22

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

Method / ArgumentsReturn typeDescription
Promise<MarimekkoChartRenderResult>An asynchronous method. Check the argument and return types below.
Promise<MarimekkoChartEngineTier>An asynchronous method. Check the argument and return types below.
series: ReadonlyArray<MarimekkoSeries>Promise<void>An asynchronous method. Check the argument and return types below.
datum: MarimekkoColumnDatumPromise<void>An asynchronous method. Check the argument and return types below.
data: ReadonlyArray<MarimekkoColumnDatum>Promise<void>An asynchronous method. Check the argument and return types below.
count: numberPromise<void>An asynchronous method. Check the argument and return types below.
data: ReadonlyArray<MarimekkoColumnDatum>Promise<void>An asynchronous method. Check the argument and return types below.
Promise<MarimekkoChartStreamSource | undefined>An asynchronous method. Check the argument and return types below.
options: { duration?: number; easing?: MarimekkoChartEasing; enabled?: boolean; type?: MarimekkoChartAnimationType }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.
Promise<void>An asynchronous method. Check the argument and return types below.
cssX: number, cssY: numberPromise<MarimekkoChartPointerEventDetail | null>An asynchronous method. Check the argument and return types below.
columnIndex: number, seriesIndex?: 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.
series: MarimekkoSeries, 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<MarimekkoSeries>, opts?: { redraw?: boolean }Promise<boolean>An asynchronous method. Check the argument and return types below.
idOrIndex: string | number, values: ReadonlyArray<number> | Float32Array, 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.
idOrIndex: string | number, opts?: { redraw?: boolean }Promise<boolean>An asynchronous method. Check the argument and return types below.
Promise<ChartEngineStatus>Requested engine vs what runs, and why (CHART-ADD-08): always Standard (this type has no WebGPU renderer); read without side effects, never consults the license.