Butterfly chart

Compare two measures for the same list of rows in a butterfly chart: two mirrored horizontal bar panes around one shared column of category names.

React
import { ButterflyChart } from 'boardplot/react/butterfly';
Use for
Two measures per category · Before and after by segment · Imports and exports by country
Not for
More than two measures per category; butterfly has two panes.

Two products compared by customer

Butterfly chart comparing Product A (left) and Product B (right) across 8 categories. Customer 1: Product A 94, Product B 95; Customer 2: Product A 81, Product B 60; Customer 3: Product A 69, Product B 71; Customer 4: Product A 55, Product B 48; Customer 5: Product A 42, Product B 45; Customer 6: Product A 33, Product B 28; Customer 7: Product A 21, Product B 19; Customer 8: Product A 10, Product B 12. Product B matches A at the top accounts but trails 21 at Customer 2 RetailCo · Customer spend in $k · FY25 Source: RetailCo sales ledger, FY25 actuals Customer 1 Customer 2 Customer 3 Customer 4 Customer 5 Customer 6 Customer 7 Customer 8 94 10 95 12 Product A Product B 81 71 69 60 55 48 45 42 33 28 21 19 −21

Mirrored bars compare Product A and Product B spend for eight customers; Customer 2 shows Product B at 60 against 81 for A, flagged as minus 21.

Download SVG Fixture IDcustomer-spend
JSON spec

This spec includes the theme shown and the options you selected.

Changed from the fixture: options.size from the report frame to the width of the site frame.

{
  "type": "butterfly",
  "data": {
    "categories": [
      {
        "id": "c1",
        "label": "Customer 1"
      },
      {
        "id": "c2",
        "label": "Customer 2"
      },
      {
        "id": "c3",
        "label": "Customer 3"
      },
      {
        "id": "c4",
        "label": "Customer 4"
      },
      {
        "id": "c5",
        "label": "Customer 5"
      },
      {
        "id": "c6",
        "label": "Customer 6"
      },
      {
        "id": "c7",
        "label": "Customer 7"
      },
      {
        "id": "c8",
        "label": "Customer 8"
      }
    ],
    "series": [
      {
        "id": "prodA",
        "label": "Product A",
        "values": [
          94,
          81,
          69,
          55,
          42,
          33,
          21,
          10
        ]
      },
      {
        "id": "prodB",
        "label": "Product B",
        "values": [
          95,
          60,
          71,
          48,
          45,
          28,
          19,
          12
        ]
      }
    ]
  },
  "options": {
    "a": "prodA",
    "b": "prodB",
    "sortBy": "a",
    "title": "Product B matches A at the top accounts but trails 21 at Customer 2",
    "subtitle": {
      "company": "RetailCo",
      "measure": "Customer spend",
      "period": "FY25"
    },
    "unit": "$k",
    "source": "RetailCo sales ledger, FY25 actuals",
    "size": {
      "width": 1000
    }
  },
  "annotations": [
    {
      "kind": "delta",
      "at": {
        "categoryId": "c2",
        "seriesId": "prodB"
      },
      "vs": {
        "categoryId": "c2",
        "seriesId": "prodA"
      }
    }
  ]
}

License and services revenue by industry

Butterfly chart comparing License (left) and Services (right) across 6 categories. Banking: License 96, Services 112; Pharma: License 128, Services 74; Automotive: License 84, Services 90; Retail: License 61, Services 38; Energy: License 44, Services 52; Public sector: License 25, Services 71. Services carry four of six industries, Public sector most of all Software Company A · Revenue in $m · FY24 · AC Source: Illustrative management accounts FY24 Public sector 25 71 Automotive Banking Energy Pharma Retail 96 112 License Services 128 90 84 74 61 52 44 38

Mirrored bars compare license and services revenue for six industries; services lead in four, with Public sector highlighted at 71 against 25.

Download SVG Fixture IDlicense-vs-services
JSON spec

This spec includes the theme shown and the options you selected.

Changed from the fixture: options.unit; options.size from the report frame to the width of the site frame.

{
  "type": "butterfly",
  "data": {
    "categories": [
      {
        "id": "pharma",
        "label": "Pharma"
      },
      {
        "id": "banking",
        "label": "Banking"
      },
      {
        "id": "auto",
        "label": "Automotive"
      },
      {
        "id": "retail",
        "label": "Retail"
      },
      {
        "id": "energy",
        "label": "Energy"
      },
      {
        "id": "public",
        "label": "Public sector"
      }
    ],
    "series": [
      {
        "id": "license",
        "label": "License",
        "values": [
          128,
          96,
          84,
          61,
          44,
          25
        ]
      },
      {
        "id": "services",
        "label": "Services",
        "values": [
          74,
          112,
          90,
          38,
          52,
          71
        ]
      }
    ]
  },
  "options": {
    "a": "license",
    "b": "services",
    "sortBy": "sum",
    "highlight": [
      "public"
    ],
    "title": "Services carry four of six industries, Public sector most of all",
    "subtitle": {
      "company": "Software Company A",
      "measure": "Revenue",
      "period": "FY24",
      "scenarios": [
        "AC"
      ]
    },
    "unit": "$m",
    "source": "Illustrative management accounts FY24",
    "size": {
      "width": 1000
    }
  }
}

Channel growth with CAGR and gap

Butterfly chart comparing Online (left) and Store (right) across 3 categories. FY21: Online 100, Store 130; FY22: Online 120, Store 150; FY23: Online 144, Store 180. Online grows 20% a year; Store is 30 ahead in FY21 Orders · FY21 to FY23 Source: Illustrative channel orders FY21 FY22 FY23 100 144 130 180 Online Store 120 150 Online to Store: +30 Online FY21–FY23: +20% p.a.

Mirrored bars compare Online and Store orders for FY21 to FY23, with a 20% a year growth arrow on Online (100 to 144) and a +30 gap bracket in FY21.

Download SVG Fixture IDperiod-comparisons
JSON spec

This spec includes the theme shown and the options you selected.

Changed from the fixture: options.size from {"width":1000,"height":500} to the width of the site frame.

{
  "type": "butterfly",
  "data": {
    "categories": [
      {
        "id": "fy21",
        "label": "FY21",
        "date": "2021-12-31"
      },
      {
        "id": "fy22",
        "label": "FY22",
        "date": "2022-12-31"
      },
      {
        "id": "fy23",
        "label": "FY23",
        "date": "2023-12-31"
      }
    ],
    "series": [
      {
        "id": "online",
        "label": "Online",
        "values": [
          100,
          120,
          144
        ]
      },
      {
        "id": "store",
        "label": "Store",
        "values": [
          130,
          150,
          180
        ]
      }
    ]
  },
  "options": {
    "a": "online",
    "b": "store",
    "size": {
      "width": 1000
    },
    "title": "Online grows 20% a year; Store is 30 ahead in FY21",
    "subtitle": {
      "measure": "Orders",
      "period": "FY21 to FY23"
    },
    "source": "Illustrative channel orders",
    "annotations": [
      {
        "id": "growth",
        "kind": "cagr",
        "from": {
          "categoryId": "fy21",
          "seriesId": "online"
        },
        "to": {
          "categoryId": "fy23",
          "seriesId": "online"
        }
      },
      {
        "id": "gap",
        "kind": "diff",
        "mode": "absolute",
        "from": {
          "categoryId": "fy21",
          "seriesId": "online"
        },
        "to": {
          "categoryId": "fy21",
          "seriesId": "store"
        }
      }
    ]
  }
}

Minimal spec

Save this spec as butterfly.json and run the command.

{
  "type": "butterfly",
  "data": {
    "categories": [{ "id": "north", "label": "North" }, { "id": "south", "label": "South" }],
    "series": [
      { "id": "plan", "label": "Plan", "values": [100, 80], "scenario": "PL" },
      { "id": "actual", "label": "Actual", "values": [120, 70], "scenario": "AC" }
    ]
  },
  "options": {
    "a": "plan",
    "b": "actual",
    "unit": "$k",
    "title": "North beats plan while South falls short",
    "source": "Illustrative data",
    "footnotes": ["AC = actual; PL = plan."]
  }
}
npx boardplot render butterfly.json --out butterfly.svg