Layer Cake

Layer Cake is a graphics framework built on top of Svelte. In its basic usage, it measures your target div and your data and creates scales that stay synced on layout changes. Using its component methods, you can then use these scales to organize multiple, mostly-reusable Svelte components, whether they be SVG, HTML, Canvas or WebGL. Since they all share the same coordinate space, you can build your graphic one layer at a time.

Read the guide or here's a sample of what it looks like. See the full examples below.

  import { LayerCake, Svg, Html, Canvas } from 'layercake';

  import AxisX from './components/AxisX.svelte';
  import AxisY from './components/AxisY.svelte';
  import Line from './components/Line.svelte';
  import Scatter from './components/Scatter.svelte';
  import Labels from './components/Labels.svelte';

  const data = [{ x: 0, y: 1 }, { x: 1, y: 2 }];

  .chart-container {
    width: 100%;
    height: 500px;

<div class="chart-container">
      <Line color='#f0c'/>

      <Scatter color='#0fc'/>