Proportion · Advanced

Marimekko chart

Two shares at once: width (column share) and height (share within the column).

Open in playground
Use when
Revenue size by channel and device mix in one chart
Avoid when
More than 6 columns or more than 4 series

Try it

09

Marimekko chart

Channel sales and device mix (%)
  • Mobile
  • Desktop
  • Tablet
Marimekko chartMarimekko chart. Columns: Search 45%, PMax 35%, Social 20%. Series: Mobile, Desktop, Tablet.58%36%74%22%88%9%
Marimekko chart data
Search · Mobile58% · 26.1
Search · Desktop36% · 16.2
Search · Tablet6% · 2.7
PMax · Mobile74% · 25.9
PMax · Desktop22% · 7.7
PMax · Tablet4% · 1.4
Social · Mobile88% · 17.6
Social · Desktop9% · 1.8
Social · Tablet3% · 0.6
Two shares in width and heightAdvanced

Hover over the chart, or Tab in and use the arrow keys to move between items. The numbers are sample data.

Code

MarimekkoChart.tsx
import { ChartCard, MarimekkoChart } from "ztd-charts";

const data = [
  {"channel":"Search","device":"Mobile","sales":26.1},
  {"channel":"Search","device":"Desktop","sales":16.2},
  {"channel":"Search","device":"Tablet","sales":2.7},
  {"channel":"PMax","device":"Mobile","sales":25.9},
  {"channel":"PMax","device":"Desktop","sales":7.7},
  {"channel":"PMax","device":"Tablet","sales":1.4},
  // … 3 more rows
];

export function Example() {
  return (
    <ChartCard number="09" title="Marimekko chart" subtitle="Channel sales and device mix (%)" takeaway="Two shares in width and height" level="advanced" replay>
      <MarimekkoChart
        data={data}
        x="channel"
        series="device"
        value="sales"
      />
    </ChartCard>
  );
}

Props

<MarimekkoChart> takes these props. Rows marked Common work the same on every chart.

25 props

Prop
dataRequiredAn array of objects. Pass CSV, REST or database rows as they areobject[]
xRequiredColumn fieldstring | (d, i) => string
seriesRequiredStacked series fieldstring | (d, i) => string
valueRequiredValue fieldstring | (d, i) => number
heightCommonHeight in px. Without it, each chart picks a default that fits its widthnumber
widthCommonFixed width in px. Without it, the chart fits its parentnumber
highlightCommonItem to highlight. An index, a name, an array, or "max" | "min" | "first" | "last" | "none"number | string | (number|string)[] | "max" …
formatCommonValue format. "number" | "integer" | "percent" (values are already percents: 42 → "42%") | "ratio" (0.42 → "42%") | "compact" | "currency" (KRW for Korean locales, otherwise USD; for another currency pass Intl options with currency) | "decimal" or Intl.NumberFormat options"number" | "percent" | "compact" | …
unitCommonUnit appended to values. For example "%" or "ms"string
localeCommonLocale for numbers, dates and the text a chart writes itself (tooltips, screen reader sentences). "ko" or "ko-*" switches to Korean. Falls back to the ThemeProvider localestringDefault "en-US"
animateCommonEntry and update animationbooleanDefault true
durationCommonAnimation length (ms)number
easingCommonMotion curve"spring" | "easeOut" | "easeInOut" | "linear"Default "spring"
staggerCommonDelay between items as they enter (ms)number
reducedMotionCommon"auto" follows the OS setting. true always turns motion offanyDefault "auto"
animateOnViewCommonPlay when the chart scrolls into viewbooleanDefault true
showLabelsCommonLabels drawn on the chart (values and names)booleanDefault true
tooltipCommonShow tooltips. { template: "{label} · {value} · owner {owner}" } writes them: {label}, {value}, {series} or any other column of the row. \n starts a new line, and a line with an empty value is left outtooltipDefault true
syncIdCommonCharts with the same syncId show the hovered x together (line, area, bar, candlestick). <ChartGrid sync> sets one for every chart inside itstring
ariaLabelCommonName for screen readersstring
descriptionCommonDescription for screen readers. Built from the data when omittedstring
onHoverCommonRuns when hover or keyboard focus moves to another item(e: ChartEvent | null) => void
onClickCommonRuns on click, Enter or Space(e: ChartEvent) => void
replayKeyCommonReplays the entry animation when it changesstring | number
themeCommonChanges theme tokens for this chart onlyPartial<ChartTheme>