Skip to content
OpenChart

How to use small multiples

When a line chart has too many series, give each one its own panel. Then decide whether the panels share a y scale.

196019701980199020002010020406080100Launches per yearUSSR/Russia10United States27Other countries15China28USSR and Russian launches peaked at 108 in 1982, US launches at 77in 1966Launches per year by country, 1957-2018196019701980199020002010020406080100Launches per yearUSSR/Russia10United States27Other countries15China28USSR and Russian launches peaked at 108 in 1982, US launches at 77in 1966Launches per year by country, 1957-2018
Space launches by country on one chart. Source: TidyTuesday (R for Data Science Online Learning Community), space launches.

Made with OpenChart. How to build this line chart

The Soviet Union launched 108 times in 1982, six times as often as the United States. By 2018, the last year in this data, Russia launched 10 times and trailed both the United States and China. On one chart with four lines that history is hard to follow, because the lines cross: since 1995 all four stay under 40 launches a year and keep swapping places.

196019701980199020002010020406080100Launches per yearUSSR/Russia10United States27Other countries15China28USSR and Russian launches peaked at 108 in 1982, US launches at 77in 1966Launches per year by country, 1957-2018196019701980199020002010020406080100Launches per yearUSSR/Russia10United States27Other countries15China28USSR and Russian launches peaked at 108 in 1982, US launches at 77in 1966Launches per year by country, 1957-2018
Space launches by country on one chart. Source: TidyTuesday (R for Data Science Online Learning Community), space launches.

Made with OpenChart. How to build this line chart

{
  "mark": {
    "type": "line",
    "strokeWidth": 2,
    "interpolate": "linear"
  },
  "data": [
    {
      "date": "1957-01-01",
      "country": "USSR/Russia",
      "launches": 2
    },
    {
      "date": "1957-01-01",
      "country": "United States",
      "launches": 1
    },
    {
      "date": "1957-01-01",
      "country": "Other countries",
      "launches": 0
    },
    {
      "date": "1957-01-01",
      "country": "China",
      "launches": 0
    },
    {
      "date": "1958-01-01",
      "country": "USSR/Russia",
      "launches": 5
    },
    {
      "date": "1958-01-01",
      "country": "United States",
      "launches": 22
    },
    // … 242 more rows; Copy includes them
  ],
  "encoding": {
    "x": {
      "field": "date",
      "type": "temporal",
      "axis": {
        "format": "%Y",
        "tickCount": 5
      }
    },
    "y": {
      "field": "launches",
      "type": "quantitative",
      "axis": {
        "title": "Launches per year"
      }
    },
    "color": {
      "field": "country",
      "type": "nominal",
      "scale": {
        "domain": [
          "USSR/Russia",
          "United States",
          "Other countries",
          "China"
        ]
      }
    }
  },
  "theme": {
    "colors": {
      "categorical": [
        {
          "light": "#0e7490",
          "dark": "#22a3c4"
        },
        {
          "light": "#c2410c",
          "dark": "#fb923c"
        },
        {
          "light": "#6b7280",
          "dark": "#9ca3af"
        },
        {
          "light": "#7c3aed",
          "dark": "#a78bfa"
        }
      ]
    }
  },
  "chrome": {
    "title": "USSR and Russian launches peaked at 108 in 1982, US launches at 77 in 1966",
    "subtitle": "Launches per year by country, 1957-2018"
  }
}
import { Chart } from "@opendata-ai/openchart-react";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 248 rows; Copy includes them */];

const spec: ChartSpec = {
  data,
  "mark": {
    "type": "line",
    "strokeWidth": 2,
    "interpolate": "linear"
  },
  "encoding": {
    "x": {
      "field": "date",
      "type": "temporal",
      "axis": {
        "format": "%Y",
        "tickCount": 5
      }
    },
    "y": {
      "field": "launches",
      "type": "quantitative",
      "axis": {
        "title": "Launches per year"
      }
    },
    "color": {
      "field": "country",
      "type": "nominal",
      "scale": {
        "domain": [
          "USSR/Russia",
          "United States",
          "Other countries",
          "China"
        ]
      }
    }
  },
  "theme": {
    "colors": {
      "categorical": [
        {
          "light": "#0e7490",
          "dark": "#22a3c4"
        },
        {
          "light": "#c2410c",
          "dark": "#fb923c"
        },
        {
          "light": "#6b7280",
          "dark": "#9ca3af"
        },
        {
          "light": "#7c3aed",
          "dark": "#a78bfa"
        }
      ]
    }
  },
  "chrome": {
    "title": "USSR and Russian launches peaked at 108 in 1982, US launches at 77 in 1966",
    "subtitle": "Launches per year by country, 1957-2018"
  }
};

export function Example() {
  return <Chart spec={spec} />;
}
<script setup lang="ts">
import { Chart } from "@opendata-ai/openchart-vue";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 248 rows; Copy includes them */];

const spec: ChartSpec = {
  data,
  "mark": {
    "type": "line",
    "strokeWidth": 2,
    "interpolate": "linear"
  },
  "encoding": {
    "x": {
      "field": "date",
      "type": "temporal",
      "axis": {
        "format": "%Y",
        "tickCount": 5
      }
    },
    "y": {
      "field": "launches",
      "type": "quantitative",
      "axis": {
        "title": "Launches per year"
      }
    },
    "color": {
      "field": "country",
      "type": "nominal",
      "scale": {
        "domain": [
          "USSR/Russia",
          "United States",
          "Other countries",
          "China"
        ]
      }
    }
  },
  "theme": {
    "colors": {
      "categorical": [
        {
          "light": "#0e7490",
          "dark": "#22a3c4"
        },
        {
          "light": "#c2410c",
          "dark": "#fb923c"
        },
        {
          "light": "#6b7280",
          "dark": "#9ca3af"
        },
        {
          "light": "#7c3aed",
          "dark": "#a78bfa"
        }
      ]
    }
  },
  "chrome": {
    "title": "USSR and Russian launches peaked at 108 in 1982, US launches at 77 in 1966",
    "subtitle": "Launches per year by country, 1957-2018"
  }
};
</script>

<template>
  <Chart :spec="spec" />
</template>
<script lang="ts">
import { Chart } from "@opendata-ai/openchart-svelte";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 248 rows; Copy includes them */];

const spec: ChartSpec = {
  data,
  "mark": {
    "type": "line",
    "strokeWidth": 2,
    "interpolate": "linear"
  },
  "encoding": {
    "x": {
      "field": "date",
      "type": "temporal",
      "axis": {
        "format": "%Y",
        "tickCount": 5
      }
    },
    "y": {
      "field": "launches",
      "type": "quantitative",
      "axis": {
        "title": "Launches per year"
      }
    },
    "color": {
      "field": "country",
      "type": "nominal",
      "scale": {
        "domain": [
          "USSR/Russia",
          "United States",
          "Other countries",
          "China"
        ]
      }
    }
  },
  "theme": {
    "colors": {
      "categorical": [
        {
          "light": "#0e7490",
          "dark": "#22a3c4"
        },
        {
          "light": "#c2410c",
          "dark": "#fb923c"
        },
        {
          "light": "#6b7280",
          "dark": "#9ca3af"
        },
        {
          "light": "#7c3aed",
          "dark": "#a78bfa"
        }
      ]
    }
  },
  "chrome": {
    "title": "USSR and Russian launches peaked at 108 in 1982, US launches at 77 in 1966",
    "subtitle": "Launches per year by country, 1957-2018"
  }
};
</script>

<Chart {spec} />
import { createChart } from "@opendata-ai/openchart-vanilla";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 248 rows; Copy includes them */];

const spec: ChartSpec = {
  data,
  "mark": {
    "type": "line",
    "strokeWidth": 2,
    "interpolate": "linear"
  },
  "encoding": {
    "x": {
      "field": "date",
      "type": "temporal",
      "axis": {
        "format": "%Y",
        "tickCount": 5
      }
    },
    "y": {
      "field": "launches",
      "type": "quantitative",
      "axis": {
        "title": "Launches per year"
      }
    },
    "color": {
      "field": "country",
      "type": "nominal",
      "scale": {
        "domain": [
          "USSR/Russia",
          "United States",
          "Other countries",
          "China"
        ]
      }
    }
  },
  "theme": {
    "colors": {
      "categorical": [
        {
          "light": "#0e7490",
          "dark": "#22a3c4"
        },
        {
          "light": "#c2410c",
          "dark": "#fb923c"
        },
        {
          "light": "#6b7280",
          "dark": "#9ca3af"
        },
        {
          "light": "#7c3aed",
          "dark": "#a78bfa"
        }
      ]
    }
  },
  "chrome": {
    "title": "USSR and Russian launches peaked at 108 in 1982, US launches at 77 in 1966",
    "subtitle": "Launches per year by country, 1957-2018"
  }
};

const container = document.getElementById("chart");
if (!container) throw new Error('Add <div id="chart"></div> to the page first.');
createChart(container, spec);

One panel per series

Small multiples repeat one chart once per series, with the same x axis in every panel. Each line gets a frame to itself, so you read its shape without untangling it from three others.

USSR/Russia050100United States050100Other countries050100China196019701980199020002010050100China launched 28 times in 2018, one more than the USLaunches per year by country, 1957-2018, same y scale in each panelUSSR/Russia050100United States050100Other countries050100China196019701980199020002010050100China launched 28 times in 2018, one more than the USLaunches per year by country, 1957-2018, same y scale in each panel
Live example. Source: TidyTuesday (R for Data Science Online Learning Community), space launches.

Made with OpenChart. How to build this line chart

{
  "mark": {
    "type": "line",
    "strokeWidth": 2,
    "interpolate": "linear"
  },
  "data": [
    {
      "date": "1957-01-01",
      "country": "USSR/Russia",
      "launches": 2
    },
    {
      "date": "1957-01-01",
      "country": "United States",
      "launches": 1
    },
    {
      "date": "1957-01-01",
      "country": "Other countries",
      "launches": 0
    },
    {
      "date": "1957-01-01",
      "country": "China",
      "launches": 0
    },
    {
      "date": "1958-01-01",
      "country": "USSR/Russia",
      "launches": 5
    },
    {
      "date": "1958-01-01",
      "country": "United States",
      "launches": 22
    },
    // … 242 more rows; Copy includes them
  ],
  "encoding": {
    "x": {
      "field": "date",
      "type": "temporal",
      "axis": {
        "format": "%Y",
        "tickCount": 5
      }
    },
    "y": {
      "field": "launches",
      "type": "quantitative",
      "axis": {
        "tickPosition": "gutter"
      }
    },
    "row": {
      "field": "country",
      "type": "nominal",
      "sort": null
    }
  },
  "resolve": {
    "scale": {
      "y": "shared"
    }
  },
  "theme": {
    "colors": {
      "categorical": [
        {
          "light": "#0e7490",
          "dark": "#22a3c4"
        }
      ]
    }
  },
  "chrome": {
    "title": "China launched 28 times in 2018, one more than the US",
    "subtitle": "Launches per year by country, 1957-2018, same y scale in each panel"
  }
}
import { Chart } from "@opendata-ai/openchart-react";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 248 rows; Copy includes them */];

const spec: ChartSpec = {
  data,
  "mark": {
    "type": "line",
    "strokeWidth": 2,
    "interpolate": "linear"
  },
  "encoding": {
    "x": {
      "field": "date",
      "type": "temporal",
      "axis": {
        "format": "%Y",
        "tickCount": 5
      }
    },
    "y": {
      "field": "launches",
      "type": "quantitative",
      "axis": {
        "tickPosition": "gutter"
      }
    },
    "row": {
      "field": "country",
      "type": "nominal",
      "sort": null
    }
  },
  "resolve": {
    "scale": {
      "y": "shared"
    }
  },
  "theme": {
    "colors": {
      "categorical": [
        {
          "light": "#0e7490",
          "dark": "#22a3c4"
        }
      ]
    }
  },
  "chrome": {
    "title": "China launched 28 times in 2018, one more than the US",
    "subtitle": "Launches per year by country, 1957-2018, same y scale in each panel"
  }
};

export function Example() {
  return <Chart spec={spec} />;
}
<script setup lang="ts">
import { Chart } from "@opendata-ai/openchart-vue";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 248 rows; Copy includes them */];

const spec: ChartSpec = {
  data,
  "mark": {
    "type": "line",
    "strokeWidth": 2,
    "interpolate": "linear"
  },
  "encoding": {
    "x": {
      "field": "date",
      "type": "temporal",
      "axis": {
        "format": "%Y",
        "tickCount": 5
      }
    },
    "y": {
      "field": "launches",
      "type": "quantitative",
      "axis": {
        "tickPosition": "gutter"
      }
    },
    "row": {
      "field": "country",
      "type": "nominal",
      "sort": null
    }
  },
  "resolve": {
    "scale": {
      "y": "shared"
    }
  },
  "theme": {
    "colors": {
      "categorical": [
        {
          "light": "#0e7490",
          "dark": "#22a3c4"
        }
      ]
    }
  },
  "chrome": {
    "title": "China launched 28 times in 2018, one more than the US",
    "subtitle": "Launches per year by country, 1957-2018, same y scale in each panel"
  }
};
</script>

<template>
  <Chart :spec="spec" />
</template>
<script lang="ts">
import { Chart } from "@opendata-ai/openchart-svelte";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 248 rows; Copy includes them */];

const spec: ChartSpec = {
  data,
  "mark": {
    "type": "line",
    "strokeWidth": 2,
    "interpolate": "linear"
  },
  "encoding": {
    "x": {
      "field": "date",
      "type": "temporal",
      "axis": {
        "format": "%Y",
        "tickCount": 5
      }
    },
    "y": {
      "field": "launches",
      "type": "quantitative",
      "axis": {
        "tickPosition": "gutter"
      }
    },
    "row": {
      "field": "country",
      "type": "nominal",
      "sort": null
    }
  },
  "resolve": {
    "scale": {
      "y": "shared"
    }
  },
  "theme": {
    "colors": {
      "categorical": [
        {
          "light": "#0e7490",
          "dark": "#22a3c4"
        }
      ]
    }
  },
  "chrome": {
    "title": "China launched 28 times in 2018, one more than the US",
    "subtitle": "Launches per year by country, 1957-2018, same y scale in each panel"
  }
};
</script>

<Chart {spec} />
import { createChart } from "@opendata-ai/openchart-vanilla";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 248 rows; Copy includes them */];

const spec: ChartSpec = {
  data,
  "mark": {
    "type": "line",
    "strokeWidth": 2,
    "interpolate": "linear"
  },
  "encoding": {
    "x": {
      "field": "date",
      "type": "temporal",
      "axis": {
        "format": "%Y",
        "tickCount": 5
      }
    },
    "y": {
      "field": "launches",
      "type": "quantitative",
      "axis": {
        "tickPosition": "gutter"
      }
    },
    "row": {
      "field": "country",
      "type": "nominal",
      "sort": null
    }
  },
  "resolve": {
    "scale": {
      "y": "shared"
    }
  },
  "theme": {
    "colors": {
      "categorical": [
        {
          "light": "#0e7490",
          "dark": "#22a3c4"
        }
      ]
    }
  },
  "chrome": {
    "title": "China launched 28 times in 2018, one more than the US",
    "subtitle": "Launches per year by country, 1957-2018, same y scale in each panel"
  }
};

const container = document.getElementById("chart");
if (!container) throw new Error('Add <div id="chart"></div> to the page first.');
createChart(container, spec);

Stacking the panels in one column keeps the years aligned, so you compare timing by reading straight down the page: the US peak sits in the mid-1960s and the Soviet peak in the early 1980s.

Shared or free y scales

Panels can share one y scale, which means a given height stands for the same number in every panel. That keeps level comparisons honest and makes small series look small. In 2025 the US violent crime rate was about 330 per 100,000 residents and the homicide rate was 4.1.

All violent crime0200400600800Aggravated assault0200400600800Robbery0200400600800Homicide19902000201020200200400600800On a shared scale, homicide's fall from 9.8 to 4.1 is a flat lineUS violent crime rates per 100,000 residents, 1979-2025, same y scale in each panelAll violent crime0200400600800Aggravated assault0200400600800Robbery0200400600800Homicide19902000201020200200400600800On a shared scale, homicide's fall from 9.8 to 4.1 is a flat lineUS violent crime rates per 100,000 residents, 1979-2025, same y scale in each panel
US violent crime rates in panels, shared scale. Source: FBI Uniform Crime Reporting Program, estimated crimes in the United States.

Made with OpenChart. How to build this line chart

{
  "mark": {
    "type": "line",
    "strokeWidth": 2,
    "interpolate": "linear"
  },
  "data": [
    {
      "date": "1979-01-01",
      "crime": "All violent crime",
      "rate": 548.7
    },
    {
      "date": "1979-01-01",
      "crime": "Aggravated assault",
      "rate": 285.9
    },
    {
      "date": "1979-01-01",
      "crime": "Robbery",
      "rate": 218.3
    },
    {
      "date": "1979-01-01",
      "crime": "Homicide",
      "rate": 9.7
    },
    {
      "date": "1980-01-01",
      "crime": "All violent crime",
      "rate": 596.3
    },
    {
      "date": "1980-01-01",
      "crime": "Aggravated assault",
      "rate": 298.3
    },
    // … 182 more rows; Copy includes them
  ],
  "encoding": {
    "x": {
      "field": "date",
      "type": "temporal",
      "axis": {
        "format": "%Y",
        "values": [
          "1990-01-01",
          "2000-01-01",
          "2010-01-01",
          "2020-01-01"
        ]
      }
    },
    "y": {
      "field": "rate",
      "type": "quantitative",
      "axis": {
        "tickPosition": "gutter"
      }
    },
    "row": {
      "field": "crime",
      "type": "nominal",
      "sort": null
    }
  },
  "resolve": {
    "scale": {
      "y": "shared"
    }
  },
  "overrides": {
    "compact": {
      "encoding": {
        "x": {
          "axis": {
            "values": [
              "1990-01-01",
              "2005-01-01",
              "2020-01-01"
            ]
          }
        }
      }
    }
  },
  "theme": {
    "colors": {
      "categorical": [
        {
          "light": "#0e7490",
          "dark": "#22a3c4"
        }
      ]
    }
  },
  "chrome": {
    "title": "On a shared scale, homicide's fall from 9.8 to 4.1 is a flat line",
    "subtitle": "US violent crime rates per 100,000 residents, 1979-2025, same y scale in each panel"
  }
}
import { Chart } from "@opendata-ai/openchart-react";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 188 rows; Copy includes them */];

const spec: ChartSpec = {
  data,
  "mark": {
    "type": "line",
    "strokeWidth": 2,
    "interpolate": "linear"
  },
  "encoding": {
    "x": {
      "field": "date",
      "type": "temporal",
      "axis": {
        "format": "%Y",
        "values": [
          "1990-01-01",
          "2000-01-01",
          "2010-01-01",
          "2020-01-01"
        ]
      }
    },
    "y": {
      "field": "rate",
      "type": "quantitative",
      "axis": {
        "tickPosition": "gutter"
      }
    },
    "row": {
      "field": "crime",
      "type": "nominal",
      "sort": null
    }
  },
  "resolve": {
    "scale": {
      "y": "shared"
    }
  },
  "overrides": {
    "compact": {
      "encoding": {
        "x": {
          "axis": {
            "values": [
              "1990-01-01",
              "2005-01-01",
              "2020-01-01"
            ]
          }
        }
      }
    }
  },
  "theme": {
    "colors": {
      "categorical": [
        {
          "light": "#0e7490",
          "dark": "#22a3c4"
        }
      ]
    }
  },
  "chrome": {
    "title": "On a shared scale, homicide's fall from 9.8 to 4.1 is a flat line",
    "subtitle": "US violent crime rates per 100,000 residents, 1979-2025, same y scale in each panel"
  }
};

export function Example() {
  return <Chart spec={spec} />;
}
<script setup lang="ts">
import { Chart } from "@opendata-ai/openchart-vue";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 188 rows; Copy includes them */];

const spec: ChartSpec = {
  data,
  "mark": {
    "type": "line",
    "strokeWidth": 2,
    "interpolate": "linear"
  },
  "encoding": {
    "x": {
      "field": "date",
      "type": "temporal",
      "axis": {
        "format": "%Y",
        "values": [
          "1990-01-01",
          "2000-01-01",
          "2010-01-01",
          "2020-01-01"
        ]
      }
    },
    "y": {
      "field": "rate",
      "type": "quantitative",
      "axis": {
        "tickPosition": "gutter"
      }
    },
    "row": {
      "field": "crime",
      "type": "nominal",
      "sort": null
    }
  },
  "resolve": {
    "scale": {
      "y": "shared"
    }
  },
  "overrides": {
    "compact": {
      "encoding": {
        "x": {
          "axis": {
            "values": [
              "1990-01-01",
              "2005-01-01",
              "2020-01-01"
            ]
          }
        }
      }
    }
  },
  "theme": {
    "colors": {
      "categorical": [
        {
          "light": "#0e7490",
          "dark": "#22a3c4"
        }
      ]
    }
  },
  "chrome": {
    "title": "On a shared scale, homicide's fall from 9.8 to 4.1 is a flat line",
    "subtitle": "US violent crime rates per 100,000 residents, 1979-2025, same y scale in each panel"
  }
};
</script>

<template>
  <Chart :spec="spec" />
</template>
<script lang="ts">
import { Chart } from "@opendata-ai/openchart-svelte";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 188 rows; Copy includes them */];

const spec: ChartSpec = {
  data,
  "mark": {
    "type": "line",
    "strokeWidth": 2,
    "interpolate": "linear"
  },
  "encoding": {
    "x": {
      "field": "date",
      "type": "temporal",
      "axis": {
        "format": "%Y",
        "values": [
          "1990-01-01",
          "2000-01-01",
          "2010-01-01",
          "2020-01-01"
        ]
      }
    },
    "y": {
      "field": "rate",
      "type": "quantitative",
      "axis": {
        "tickPosition": "gutter"
      }
    },
    "row": {
      "field": "crime",
      "type": "nominal",
      "sort": null
    }
  },
  "resolve": {
    "scale": {
      "y": "shared"
    }
  },
  "overrides": {
    "compact": {
      "encoding": {
        "x": {
          "axis": {
            "values": [
              "1990-01-01",
              "2005-01-01",
              "2020-01-01"
            ]
          }
        }
      }
    }
  },
  "theme": {
    "colors": {
      "categorical": [
        {
          "light": "#0e7490",
          "dark": "#22a3c4"
        }
      ]
    }
  },
  "chrome": {
    "title": "On a shared scale, homicide's fall from 9.8 to 4.1 is a flat line",
    "subtitle": "US violent crime rates per 100,000 residents, 1979-2025, same y scale in each panel"
  }
};
</script>

<Chart {spec} />
import { createChart } from "@opendata-ai/openchart-vanilla";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 188 rows; Copy includes them */];

const spec: ChartSpec = {
  data,
  "mark": {
    "type": "line",
    "strokeWidth": 2,
    "interpolate": "linear"
  },
  "encoding": {
    "x": {
      "field": "date",
      "type": "temporal",
      "axis": {
        "format": "%Y",
        "values": [
          "1990-01-01",
          "2000-01-01",
          "2010-01-01",
          "2020-01-01"
        ]
      }
    },
    "y": {
      "field": "rate",
      "type": "quantitative",
      "axis": {
        "tickPosition": "gutter"
      }
    },
    "row": {
      "field": "crime",
      "type": "nominal",
      "sort": null
    }
  },
  "resolve": {
    "scale": {
      "y": "shared"
    }
  },
  "overrides": {
    "compact": {
      "encoding": {
        "x": {
          "axis": {
            "values": [
              "1990-01-01",
              "2005-01-01",
              "2020-01-01"
            ]
          }
        }
      }
    }
  },
  "theme": {
    "colors": {
      "categorical": [
        {
          "light": "#0e7490",
          "dark": "#22a3c4"
        }
      ]
    }
  },
  "chrome": {
    "title": "On a shared scale, homicide's fall from 9.8 to 4.1 is a flat line",
    "subtitle": "US violent crime rates per 100,000 residents, 1979-2025, same y scale in each panel"
  }
};

const container = document.getElementById("chart");
if (!container) throw new Error('Add <div id="chart"></div> to the page first.');
createChart(container, spec);

On that shared scale homicide is a flat line along the bottom, so its fall from 9.8 per 100,000 in 1991 and its climb from 2018 to 2021 both disappear. Read the 2021 point with some care: the national figures are FBI estimates, and the way police agencies reported to the FBI changed that year.

Giving each panel its own range brings homicide’s shape back.

All violent crime400500600700Aggravated assault250300350400450Robbery50100150200250Homicide199020002010202046810Homicide rose from 5.0 per 100,000 in 2018 to 6.8 in 2021US violent crime rates per 100,000 residents, 1979-2025, separate y scale in each panelAll violent crime400500600700Aggravated assault250300350400450Robbery50100150200250Homicide199020002010202046810Homicide rose from 5.0 per 100,000 in 2018 to 6.8 in 2021US violent crime rates per 100,000 residents, 1979-2025, separate y scale in each panel
Live example. Source: FBI Uniform Crime Reporting Program, estimated crimes in the United States.

Made with OpenChart. How to build this line chart

{
  "mark": {
    "type": "line",
    "strokeWidth": 2,
    "interpolate": "linear"
  },
  "data": [
    {
      "date": "1979-01-01",
      "crime": "All violent crime",
      "rate": 548.7
    },
    {
      "date": "1979-01-01",
      "crime": "Aggravated assault",
      "rate": 285.9
    },
    {
      "date": "1979-01-01",
      "crime": "Robbery",
      "rate": 218.3
    },
    {
      "date": "1979-01-01",
      "crime": "Homicide",
      "rate": 9.7
    },
    {
      "date": "1980-01-01",
      "crime": "All violent crime",
      "rate": 596.3
    },
    {
      "date": "1980-01-01",
      "crime": "Aggravated assault",
      "rate": 298.3
    },
    // … 182 more rows; Copy includes them
  ],
  "encoding": {
    "x": {
      "field": "date",
      "type": "temporal",
      "axis": {
        "format": "%Y",
        "values": [
          "1990-01-01",
          "2000-01-01",
          "2010-01-01",
          "2020-01-01"
        ]
      }
    },
    "y": {
      "field": "rate",
      "type": "quantitative",
      "axis": {
        "tickPosition": "gutter"
      }
    },
    "row": {
      "field": "crime",
      "type": "nominal",
      "sort": null
    }
  },
  "resolve": {
    "scale": {
      "y": "independent"
    }
  },
  "overrides": {
    "compact": {
      "encoding": {
        "x": {
          "axis": {
            "values": [
              "1990-01-01",
              "2005-01-01",
              "2020-01-01"
            ]
          }
        }
      }
    }
  },
  "theme": {
    "colors": {
      "categorical": [
        {
          "light": "#0e7490",
          "dark": "#22a3c4"
        }
      ]
    }
  },
  "chrome": {
    "title": "Homicide rose from 5.0 per 100,000 in 2018 to 6.8 in 2021",
    "subtitle": "US violent crime rates per 100,000 residents, 1979-2025, separate y scale in each panel"
  }
}
import { Chart } from "@opendata-ai/openchart-react";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 188 rows; Copy includes them */];

const spec: ChartSpec = {
  data,
  "mark": {
    "type": "line",
    "strokeWidth": 2,
    "interpolate": "linear"
  },
  "encoding": {
    "x": {
      "field": "date",
      "type": "temporal",
      "axis": {
        "format": "%Y",
        "values": [
          "1990-01-01",
          "2000-01-01",
          "2010-01-01",
          "2020-01-01"
        ]
      }
    },
    "y": {
      "field": "rate",
      "type": "quantitative",
      "axis": {
        "tickPosition": "gutter"
      }
    },
    "row": {
      "field": "crime",
      "type": "nominal",
      "sort": null
    }
  },
  "resolve": {
    "scale": {
      "y": "independent"
    }
  },
  "overrides": {
    "compact": {
      "encoding": {
        "x": {
          "axis": {
            "values": [
              "1990-01-01",
              "2005-01-01",
              "2020-01-01"
            ]
          }
        }
      }
    }
  },
  "theme": {
    "colors": {
      "categorical": [
        {
          "light": "#0e7490",
          "dark": "#22a3c4"
        }
      ]
    }
  },
  "chrome": {
    "title": "Homicide rose from 5.0 per 100,000 in 2018 to 6.8 in 2021",
    "subtitle": "US violent crime rates per 100,000 residents, 1979-2025, separate y scale in each panel"
  }
};

export function Example() {
  return <Chart spec={spec} />;
}
<script setup lang="ts">
import { Chart } from "@opendata-ai/openchart-vue";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 188 rows; Copy includes them */];

const spec: ChartSpec = {
  data,
  "mark": {
    "type": "line",
    "strokeWidth": 2,
    "interpolate": "linear"
  },
  "encoding": {
    "x": {
      "field": "date",
      "type": "temporal",
      "axis": {
        "format": "%Y",
        "values": [
          "1990-01-01",
          "2000-01-01",
          "2010-01-01",
          "2020-01-01"
        ]
      }
    },
    "y": {
      "field": "rate",
      "type": "quantitative",
      "axis": {
        "tickPosition": "gutter"
      }
    },
    "row": {
      "field": "crime",
      "type": "nominal",
      "sort": null
    }
  },
  "resolve": {
    "scale": {
      "y": "independent"
    }
  },
  "overrides": {
    "compact": {
      "encoding": {
        "x": {
          "axis": {
            "values": [
              "1990-01-01",
              "2005-01-01",
              "2020-01-01"
            ]
          }
        }
      }
    }
  },
  "theme": {
    "colors": {
      "categorical": [
        {
          "light": "#0e7490",
          "dark": "#22a3c4"
        }
      ]
    }
  },
  "chrome": {
    "title": "Homicide rose from 5.0 per 100,000 in 2018 to 6.8 in 2021",
    "subtitle": "US violent crime rates per 100,000 residents, 1979-2025, separate y scale in each panel"
  }
};
</script>

<template>
  <Chart :spec="spec" />
</template>
<script lang="ts">
import { Chart } from "@opendata-ai/openchart-svelte";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 188 rows; Copy includes them */];

const spec: ChartSpec = {
  data,
  "mark": {
    "type": "line",
    "strokeWidth": 2,
    "interpolate": "linear"
  },
  "encoding": {
    "x": {
      "field": "date",
      "type": "temporal",
      "axis": {
        "format": "%Y",
        "values": [
          "1990-01-01",
          "2000-01-01",
          "2010-01-01",
          "2020-01-01"
        ]
      }
    },
    "y": {
      "field": "rate",
      "type": "quantitative",
      "axis": {
        "tickPosition": "gutter"
      }
    },
    "row": {
      "field": "crime",
      "type": "nominal",
      "sort": null
    }
  },
  "resolve": {
    "scale": {
      "y": "independent"
    }
  },
  "overrides": {
    "compact": {
      "encoding": {
        "x": {
          "axis": {
            "values": [
              "1990-01-01",
              "2005-01-01",
              "2020-01-01"
            ]
          }
        }
      }
    }
  },
  "theme": {
    "colors": {
      "categorical": [
        {
          "light": "#0e7490",
          "dark": "#22a3c4"
        }
      ]
    }
  },
  "chrome": {
    "title": "Homicide rose from 5.0 per 100,000 in 2018 to 6.8 in 2021",
    "subtitle": "US violent crime rates per 100,000 residents, 1979-2025, separate y scale in each panel"
  }
};
</script>

<Chart {spec} />
import { createChart } from "@opendata-ai/openchart-vanilla";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 188 rows; Copy includes them */];

const spec: ChartSpec = {
  data,
  "mark": {
    "type": "line",
    "strokeWidth": 2,
    "interpolate": "linear"
  },
  "encoding": {
    "x": {
      "field": "date",
      "type": "temporal",
      "axis": {
        "format": "%Y",
        "values": [
          "1990-01-01",
          "2000-01-01",
          "2010-01-01",
          "2020-01-01"
        ]
      }
    },
    "y": {
      "field": "rate",
      "type": "quantitative",
      "axis": {
        "tickPosition": "gutter"
      }
    },
    "row": {
      "field": "crime",
      "type": "nominal",
      "sort": null
    }
  },
  "resolve": {
    "scale": {
      "y": "independent"
    }
  },
  "overrides": {
    "compact": {
      "encoding": {
        "x": {
          "axis": {
            "values": [
              "1990-01-01",
              "2005-01-01",
              "2020-01-01"
            ]
          }
        }
      }
    }
  },
  "theme": {
    "colors": {
      "categorical": [
        {
          "light": "#0e7490",
          "dark": "#22a3c4"
        }
      ]
    }
  },
  "chrome": {
    "title": "Homicide rose from 5.0 per 100,000 in 2018 to 6.8 in 2021",
    "subtitle": "US violent crime rates per 100,000 residents, 1979-2025, separate y scale in each panel"
  }
};

const container = document.getElementById("chart");
if (!container) throw new Error('Add <div id="chart"></div> to the page first.');
createChart(container, spec);

Free scales show whether each series rose or fell and when, and stop showing which is bigger. These panels don’t start at zero either, so a one-point change in homicide takes as much height as a change of about 37 points in robbery. Say in the subtitle which choice you made, as both crime charts do.

Use shared scales when the question is which series is larger, and free scales when the question is each series’ shape. Neither compares percent change: robbery fell 82% between 1991 and 2025 and aggravated assault 45%, and only an indexed chart or a log scale puts those on one axis.

Panel order and labels

Panel order is an editorial choice, and alphabetical order is rarely the right one. Sort by the size of each series, by when it peaked, or by the change you want the reader to notice. The launch panels run by total launches from 1957 to 2018, so the biggest program comes first. The crime panels run from the broadest category to the narrowest.

Put the series name above each frame. Use one color in every panel, because position already says which series is which, and leave out the legend.

When to split a chart into panels

Two or three lines that stay apart do not need panels. A single line chart lets the reader compare them directly, and splitting them forces an extra look back and forth. Panels start to pay off when lines overlap or cross, and I would split at about four lines.

The spec

Panels need long data: one row per panel per year, with the date, the series name and the value. encoding.row names the series field and stacks one panel per value in a single column, with the years printed under the bottom panel only. sort: null keeps the panels in the order of the data rather than alphabetical, and tickPosition: "gutter" on the y axis puts each panel’s tick labels beside it, where no line can run through them.

A row layout gives each panel its own y range unless told otherwise, so the shared charts set resolve: { scale: { y: "shared" } } and the free chart sets "independent". Apart from the title and subtitle, that is the only difference between the two crime specs. Panel axes follow the usual scale rules, so a scale.domain or zero: true on y pins every panel if you want them all to start at zero.

Wrapped grids and side-by-side panels, which suit wider screens, are on the facets page.