Drill Down

plotOptions.sankey.drilldown: click a region to open its countries (EMEA → Germany goes one level deeper, loaded on demand); the breadcrumb, Escape or Up go back.

Chart type
Sankey sankey
Tier
Premium
Collection
Sankey
Render
Live, site theme
View .md Agent setup
LIVE/sankey/drill-down14 of 23 in Sankey

Configuration

Raw Standalone
const options = {
  chart: {
    height: 420,
    toolbar: {
      show: false
    },
    type: "sankey",
    events: {
      drilldown: (e, ctx, o) => log('drilldown ' + o.name + ' (depth ' + o.depth + ')'),
      drillup: (e, ctx, o) => log('drillup to ' + o.label)
    }
  },
  series: [
    {
      data: [
        ["EMEA", "Revenue", 420],
        ["Americas", "Revenue", 510],
        ["APAC", "Revenue", 260],
        ["Revenue", "Profit", 380],
        ["Revenue", "Costs", 810]
      ]
    }
  ],
  plotOptions: {
    sankey: {
      drilldown: {
        rootLabel: "All regions",
        nodes: {
          EMEA: {
            label: "EMEA",
            data: [
              ["Germany", "EMEA", 160],
              ["France", "EMEA", 110],
              ["UK", "EMEA", 95],
              ["Nordics", "EMEA", 55],
              ["EMEA", "Revenue", 420]
            ],
            nodes: [
              {
                id: "EMEA",
                color: "#64748b"
              }
            ]
          },
          Americas: {
            label: "Americas",
            data: [
              ["USA", "Americas", 380],
              ["Canada", "Americas", 70],
              ["Brazil", "Americas", 60],
              ["Americas", "Revenue", 510]
            ],
            nodes: [
              {
                id: "Americas",
                color: "#64748b"
              }
            ]
          },
          APAC: {
            label: "APAC",
            data: [
              ["Japan", "APAC", 120],
              ["Australia", "APAC", 80],
              ["Singapore", "APAC", 60],
              ["APAC", "Revenue", 260]
            ],
            nodes: [
              {
                id: "APAC",
                color: "#64748b"
              }
            ]
          }
        },
        drillable: ["Germany"],
        load: (n) => new Promise((res) => setTimeout(() => res({ label: n.name, data: [['Hardware', n.name, 70], ['Software', n.name, 60], ['Services', n.name, 30], [n.name, 'EMEA', 160]] }), 500))
      }
    }
  },
  theme: {
    mode: "light",
    preset: "coastal"
  }
}

const chart = new WestCoastCharts(document.querySelector('#chart'), options)
chart.render()

This example uses Premium modules. Compare licences · Embedding in a distributed product?