Components Data display

Chart

Explore the same series as a line, area, column, bar, donut, or pie chart. Inspect individual values or open the data table.

Live previewGo + JavaScript

Print circulation

January–June 2026

Total copies8,400
copies
Jan · 860 copiesFeb · 1,240 copiesMar · 1,080 copiesApr · 1,760 copiesMay · 1,420 copiesJun · 2,040 copies
Data table6 rows
Print circulation
Categorycopies
Jan860 copies
Feb1,240 copies
Mar1,080 copies
Apr1,760 copies
May1,420 copies
Jun2,040 copies

Usage

Pass Items in display order, with a Label and numeric Value for each observation. Set Type to the initial view and ShowTypes to let readers switch views.

Register chart with Head and pass its properties to Render. Go setup guide

Choosing a chart

Use line or area for an ordered series such as monthly circulation. Use column or bar to compare categories or show gains and losses around zero. Use donut or pie for shares of a positive total. Signed series and all-zero series use the Cartesian views.

Values and labels

Give each item a numeric Value for plotting. Add Unit to the chart or Display to an item for a custom value label. Set ShowTotal to true for counts or other values you want to sum. Existing horizontal bars also accept a text Value, such as "72 orders", paired with a Percent from 0 to 100.

Hover or tap a data point to inspect it. With a point focused, use the arrow keys to move between values. Select Replay chart animation to watch the current view draw again. The chart respects reduced motion. Go renders the initial view and the data table, so readers can use both with JavaScript disabled.

To compare several series or combine lines and columns, use Multi Chart.

Go usage
Go usage
err := mono.UI.Render(w, "chart", mono.Props{
	"Caption": "January–June 2026",
	"Items": []any{
		map[string]any{
			"Label": "Jan",
			"Value": 860,
		},
		map[string]any{
			"Label": "Feb",
			"Value": 1240,
		},
		map[string]any{
			"Label": "Mar",
			"Value": 1080,
		},
		map[string]any{
			"Label": "Apr",
			"Value": 1760,
		},
		map[string]any{
			"Label": "May",
			"Value": 1420,
		},
		map[string]any{
			"Label": "Jun",
			"Value": 2040,
		},
	},
	"ShowTotal": true,
	"ShowTypes": true,
	"Title":     "Print circulation",
	"Type":      "area",
	"Unit":      "copies",
})
Rendered HTML
Rendered HTML
<figure id="demo-chart" data-mono="chart" class="mu-chart" aria-labelledby="demo-chart-title">
  <figcaption class="mu-chart-mast">
    <div><h2 id="demo-chart-title">Print circulation</h2><p>January–June 2026</p></div>
    <div class="mu-chart-total"><span>Total copies</span><strong>8,400</strong></div>
  </figcaption>
  
    <div class="mu-chart-switcher" data-chart-controls role="group" aria-label="Chart type" hidden>
      <button type="button" data-chart-switch="line" aria-pressed="false"><svg class="mu-chart-icon" width="17" height="17" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">
  <path d="m2 14 5-6 4 3 7-8"/>
  
</svg><span>Line</span></button><button type="button" data-chart-switch="area" aria-pressed="true"><svg class="mu-chart-icon" width="17" height="17" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">
  <path d="m2 13 5-5 4 2 7-7v14H2z" fill="currentColor" fill-opacity=".16"/><path d="m2 13 5-5 4 2 7-7"/>
  
</svg><span>Area</span></button><button type="button" data-chart-switch="column" aria-pressed="false"><svg class="mu-chart-icon" width="17" height="17" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">
  <path d="M3 17v-6h3v6zm5.5 0V7h3v10zm5.5 0V3h3v14z" fill="currentColor" stroke="none"/>
  
</svg><span>Column</span></button><button type="button" data-chart-switch="bar" aria-pressed="false"><svg class="mu-chart-icon" width="17" height="17" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">
  <path d="M3 3h14v3H3zm0 5.5h9v3H3zM3 14h11v3H3z" fill="currentColor" stroke="none"/>
  
</svg><span>Bar</span></button><button type="button" data-chart-switch="donut" aria-pressed="false"><svg class="mu-chart-icon" width="17" height="17" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">
  <circle cx="10" cy="10" r="7.5"/><circle cx="10" cy="10" r="3.6"/><path d="M10 2.5v3.9m3.1 5.4 3.4 2"/>
  
</svg><span>Donut</span></button><button type="button" data-chart-switch="pie" aria-pressed="false"><svg class="mu-chart-icon" width="17" height="17" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">
  <path d="M9 2.7a7.4 7.4 0 1 0 8.3 8.3H9Z"/><path d="M12 2.1v6h6A7.3 7.3 0 0 0 12 2.1Z" fill="currentColor" stroke="none"/>
  
</svg><span>Pie</span></button>
    </div>
    <div class="mu-chart-body">
      <div class="mu-chart-plothead"><span>copies</span><span class="mu-chart-readout" data-chart-readout hidden><span data-chart-read-label></span><strong data-chart-read-value></strong></span><button class="mu-chart-replay" type="button" data-chart-replay hidden aria-label="Replay chart animation" title="Replay chart animation"><svg class="mu-chart-icon" width="17" height="17" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">
  <path d="M3.4 8a6.8 6.8 0 1 1 .4 5M3.4 3.4V8H8"/>
  
</svg></button></div>
      <div data-chart-view><div data-chart-type="area" class="mu-chart-plot">

  <svg class="mu-chart-cart" viewBox="0 0 640 236" width="640" height="236" role="group" aria-label="Area chart">
    <defs><pattern id="demo-chart-area-hatch" width="6" height="6" patternUnits="userSpaceOnUse"><rect class="mu-chart-area-base" width="6" height="6"/><path class="mu-chart-hatch" d="M-1 1l2-2m-2 8 8-8m-2 8 2-2"/></pattern></defs>
    <g class="mu-chart-grid" aria-hidden="true"><line x1="54" x2="620" y1="200" y2="200"/><text x="44" y="200" text-anchor="end" dy=".32em">0</text><line x1="54" x2="620" y1="163" y2="163"/><text x="44" y="163" text-anchor="end" dy=".32em">500</text><line x1="54" x2="620" y1="126" y2="126"/><text x="44" y="126" text-anchor="end" dy=".32em">1,000</text><line x1="54" x2="620" y1="89" y2="89"/><text x="44" y="89" text-anchor="end" dy=".32em">1,500</text><line x1="54" x2="620" y1="52" y2="52"/><text x="44" y="52" text-anchor="end" dy=".32em">2,000</text><line x1="54" x2="620" y1="15" y2="15"/><text x="44" y="15" text-anchor="end" dy=".32em">2,500</text></g>
    <path class="mu-chart-area" d="M54 136.36L167.2 108.24L280.4 120.08L393.6 69.76L506.8 94.92L620 49.04L620 200L54 200Z" fill="url(#demo-chart-area-hatch)"/>
    <line class="mu-chart-zero" x1="54" x2="620" y1="200" y2="200" aria-hidden="true"/>
    
      <path class="mu-chart-line" d="M54 136.36L167.2 108.24L280.4 120.08L393.6 69.76L506.8 94.92L620 49.04" pathLength="1" fill="none"/>
      <g class="mu-chart-node" data-chart-mark="0"><line x1="54" x2="54" y1="15" y2="200"/><circle cx="54" cy="136.36" r="4"/></g><g class="mu-chart-node" data-chart-mark="1"><line x1="167.2" x2="167.2" y1="15" y2="200"/><circle cx="167.2" cy="108.24" r="4"/></g><g class="mu-chart-node" data-chart-mark="2"><line x1="280.4" x2="280.4" y1="15" y2="200"/><circle cx="280.4" cy="120.08" r="4"/></g><g class="mu-chart-node" data-chart-mark="3"><line x1="393.6" x2="393.6" y1="15" y2="200"/><circle cx="393.6" cy="69.76" r="4"/></g><g class="mu-chart-node" data-chart-mark="4"><line x1="506.8" x2="506.8" y1="15" y2="200"/><circle cx="506.8" cy="94.92" r="4"/></g><g class="mu-chart-node" data-chart-mark="5"><line x1="620" x2="620" y1="15" y2="200"/><circle cx="620" cy="49.04" r="4"/></g>
    
    <g class="mu-chart-ticks" aria-hidden="true"><text x="54" y="225" text-anchor="start">Jan</text><text x="167.2" y="225" text-anchor="middle">Feb</text><text x="280.4" y="225" text-anchor="middle">Mar</text><text x="393.6" y="225" text-anchor="middle">Apr</text><text x="506.8" y="225" text-anchor="middle">May</text><text x="620" y="225" text-anchor="end">Jun</text></g>
    <rect class="mu-chart-hit" fill="transparent" data-chart-point="0" data-chart-label="Jan" data-chart-value="860 copies" aria-label="Jan, 860 copies" role="img" x="54" y="11" width="56.6" height="192"><title>Jan · 860 copies</title></rect><rect class="mu-chart-hit" fill="transparent" data-chart-point="1" data-chart-label="Feb" data-chart-value="1,240 copies" aria-label="Feb, 1,240 copies" role="img" x="110.6" y="11" width="113.2" height="192"><title>Feb · 1,240 copies</title></rect><rect class="mu-chart-hit" fill="transparent" data-chart-point="2" data-chart-label="Mar" data-chart-value="1,080 copies" aria-label="Mar, 1,080 copies" role="img" x="223.8" y="11" width="113.2" height="192"><title>Mar · 1,080 copies</title></rect><rect class="mu-chart-hit" fill="transparent" data-chart-point="3" data-chart-label="Apr" data-chart-value="1,760 copies" aria-label="Apr, 1,760 copies" role="img" x="337" y="11" width="113.2" height="192"><title>Apr · 1,760 copies</title></rect><rect class="mu-chart-hit" fill="transparent" data-chart-point="4" data-chart-label="May" data-chart-value="1,420 copies" aria-label="May, 1,420 copies" role="img" x="450.2" y="11" width="113.2" height="192"><title>May · 1,420 copies</title></rect><rect class="mu-chart-hit" fill="transparent" data-chart-point="5" data-chart-label="Jun" data-chart-value="2,040 copies" aria-label="Jun, 2,040 copies" role="img" x="563.4" y="11" width="56.6" height="192"><title>Jun · 2,040 copies</title></rect>
  </svg>

</div></div>
      <template data-chart-template="line"><div data-chart-type="line" class="mu-chart-plot">

  <svg class="mu-chart-cart" viewBox="0 0 640 236" width="640" height="236" role="group" aria-label="Line chart">
    
    <g class="mu-chart-grid" aria-hidden="true"><line x1="54" x2="620" y1="200" y2="200"/><text x="44" y="200" text-anchor="end" dy=".32em">0</text><line x1="54" x2="620" y1="163" y2="163"/><text x="44" y="163" text-anchor="end" dy=".32em">500</text><line x1="54" x2="620" y1="126" y2="126"/><text x="44" y="126" text-anchor="end" dy=".32em">1,000</text><line x1="54" x2="620" y1="89" y2="89"/><text x="44" y="89" text-anchor="end" dy=".32em">1,500</text><line x1="54" x2="620" y1="52" y2="52"/><text x="44" y="52" text-anchor="end" dy=".32em">2,000</text><line x1="54" x2="620" y1="15" y2="15"/><text x="44" y="15" text-anchor="end" dy=".32em">2,500</text></g>
    
    <line class="mu-chart-zero" x1="54" x2="620" y1="200" y2="200" aria-hidden="true"/>
    
      <path class="mu-chart-line" d="M54 136.36L167.2 108.24L280.4 120.08L393.6 69.76L506.8 94.92L620 49.04" pathLength="1" fill="none"/>
      <g class="mu-chart-node" data-chart-mark="0"><line x1="54" x2="54" y1="15" y2="200"/><circle cx="54" cy="136.36" r="4"/></g><g class="mu-chart-node" data-chart-mark="1"><line x1="167.2" x2="167.2" y1="15" y2="200"/><circle cx="167.2" cy="108.24" r="4"/></g><g class="mu-chart-node" data-chart-mark="2"><line x1="280.4" x2="280.4" y1="15" y2="200"/><circle cx="280.4" cy="120.08" r="4"/></g><g class="mu-chart-node" data-chart-mark="3"><line x1="393.6" x2="393.6" y1="15" y2="200"/><circle cx="393.6" cy="69.76" r="4"/></g><g class="mu-chart-node" data-chart-mark="4"><line x1="506.8" x2="506.8" y1="15" y2="200"/><circle cx="506.8" cy="94.92" r="4"/></g><g class="mu-chart-node" data-chart-mark="5"><line x1="620" x2="620" y1="15" y2="200"/><circle cx="620" cy="49.04" r="4"/></g>
    
    <g class="mu-chart-ticks" aria-hidden="true"><text x="54" y="225" text-anchor="start">Jan</text><text x="167.2" y="225" text-anchor="middle">Feb</text><text x="280.4" y="225" text-anchor="middle">Mar</text><text x="393.6" y="225" text-anchor="middle">Apr</text><text x="506.8" y="225" text-anchor="middle">May</text><text x="620" y="225" text-anchor="end">Jun</text></g>
    <rect class="mu-chart-hit" fill="transparent" data-chart-point="0" data-chart-label="Jan" data-chart-value="860 copies" aria-label="Jan, 860 copies" role="img" x="54" y="11" width="56.6" height="192"><title>Jan · 860 copies</title></rect><rect class="mu-chart-hit" fill="transparent" data-chart-point="1" data-chart-label="Feb" data-chart-value="1,240 copies" aria-label="Feb, 1,240 copies" role="img" x="110.6" y="11" width="113.2" height="192"><title>Feb · 1,240 copies</title></rect><rect class="mu-chart-hit" fill="transparent" data-chart-point="2" data-chart-label="Mar" data-chart-value="1,080 copies" aria-label="Mar, 1,080 copies" role="img" x="223.8" y="11" width="113.2" height="192"><title>Mar · 1,080 copies</title></rect><rect class="mu-chart-hit" fill="transparent" data-chart-point="3" data-chart-label="Apr" data-chart-value="1,760 copies" aria-label="Apr, 1,760 copies" role="img" x="337" y="11" width="113.2" height="192"><title>Apr · 1,760 copies</title></rect><rect class="mu-chart-hit" fill="transparent" data-chart-point="4" data-chart-label="May" data-chart-value="1,420 copies" aria-label="May, 1,420 copies" role="img" x="450.2" y="11" width="113.2" height="192"><title>May · 1,420 copies</title></rect><rect class="mu-chart-hit" fill="transparent" data-chart-point="5" data-chart-label="Jun" data-chart-value="2,040 copies" aria-label="Jun, 2,040 copies" role="img" x="563.4" y="11" width="56.6" height="192"><title>Jun · 2,040 copies</title></rect>
  </svg>

</div></template><template data-chart-template="column"><div data-chart-type="column" class="mu-chart-plot">

  <svg class="mu-chart-cart" viewBox="0 0 640 236" width="640" height="236" role="group" aria-label="Column chart">
    
    <g class="mu-chart-grid" aria-hidden="true"><line x1="54" x2="620" y1="200" y2="200"/><text x="44" y="200" text-anchor="end" dy=".32em">0</text><line x1="54" x2="620" y1="163" y2="163"/><text x="44" y="163" text-anchor="end" dy=".32em">500</text><line x1="54" x2="620" y1="126" y2="126"/><text x="44" y="126" text-anchor="end" dy=".32em">1,000</text><line x1="54" x2="620" y1="89" y2="89"/><text x="44" y="89" text-anchor="end" dy=".32em">1,500</text><line x1="54" x2="620" y1="52" y2="52"/><text x="44" y="52" text-anchor="end" dy=".32em">2,000</text><line x1="54" x2="620" y1="15" y2="15"/><text x="44" y="15" text-anchor="end" dy=".32em">2,500</text></g>
    
    <line class="mu-chart-zero" x1="54" x2="620" y1="200" y2="200" aria-hidden="true"/>
    
      <rect class="mu-chart-column" style="--chart-i:0" data-chart-mark="0"  x="73.67" y="136.36" width="55" height="63.64" rx="1.5"/><rect class="mu-chart-column" style="--chart-i:1" data-chart-mark="1"  x="168" y="108.24" width="55" height="91.76" rx="1.5"/><rect class="mu-chart-column" style="--chart-i:2" data-chart-mark="2"  x="262.33" y="120.08" width="55" height="79.92" rx="1.5"/><rect class="mu-chart-column" style="--chart-i:3" data-chart-mark="3"  x="356.67" y="69.76" width="55" height="130.24" rx="1.5"/><rect class="mu-chart-column" style="--chart-i:4" data-chart-mark="4"  x="451" y="94.92" width="55" height="105.08" rx="1.5"/><rect class="mu-chart-column" style="--chart-i:5" data-chart-mark="5"  x="545.33" y="49.04" width="55" height="150.96" rx="1.5"/>
    
    <g class="mu-chart-ticks" aria-hidden="true"><text x="101.17" y="225" text-anchor="middle">Jan</text><text x="195.5" y="225" text-anchor="middle">Feb</text><text x="289.83" y="225" text-anchor="middle">Mar</text><text x="384.17" y="225" text-anchor="middle">Apr</text><text x="478.5" y="225" text-anchor="middle">May</text><text x="572.83" y="225" text-anchor="middle">Jun</text></g>
    <rect class="mu-chart-hit" fill="transparent" data-chart-point="0" data-chart-label="Jan" data-chart-value="860 copies" aria-label="Jan, 860 copies" role="img" x="54" y="11" width="94.34" height="192"><title>Jan · 860 copies</title></rect><rect class="mu-chart-hit" fill="transparent" data-chart-point="1" data-chart-label="Feb" data-chart-value="1,240 copies" aria-label="Feb, 1,240 copies" role="img" x="148.33" y="11" width="94.34" height="192"><title>Feb · 1,240 copies</title></rect><rect class="mu-chart-hit" fill="transparent" data-chart-point="2" data-chart-label="Mar" data-chart-value="1,080 copies" aria-label="Mar, 1,080 copies" role="img" x="242.66" y="11" width="94.34" height="192"><title>Mar · 1,080 copies</title></rect><rect class="mu-chart-hit" fill="transparent" data-chart-point="3" data-chart-label="Apr" data-chart-value="1,760 copies" aria-label="Apr, 1,760 copies" role="img" x="337" y="11" width="94.34" height="192"><title>Apr · 1,760 copies</title></rect><rect class="mu-chart-hit" fill="transparent" data-chart-point="4" data-chart-label="May" data-chart-value="1,420 copies" aria-label="May, 1,420 copies" role="img" x="431.33" y="11" width="94.34" height="192"><title>May · 1,420 copies</title></rect><rect class="mu-chart-hit" fill="transparent" data-chart-point="5" data-chart-label="Jun" data-chart-value="2,040 copies" aria-label="Jun, 2,040 copies" role="img" x="525.66" y="11" width="94.34" height="192"><title>Jun · 2,040 copies</title></rect>
  </svg>

</div></template><template data-chart-template="bar"><div data-chart-type="bar" class="mu-chart-plot">

  <ul class="mu-chart-bars" aria-label="Horizontal bar chart">
    <li class="mu-chart-bar-row" style="--chart-i:0" data-chart-point="0" data-chart-label="Jan" data-chart-value="860 copies"  aria-label="Jan, 860 copies">
      <span class="mu-chart-bar-info"><span>Jan</span><strong>860 copies</strong></span>
      <svg class="mu-chart-bar-svg" viewBox="0 0 100 8" preserveAspectRatio="none" width="100%" height="10" aria-hidden="true"><line x1="0" x2="0" y1="0" y2="8"/><rect class="mu-chart-bar-shape" x="0" y="0" width="34.4" height="8"/></svg>
    </li><li class="mu-chart-bar-row" style="--chart-i:1" data-chart-point="1" data-chart-label="Feb" data-chart-value="1,240 copies"  aria-label="Feb, 1,240 copies">
      <span class="mu-chart-bar-info"><span>Feb</span><strong>1,240 copies</strong></span>
      <svg class="mu-chart-bar-svg" viewBox="0 0 100 8" preserveAspectRatio="none" width="100%" height="10" aria-hidden="true"><line x1="0" x2="0" y1="0" y2="8"/><rect class="mu-chart-bar-shape" x="0" y="0" width="49.6" height="8"/></svg>
    </li><li class="mu-chart-bar-row" style="--chart-i:2" data-chart-point="2" data-chart-label="Mar" data-chart-value="1,080 copies"  aria-label="Mar, 1,080 copies">
      <span class="mu-chart-bar-info"><span>Mar</span><strong>1,080 copies</strong></span>
      <svg class="mu-chart-bar-svg" viewBox="0 0 100 8" preserveAspectRatio="none" width="100%" height="10" aria-hidden="true"><line x1="0" x2="0" y1="0" y2="8"/><rect class="mu-chart-bar-shape" x="0" y="0" width="43.2" height="8"/></svg>
    </li><li class="mu-chart-bar-row" style="--chart-i:3" data-chart-point="3" data-chart-label="Apr" data-chart-value="1,760 copies"  aria-label="Apr, 1,760 copies">
      <span class="mu-chart-bar-info"><span>Apr</span><strong>1,760 copies</strong></span>
      <svg class="mu-chart-bar-svg" viewBox="0 0 100 8" preserveAspectRatio="none" width="100%" height="10" aria-hidden="true"><line x1="0" x2="0" y1="0" y2="8"/><rect class="mu-chart-bar-shape" x="0" y="0" width="70.4" height="8"/></svg>
    </li><li class="mu-chart-bar-row" style="--chart-i:4" data-chart-point="4" data-chart-label="May" data-chart-value="1,420 copies"  aria-label="May, 1,420 copies">
      <span class="mu-chart-bar-info"><span>May</span><strong>1,420 copies</strong></span>
      <svg class="mu-chart-bar-svg" viewBox="0 0 100 8" preserveAspectRatio="none" width="100%" height="10" aria-hidden="true"><line x1="0" x2="0" y1="0" y2="8"/><rect class="mu-chart-bar-shape" x="0" y="0" width="56.8" height="8"/></svg>
    </li><li class="mu-chart-bar-row" style="--chart-i:5" data-chart-point="5" data-chart-label="Jun" data-chart-value="2,040 copies"  aria-label="Jun, 2,040 copies">
      <span class="mu-chart-bar-info"><span>Jun</span><strong>2,040 copies</strong></span>
      <svg class="mu-chart-bar-svg" viewBox="0 0 100 8" preserveAspectRatio="none" width="100%" height="10" aria-hidden="true"><line x1="0" x2="0" y1="0" y2="8"/><rect class="mu-chart-bar-shape" x="0" y="0" width="81.6" height="8"/></svg>
    </li>
  </ul>

</div></template><template data-chart-template="donut"><div data-chart-type="donut" class="mu-chart-plot">

  <div class="mu-chart-radial">
    <svg class="mu-chart-wheel" width="200" height="200" viewBox="0 0 200 200" aria-hidden="true">
      <defs><mask id="demo-chart-donut-reveal" maskUnits="userSpaceOnUse" x="0" y="0" width="200" height="200"><circle class="mu-chart-radial-mask" cx="100" cy="100" r="48" transform="rotate(-90 100 100)" fill="none" stroke="white" stroke-width="98" pathLength="1"/></mask></defs>
      <g mask="url(#demo-chart-donut-reveal)"><path class="mu-chart-arc" data-chart-mark="0" data-tone="0" d="M100 12A88 88 0 0 1 127.82 16.51A88 88 0 0 1 152.78 29.59L135.39 52.79A59 59 0 0 0 118.65 44.03A59 59 0 0 0 100 41Z"><title>Jan · 860 copies (10.2%)</title></path><path class="mu-chart-arc" data-chart-mark="1" data-tone="1" d="M152.78 29.59A88 88 0 0 1 178.71 60.64A88 88 0 0 1 188 100L159 100A59 59 0 0 0 152.77 73.61A59 59 0 0 0 135.39 52.79Z"><title>Feb · 1,240 copies (14.8%)</title></path><path class="mu-chart-arc" data-chart-mark="2" data-tone="2" d="M188 100A88 88 0 0 1 180.92 134.59A88 88 0 0 1 160.81 163.61L140.77 142.64A59 59 0 0 0 154.25 123.19A59 59 0 0 0 159 100Z"><title>Mar · 1,080 copies (12.9%)</title></path><path class="mu-chart-arc" data-chart-mark="3" data-tone="3" d="M160.81 163.61A88 88 0 0 1 109.2 187.52A88 88 0 0 1 53.74 174.86L68.98 150.19A59 59 0 0 0 106.17 158.68A59 59 0 0 0 140.77 142.64Z"><title>Apr · 1,760 copies (21%)</title></path><path class="mu-chart-arc" data-chart-mark="4" data-tone="4" d="M53.74 174.86A88 88 0 0 1 22.2 141.12A88 88 0 0 1 12.09 96.05L41.06 97.35A59 59 0 0 0 47.84 127.57A59 59 0 0 0 68.98 150.19Z"><title>May · 1,420 copies (16.9%)</title></path><path class="mu-chart-arc" data-chart-mark="5" data-tone="5" d="M12.09 96.05A88 88 0 0 1 39.19 36.39A88 88 0 0 1 100 12L100 41A59 59 0 0 0 59.23 57.36A59 59 0 0 0 41.06 97.35Z"><title>Jun · 2,040 copies (24.3%)</title></path></g>
      <text class="mu-chart-hole-value" text-anchor="middle" x="100" y="102">6</text><text class="mu-chart-hole-label" text-anchor="middle" x="100" y="120">categories</text>
    </svg>
    <ul class="mu-chart-key" aria-label="Donut chart categories">
      <li data-chart-point="0" data-chart-label="Jan" data-chart-value="860 copies" aria-label="Jan, 860 copies, 10.2%"><span class="mu-chart-swatch" data-tone="0" aria-hidden="true"></span><span class="mu-chart-key-name">Jan</span><strong>860 copies</strong><small>10.2%</small></li><li data-chart-point="1" data-chart-label="Feb" data-chart-value="1,240 copies" aria-label="Feb, 1,240 copies, 14.8%"><span class="mu-chart-swatch" data-tone="1" aria-hidden="true"></span><span class="mu-chart-key-name">Feb</span><strong>1,240 copies</strong><small>14.8%</small></li><li data-chart-point="2" data-chart-label="Mar" data-chart-value="1,080 copies" aria-label="Mar, 1,080 copies, 12.9%"><span class="mu-chart-swatch" data-tone="2" aria-hidden="true"></span><span class="mu-chart-key-name">Mar</span><strong>1,080 copies</strong><small>12.9%</small></li><li data-chart-point="3" data-chart-label="Apr" data-chart-value="1,760 copies" aria-label="Apr, 1,760 copies, 21%"><span class="mu-chart-swatch" data-tone="3" aria-hidden="true"></span><span class="mu-chart-key-name">Apr</span><strong>1,760 copies</strong><small>21%</small></li><li data-chart-point="4" data-chart-label="May" data-chart-value="1,420 copies" aria-label="May, 1,420 copies, 16.9%"><span class="mu-chart-swatch" data-tone="4" aria-hidden="true"></span><span class="mu-chart-key-name">May</span><strong>1,420 copies</strong><small>16.9%</small></li><li data-chart-point="5" data-chart-label="Jun" data-chart-value="2,040 copies" aria-label="Jun, 2,040 copies, 24.3%"><span class="mu-chart-swatch" data-tone="5" aria-hidden="true"></span><span class="mu-chart-key-name">Jun</span><strong>2,040 copies</strong><small>24.3%</small></li>
    </ul>
  </div>

</div></template><template data-chart-template="pie"><div data-chart-type="pie" class="mu-chart-plot">

  <div class="mu-chart-radial">
    <svg class="mu-chart-wheel" width="200" height="200" viewBox="0 0 200 200" aria-hidden="true">
      <defs><mask id="demo-chart-pie-reveal" maskUnits="userSpaceOnUse" x="0" y="0" width="200" height="200"><circle class="mu-chart-radial-mask" cx="100" cy="100" r="48" transform="rotate(-90 100 100)" fill="none" stroke="white" stroke-width="98" pathLength="1"/></mask></defs>
      <g mask="url(#demo-chart-pie-reveal)"><path class="mu-chart-arc" data-chart-mark="0" data-tone="0" d="M100 12A88 88 0 0 1 127.82 16.51A88 88 0 0 1 152.78 29.59L100 100Z"><title>Jan · 860 copies (10.2%)</title></path><path class="mu-chart-arc" data-chart-mark="1" data-tone="1" d="M152.78 29.59A88 88 0 0 1 178.71 60.64A88 88 0 0 1 188 100L100 100Z"><title>Feb · 1,240 copies (14.8%)</title></path><path class="mu-chart-arc" data-chart-mark="2" data-tone="2" d="M188 100A88 88 0 0 1 180.92 134.59A88 88 0 0 1 160.81 163.61L100 100Z"><title>Mar · 1,080 copies (12.9%)</title></path><path class="mu-chart-arc" data-chart-mark="3" data-tone="3" d="M160.81 163.61A88 88 0 0 1 109.2 187.52A88 88 0 0 1 53.74 174.86L100 100Z"><title>Apr · 1,760 copies (21%)</title></path><path class="mu-chart-arc" data-chart-mark="4" data-tone="4" d="M53.74 174.86A88 88 0 0 1 22.2 141.12A88 88 0 0 1 12.09 96.05L100 100Z"><title>May · 1,420 copies (16.9%)</title></path><path class="mu-chart-arc" data-chart-mark="5" data-tone="5" d="M12.09 96.05A88 88 0 0 1 39.19 36.39A88 88 0 0 1 100 12L100 100Z"><title>Jun · 2,040 copies (24.3%)</title></path></g>
      
    </svg>
    <ul class="mu-chart-key" aria-label="Pie chart categories">
      <li data-chart-point="0" data-chart-label="Jan" data-chart-value="860 copies" aria-label="Jan, 860 copies, 10.2%"><span class="mu-chart-swatch" data-tone="0" aria-hidden="true"></span><span class="mu-chart-key-name">Jan</span><strong>860 copies</strong><small>10.2%</small></li><li data-chart-point="1" data-chart-label="Feb" data-chart-value="1,240 copies" aria-label="Feb, 1,240 copies, 14.8%"><span class="mu-chart-swatch" data-tone="1" aria-hidden="true"></span><span class="mu-chart-key-name">Feb</span><strong>1,240 copies</strong><small>14.8%</small></li><li data-chart-point="2" data-chart-label="Mar" data-chart-value="1,080 copies" aria-label="Mar, 1,080 copies, 12.9%"><span class="mu-chart-swatch" data-tone="2" aria-hidden="true"></span><span class="mu-chart-key-name">Mar</span><strong>1,080 copies</strong><small>12.9%</small></li><li data-chart-point="3" data-chart-label="Apr" data-chart-value="1,760 copies" aria-label="Apr, 1,760 copies, 21%"><span class="mu-chart-swatch" data-tone="3" aria-hidden="true"></span><span class="mu-chart-key-name">Apr</span><strong>1,760 copies</strong><small>21%</small></li><li data-chart-point="4" data-chart-label="May" data-chart-value="1,420 copies" aria-label="May, 1,420 copies, 16.9%"><span class="mu-chart-swatch" data-tone="4" aria-hidden="true"></span><span class="mu-chart-key-name">May</span><strong>1,420 copies</strong><small>16.9%</small></li><li data-chart-point="5" data-chart-label="Jun" data-chart-value="2,040 copies" aria-label="Jun, 2,040 copies, 24.3%"><span class="mu-chart-swatch" data-tone="5" aria-hidden="true"></span><span class="mu-chart-key-name">Jun</span><strong>2,040 copies</strong><small>24.3%</small></li>
    </ul>
  </div>

</div></template>
    </div>
    <details class="mu-chart-data"><summary><svg class="mu-chart-icon" width="17" height="17" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">
  <rect x="2.5" y="3" width="15" height="14" rx="1.8"/><path d="M3 8h14M8 8v8.5"/>
  
</svg><span>Data table</span><small>6 rows</small><svg class="mu-chart-chevron" width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.6" aria-hidden="true"><path d="m4 6 4 4 4-4"/></svg></summary>
      <table><caption class="mu-sr-only">Print circulation</caption><thead><tr><th scope="col">Category</th><th scope="col">copies</th></tr></thead><tbody><tr data-chart-row="0"><th scope="row">Jan</th><td>860 copies</td></tr><tr data-chart-row="1"><th scope="row">Feb</th><td>1,240 copies</td></tr><tr data-chart-row="2"><th scope="row">Mar</th><td>1,080 copies</td></tr><tr data-chart-row="3"><th scope="row">Apr</th><td>1,760 copies</td></tr><tr data-chart-row="4"><th scope="row">May</th><td>1,420 copies</td></tr><tr data-chart-row="5"><th scope="row">Jun</th><td>2,040 copies</td></tr></tbody></table>
    </details>
  
</figure>
Compare shares with a donut
Compare shares with a donut
err := mono.UI.Render(w, "chart", mono.Props{
	"Title": "Orders by edition",
	"Type":  "donut",
	"Unit":  "orders",
	"Items": []mono.Props{
		{"Label": "Pocket", "Value": 72},
		{"Label": "Folio", "Value": 48},
		{"Label": "Tabloid", "Value": 28},
	},
})
Plot gains and losses
Plot gains and losses
err := mono.UI.Render(w, "chart", mono.Props{
	"Title": "Net subscriptions",
	"Type":  "column",
	"Items": []mono.Props{
		{"Label": "April", "Value": 32},
		{"Label": "May", "Value": -12},
		{"Label": "June", "Value": 24},
	},
})
Go template
Go template
{{define "chart-icon" -}}
<svg class="mu-chart-icon" width="17" height="17" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">
  {{if eq . "line"}}<path d="m2 14 5-6 4 3 7-8"/>
  {{else if eq . "area"}}<path d="m2 13 5-5 4 2 7-7v14H2z" fill="currentColor" fill-opacity=".16"/><path d="m2 13 5-5 4 2 7-7"/>
  {{else if eq . "column"}}<path d="M3 17v-6h3v6zm5.5 0V7h3v10zm5.5 0V3h3v14z" fill="currentColor" stroke="none"/>
  {{else if eq . "bar"}}<path d="M3 3h14v3H3zm0 5.5h9v3H3zM3 14h11v3H3z" fill="currentColor" stroke="none"/>
  {{else if eq . "donut"}}<circle cx="10" cy="10" r="7.5"/><circle cx="10" cy="10" r="3.6"/><path d="M10 2.5v3.9m3.1 5.4 3.4 2"/>
  {{else if eq . "pie"}}<path d="M9 2.7a7.4 7.4 0 1 0 8.3 8.3H9Z"/><path d="M12 2.1v6h6A7.3 7.3 0 0 0 12 2.1Z" fill="currentColor" stroke="none"/>
  {{else if eq . "replay"}}<path d="M3.4 8a6.8 6.8 0 1 1 .4 5M3.4 3.4V8H8"/>
  {{else if eq . "table"}}<rect x="2.5" y="3" width="15" height="14" rx="1.8"/><path d="M3 8h14M8 8v8.5"/>
  {{end}}
</svg>
{{- end}}

{{define "chart-plot" -}}
<div data-chart-type="{{.Type}}" class="mu-chart-plot">
{{if eq .Type "bar"}}
  <ul class="mu-chart-bars" aria-label="Horizontal bar chart">
    {{range .Items}}<li class="mu-chart-bar-row" style="--chart-i:{{.Index}}" data-chart-point="{{.Index}}" data-chart-label="{{.Label}}" data-chart-value="{{.Display}}" {{if .Negative}}data-negative{{end}} aria-label="{{.Label}}, {{.Display}}">
      <span class="mu-chart-bar-info"><span>{{.Label}}</span><strong>{{.Display}}</strong></span>
      <svg class="mu-chart-bar-svg" viewBox="0 0 100 8" preserveAspectRatio="none" width="100%" height="10" aria-hidden="true"><line x1="{{$.ZeroX}}" x2="{{$.ZeroX}}" y1="0" y2="8"/><rect class="mu-chart-bar-shape" x="{{.BarStart}}" y="0" width="{{.BarWidth}}" height="8"/></svg>
    </li>{{end}}
  </ul>
{{else if or (eq .Type "donut") (eq .Type "pie")}}
  <div class="mu-chart-radial">
    <svg class="mu-chart-wheel" width="200" height="200" viewBox="0 0 200 200" aria-hidden="true">
      <defs><mask id="{{.ID}}-{{.Type}}-reveal" maskUnits="userSpaceOnUse" x="0" y="0" width="200" height="200"><circle class="mu-chart-radial-mask" cx="100" cy="100" r="48" transform="rotate(-90 100 100)" fill="none" stroke="white" stroke-width="98" pathLength="1"/></mask></defs>
      <g mask="url(#{{.ID}}-{{.Type}}-reveal)">{{range .Items}}{{if .Arc}}<path class="mu-chart-arc" data-chart-mark="{{.Index}}" data-tone="{{.Tone}}" d="{{.Arc}}"><title>{{.Label}} · {{.Display}} ({{.Share}})</title></path>{{end}}{{end}}</g>
      {{if eq .Type "donut"}}<text class="mu-chart-hole-value" text-anchor="middle" x="100" y="102">{{len .Items}}</text><text class="mu-chart-hole-label" text-anchor="middle" x="100" y="120">{{if eq (len .Items) 1}}category{{else}}categories{{end}}</text>{{end}}
    </svg>
    <ul class="mu-chart-key" aria-label="{{.Label}} chart categories">
      {{range .Items}}<li data-chart-point="{{.Index}}" data-chart-label="{{.Label}}" data-chart-value="{{.Display}}" aria-label="{{.Label}}, {{.Display}}, {{.Share}}"><span class="mu-chart-swatch" data-tone="{{.Tone}}" aria-hidden="true"></span><span class="mu-chart-key-name">{{.Label}}</span><strong>{{.Display}}</strong><small>{{.Share}}</small></li>{{end}}
    </ul>
  </div>
{{else}}
  <svg class="mu-chart-cart" viewBox="0 0 640 236" width="640" height="236" role="group" aria-label="{{.Label}} chart">
    {{if eq .Type "area"}}<defs><pattern id="{{.ID}}-area-hatch" width="6" height="6" patternUnits="userSpaceOnUse"><rect class="mu-chart-area-base" width="6" height="6"/><path class="mu-chart-hatch" d="M-1 1l2-2m-2 8 8-8m-2 8 2-2"/></pattern></defs>{{end}}
    <g class="mu-chart-grid" aria-hidden="true">{{range .Ticks}}<line x1="54" x2="620" y1="{{.Y}}" y2="{{.Y}}"/><text x="44" y="{{.Y}}" text-anchor="end" dy=".32em">{{.Label}}</text>{{end}}</g>
    {{if eq .Type "area"}}<path class="mu-chart-area" d="{{.Area}}" fill="url(#{{.ID}}-area-hatch)"/>{{end}}
    <line class="mu-chart-zero" x1="54" x2="620" y1="{{.ZeroY}}" y2="{{.ZeroY}}" aria-hidden="true"/>
    {{if eq .Type "column"}}
      {{range .Items}}<rect class="mu-chart-column" style="--chart-i:{{.Index}}" data-chart-mark="{{.Index}}" {{if .Negative}}data-negative{{end}} x="{{.ColumnX}}" y="{{.ColumnY}}" width="{{.ColumnWidth}}" height="{{.ColumnHeight}}" rx="1.5"/>{{end}}
    {{else}}
      <path class="mu-chart-line" d="{{.Line}}" pathLength="1" fill="none"/>
      {{range .Items}}<g class="mu-chart-node" data-chart-mark="{{.Index}}"><line x1="{{.X}}" x2="{{.X}}" y1="15" y2="200"/><circle cx="{{.X}}" cy="{{.Y}}" r="4"/></g>{{end}}
    {{end}}
    <g class="mu-chart-ticks" aria-hidden="true">{{range .Items}}{{if .AxisLabel}}<text x="{{.X}}" y="225" text-anchor="{{.Anchor}}">{{.AxisLabel}}</text>{{end}}{{end}}</g>
    {{range .Items}}<rect class="mu-chart-hit" fill="transparent" data-chart-point="{{.Index}}" data-chart-label="{{.Label}}" data-chart-value="{{.Display}}" aria-label="{{.Label}}, {{.Display}}" role="img" x="{{.HitX}}" y="11" width="{{.HitWidth}}" height="192"><title>{{.Label}} · {{.Display}}</title></rect>{{end}}
  </svg>
{{end}}
</div>
{{- end}}

{{- $chart := chartView . -}}
<figure id="{{.ID}}" data-mono="chart" class="mu-chart" aria-labelledby="{{.ID}}-title">
  <figcaption class="mu-chart-mast">
    <div><h2 id="{{.ID}}-title">{{$chart.Title}}</h2>{{with $chart.Caption}}<p>{{.}}</p>{{end}}</div>
    {{with $chart.Total}}<div class="mu-chart-total"><span>Total{{with $chart.Unit}} {{.}}{{end}}</span><strong>{{.}}</strong></div>{{end}}
  </figcaption>
  {{if $chart.Items}}
    {{if $chart.ShowTypes}}<div class="mu-chart-switcher" data-chart-controls role="group" aria-label="Chart type" hidden>
      {{range $chart.Plots}}<button type="button" data-chart-switch="{{.Type}}" aria-pressed="{{.Selected}}">{{template "chart-icon" .Type}}<span>{{.Label}}</span></button>{{end}}
    </div>{{end}}
    <div class="mu-chart-body">
      <div class="mu-chart-plothead"><span>{{or $chart.Unit "Value"}}</span><span class="mu-chart-readout" data-chart-readout hidden><span data-chart-read-label></span><strong data-chart-read-value></strong></span>{{if $chart.ShowTypes}}<button class="mu-chart-replay" type="button" data-chart-replay hidden aria-label="Replay chart animation" title="Replay chart animation">{{template "chart-icon" "replay"}}</button>{{end}}</div>
      <div data-chart-view>{{range $chart.Plots}}{{if .Selected}}{{template "chart-plot" .}}{{end}}{{end}}</div>
      {{range $chart.Plots}}{{if not .Selected}}<template data-chart-template="{{.Type}}">{{template "chart-plot" .}}</template>{{end}}{{end}}
    </div>
    <details class="mu-chart-data"><summary>{{template "chart-icon" "table"}}<span>Data table</span><small>{{len $chart.Items}} {{if eq (len $chart.Items) 1}}row{{else}}rows{{end}}</small><svg class="mu-chart-chevron" width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.6" aria-hidden="true"><path d="m4 6 4 4 4-4"/></svg></summary>
      <table><caption class="mu-sr-only">{{$chart.Title}}</caption><thead><tr><th scope="col">Category</th><th scope="col">{{or $chart.Unit "Value"}}</th></tr></thead><tbody>{{range $chart.Items}}<tr data-chart-row="{{.Index}}"><th scope="row">{{.Label}}</th><td>{{.Display}}</td></tr>{{end}}</tbody></table>
    </details>
  {{else}}<p class="mu-chart-empty">No data to display.</p>{{end}}
</figure>
Component CSS
Component CSS
.mu-chart[data-mono] {
  --chart-paper: #fff;
  --chart-ink: #191919;
  --chart-soft: #f5f5f4;
  --chart-muted: #5e5e5e;
  --chart-rule: #d7d7d5;
  --chart-grid: #c9c9c7;
  --chart-axis: #898987;
  --chart-wash: #f2f2f0;
  --chart-hatch: #a5a5a2;
  --chart-mono: ui-monospace, SFMono-Regular, Consolas, monospace;
  --chart-serif: "Iowan Old Style", Georgia, "Times New Roman", serif;
  container-type: inline-size;
  width: 100%;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--chart-ink);
  background: var(--chart-paper);
  border: 1px solid var(--chart-rule);
  border-radius: .85rem;
}
[data-theme="dark"] .mu-chart[data-mono] {
  --chart-paper: #222;
  --chart-ink: #f4f4f1;
  --chart-soft: #2c2c2b;
  --chart-muted: #bdbdbb;
  --chart-rule: #474745;
  --chart-grid: #494948;
  --chart-axis: #929290;
  --chart-wash: #30302f;
  --chart-hatch: #636361;
}
.mu-chart *, .mu-chart *::before, .mu-chart *::after { box-sizing: border-box; }
.mu-chart .mu-chart-mast {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.25rem;
  padding: clamp(1.2rem,4cqi,2.25rem) clamp(1rem,4.5cqi,2.5rem);
  color: #fafaf8;
  background: #191919;
}
[data-theme="dark"] .mu-chart .mu-chart-mast { background: #111; border-bottom: 1px solid var(--chart-rule); }
.mu-chart-mast > div { min-width: 0; }
.mu-chart .mu-chart-mast h2 {
  margin: 0;
  color: inherit;
  font: 400 clamp(1.8rem,6.1cqi,3.7rem)/1.04 var(--chart-serif);
  letter-spacing: -.065em;
  overflow-wrap: anywhere;
}
.mu-chart .mu-chart-mast p { margin: .53rem 0 0; color: #c7c7c5; font: .83rem/1.45 var(--chart-mono); }
.mu-chart .mu-chart-total { flex: 0 1 auto; padding-inline-start: clamp(.9rem,3cqi,1.8rem); border-inline-start: 1px solid #555; text-align: end; }
.mu-chart-total span, .mu-chart-plothead > span:first-child { display: block; font: 600 .66rem/1.4 var(--chart-mono); text-transform: uppercase; letter-spacing: .075em; }
.mu-chart-total span { color: #cececc; overflow-wrap: anywhere; }
.mu-chart-total strong { display: block; margin-top: .18rem; color: #fff; font: 550 clamp(1.55rem,5cqi,3.05rem)/1.03 Inter, Arial, sans-serif; letter-spacing: -.07em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.mu-chart-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  padding: .85rem clamp(.85rem,3.7cqi,2.15rem);
  border-bottom: 1px solid var(--chart-rule);
  background: var(--chart-paper);
}
.mu-chart-switcher button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .38rem;
  min-height: 2.15rem;
  padding: .28rem clamp(.44rem,1.4cqi,.85rem);
  border: 1px solid transparent;
  border-radius: .43rem;
  background: transparent;
  color: var(--chart-muted);
  font: 580 .84rem/1.28 Inter, Arial, sans-serif;
}
.mu-chart-switcher button:hover { background: var(--chart-soft); color: var(--chart-ink); }
.mu-chart-switcher button[aria-pressed="true"] { color: var(--chart-paper); background: var(--chart-ink); border-color: var(--chart-ink); }
.mu-chart-switcher button:focus-visible, .mu-chart-data summary:focus-visible { outline-offset: -4px; outline: 1.5px dashed currentColor; }
.mu-chart .mu-chart-icon, .mu-chart .mu-chart-chevron { flex: none; background: transparent; }
.mu-chart-body { padding: 1rem clamp(.65rem,3.6cqi,2rem) 1.15rem; }
.mu-chart-plothead { min-height: 1.9rem; margin-bottom: .35rem; display: flex; align-items: center; justify-content: space-between; gap: .65rem; }
.mu-chart-plothead > span:first-child { color: var(--chart-muted); }
.mu-chart-plothead > span:first-child { margin-inline-end: auto; }
.mu-chart-replay { display: grid; flex: none; place-items: center; width: 2rem; height: 2rem; border: 1px solid var(--chart-rule); border-radius: 50%; background: var(--chart-paper); color: var(--chart-ink); }
.mu-chart-replay:hover { background: var(--chart-soft); }
@media (prefers-reduced-motion: reduce) { .mu-chart-replay { display: none; } }
.mu-chart-readout { display: inline-flex; align-items: baseline; gap: .5rem; min-width: 0; max-width: 80%; padding: .3rem .55rem; border-radius: .32rem; color: var(--chart-paper); background: var(--chart-ink); font: .72rem/1.35 var(--chart-mono); }
.mu-chart-readout span, .mu-chart-readout strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mu-chart-readout strong { font-weight: 700; }
.mu-chart-plot { min-width: 0; }
.mu-chart .mu-chart-cart { display: block; width: 100%; height: auto; overflow: visible; background: transparent; }
.mu-chart-cart text { fill: var(--chart-muted); font: 12px var(--chart-mono); font-variant-numeric: tabular-nums; }
.mu-chart-grid line { stroke: var(--chart-grid); stroke-dasharray: 3 5; }
.mu-chart-zero { stroke: var(--chart-axis); }
.mu-chart-area-base { fill: var(--chart-wash); }
.mu-chart-hatch { fill: none; stroke: var(--chart-hatch); stroke-width: .9; }
.mu-chart-line { stroke: var(--chart-ink); stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; }
.mu-chart-node circle { fill: var(--chart-paper); stroke: var(--chart-ink); stroke-width: 2.2; }
.mu-chart-node line { opacity: 0; stroke: var(--chart-axis); stroke-dasharray: 2 4; }
.mu-chart-node[data-chart-active] circle { r: 6px; fill: var(--chart-ink); }
.mu-chart-node[data-chart-active] line { opacity: 1; }
.mu-chart-hit { fill: transparent; cursor: crosshair; }
.mu-chart .mu-chart-hit:focus-visible { outline: 1px dashed var(--chart-ink); outline-offset: -2px; }
.mu-chart-column { fill: var(--chart-ink); transform-box: fill-box; transform-origin: bottom; }
.mu-chart-column[data-negative] { transform-origin: top; }
.mu-chart-column[data-chart-active] { stroke: var(--chart-ink); stroke-width: 2px; fill: var(--chart-axis); }
.mu-chart .mu-chart-bars, .mu-chart .mu-chart-key { list-style: none; margin: 0; padding: 0; }
.mu-chart-bars { display: grid; gap: .62rem; }
.mu-chart-bar-row { display: grid; gap: .45rem; padding: .35rem .45rem; border-radius: .3rem; }
.mu-chart-bar-info { display: flex; align-items: baseline; justify-content: space-between; gap: .8rem; }
.mu-chart-bar-info > span, .mu-chart-key-name { font-size: .87rem; overflow-wrap: anywhere; }
.mu-chart-bar-info strong, .mu-chart-key strong { font: 600 .83rem/1.4 var(--chart-mono); overflow-wrap: anywhere; }
.mu-chart .mu-chart-bar-svg { display: block; width: 100%; height: .65rem; border-radius: 2px; background: var(--chart-soft); }
.mu-chart-bar-svg line { stroke: var(--chart-axis); vector-effect: non-scaling-stroke; }
.mu-chart-bar-shape { fill: var(--chart-ink); transform-origin: left; transform-box: fill-box; }
[data-negative] .mu-chart-bar-shape { transform-origin: right; }
.mu-chart-bar-row[data-chart-active], .mu-chart-key li[data-chart-active] { background: var(--chart-soft); }
.mu-chart-radial { display: grid; grid-template-columns: minmax(0,1fr) minmax(12rem,1.05fr); align-items: center; gap: clamp(1rem,4cqi,2.8rem); }
.mu-chart .mu-chart-wheel { display: block; margin: auto; width: min(100%,16rem); height: auto; background: transparent; }
.mu-chart-hole-value { fill: var(--chart-ink); font: 500 35px var(--chart-serif); letter-spacing: -.05em; }
.mu-chart-hole-label { fill: var(--chart-muted); font: 10px var(--chart-mono); }
.mu-chart [data-tone="0"] { --chart-tone: #222; }
.mu-chart [data-tone="1"] { --chart-tone: #949494; }
.mu-chart [data-tone="2"] { --chart-tone: #515151; }
.mu-chart [data-tone="3"] { --chart-tone: #cecece; }
.mu-chart [data-tone="4"] { --chart-tone: #747474; }
.mu-chart [data-tone="5"] { --chart-tone: #acacac; }
[data-theme="dark"] .mu-chart [data-tone="0"] { --chart-tone: #efefef; }
[data-theme="dark"] .mu-chart [data-tone="1"] { --chart-tone: #949494; }
[data-theme="dark"] .mu-chart [data-tone="2"] { --chart-tone: #b7b7b7; }
[data-theme="dark"] .mu-chart [data-tone="3"] { --chart-tone: #696969; }
[data-theme="dark"] .mu-chart [data-tone="4"] { --chart-tone: #d4d4d4; }
[data-theme="dark"] .mu-chart [data-tone="5"] { --chart-tone: #828282; }
.mu-chart-arc { fill: var(--chart-tone); stroke: var(--chart-paper); stroke-width: 1.6; transform-origin: 100px 100px; }
.mu-chart-arc[data-chart-active] { transform: scale(1.045); stroke: var(--chart-ink); }
.mu-chart-key li { display: grid; grid-template-columns: .65rem minmax(0,1fr) auto auto; align-items: baseline; gap: .55rem; padding: .5rem .35rem; border-bottom: 1px solid var(--chart-rule); }
.mu-chart-key li:last-child { border-bottom: 0; }
.mu-chart-swatch { align-self: center; width: .58rem; height: .58rem; border: 1px solid var(--chart-muted); border-radius: .12rem; background: var(--chart-tone); }
.mu-chart-key small { min-width: 3.7em; text-align: end; color: var(--chart-muted); font: .71rem/1.4 var(--chart-mono); }
.mu-chart-data { border-top: 1px solid var(--chart-rule); }
.mu-chart-data summary { display: flex; align-items: center; gap: .65rem; padding: .78rem clamp(.85rem,3.7cqi,2.15rem); list-style: none; color: var(--chart-ink); background: var(--chart-soft); font-size: .83rem; font-weight: 600; }
.mu-chart-data summary::-webkit-details-marker { display: none; }
.mu-chart-data summary small { margin-inline-start: auto; color: var(--chart-muted); font: .71rem var(--chart-mono); }
.mu-chart-data[open] .mu-chart-chevron { transform: rotate(180deg); }
.mu-chart-data table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.mu-chart-data th, .mu-chart-data td { padding: .55rem clamp(.85rem,3.7cqi,2.15rem); text-align: start; border-top: 1px solid var(--chart-rule); font-size: .82rem; overflow-wrap: anywhere; }
.mu-chart-data th { font-weight: 550; }
.mu-chart-data td, .mu-chart-data thead th:last-child { text-align: end; }
.mu-chart-data thead th { color: var(--chart-muted); }
.mu-chart-data td { font-family: var(--chart-mono); }
.mu-chart-empty { padding: 2rem; color: var(--chart-muted); }
@media (prefers-reduced-motion: no-preference) {
  [data-chart-animate] .mu-chart-line { stroke-dasharray: 1; animation: mu-chart-draw .62s cubic-bezier(.24,.63,.28,1) both; }
  [data-chart-animate] .mu-chart-area { animation: mu-chart-sweep .62s cubic-bezier(.24,.63,.28,1) both; }
  [data-chart-animate] .mu-chart-node circle { animation: mu-chart-appear .38s .1s both; }
  [data-chart-animate] .mu-chart-column { animation: mu-chart-rise .55s cubic-bezier(.2,.67,.27,1) both; }
  [data-chart-animate] .mu-chart-bar-shape { animation: mu-chart-extend .55s cubic-bezier(.2,.67,.27,1) both; }
  [data-chart-animate] :is(.mu-chart-column,.mu-chart-bar-shape) { animation-delay: min(calc(var(--chart-i, 0) * 32ms), 160ms); }
  [data-chart-animate] .mu-chart-radial-mask { stroke-dasharray: 1; animation: mu-chart-draw .67s cubic-bezier(.22,.66,.26,1) both; }
  .mu-chart-arc { transition: transform .15s ease; }
}
@keyframes mu-chart-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes mu-chart-sweep { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0); } }
@keyframes mu-chart-appear { from { opacity: 0; } to { opacity: 1; } }
@keyframes mu-chart-rise { from { transform: scaleY(.02); } to { transform: scaleY(1); } }
@keyframes mu-chart-extend { from { transform: scaleX(.02); } to { transform: scaleX(1); } }
@container (max-width: 34rem) {
  .mu-chart-cart text { font-size: 16px; }
  .mu-chart-radial { grid-template-columns: minmax(0,.88fr) minmax(0,1fr); gap: .65rem; }
  .mu-chart-switcher { gap: .25rem; }
  .mu-chart-switcher button { min-height: 2.35rem; }
}
@container (max-width: 26rem) {
  .mu-chart-mast { gap: .65rem; }
  .mu-chart .mu-chart-mast p { font-size: .72rem; }
  .mu-chart-switcher { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); }
  .mu-chart-switcher button { justify-content: flex-start; }
  .mu-chart-cart text { font-size: 19px; }
  .mu-chart-radial { grid-template-columns: 1fr; }
  .mu-chart .mu-chart-wheel { max-width: 12rem; }
  .mu-chart .mu-chart-key { width: 100%; }
}
@media (forced-colors: active) {
  .mu-chart-line, .mu-chart-node circle, .mu-chart-arc { stroke: CanvasText; }
  .mu-chart-column, .mu-chart-bar-shape { fill: CanvasText; }
  .mu-chart-switcher button[aria-pressed="true"], .mu-chart-bar-row[data-chart-active] { outline: 2px solid Highlight; }
}
JavaScript module
JavaScript module
export function mount(root) {
  const stage = root.querySelector('[data-chart-view]');
  let graph = stage?.querySelector('[data-chart-type]');
  if (!graph) return;

  // Only one SVG is attached at a time. Reinsert the Go-rendered graphs so
  // changing type needs neither a geometry library nor a network request.
  const graphs = new Map([[graph.dataset.chartType, graph]]);
  for (const template of root.querySelectorAll('template[data-chart-template]')) {
    const alternative = template.content.firstElementChild;
    if (alternative && !graphs.has(template.dataset.chartTemplate)) {
      graphs.set(template.dataset.chartTemplate, alternative);
    }
  }

  const controls = root.querySelector('[data-chart-controls]');
  const buttons = [...root.querySelectorAll('button[data-chart-switch]')];
  const replay = root.querySelector('[data-chart-replay]');
  const readout = root.querySelector('[data-chart-readout]');
  const label = readout?.querySelector('[data-chart-read-label]');
  const value = readout?.querySelector('[data-chart-read-value]');
  let points = [];
  let byIndex = new Map();
  let marks = new Map();
  let active = null;
  let tabStop = null;

  function show(point) {
    if (point === active) return;
    for (const node of marks.get(active?.dataset.chartPoint) || []) {
      node.removeAttribute('data-chart-active');
    }
    active = point;
    if (readout) readout.hidden = !point;
    if (!point) return;
    for (const node of marks.get(point.dataset.chartPoint)) node.setAttribute('data-chart-active', '');
    if (label) label.textContent = point.dataset.chartLabel;
    if (value) value.textContent = point.dataset.chartValue;
  }

  function findPoint(target) {
    if (!target?.closest || !graph.contains(target)) return null;
    const node = target.closest('[data-chart-point], [data-chart-mark]');
    return node ? byIndex.get(node.dataset.chartPoint ?? node.dataset.chartMark) || null : null;
  }

  function indexGraph() {
    points = [...graph.querySelectorAll('[data-chart-point]')];
    byIndex = new Map();
    marks = new Map();
    tabStop = points[0];
    for (const point of points) {
      byIndex.set(point.dataset.chartPoint, point);
      marks.set(point.dataset.chartPoint, [point]);
      point.setAttribute('tabindex', point === tabStop ? '0' : '-1');
      if (!point.hasAttribute('aria-label')) {
        point.setAttribute('aria-label', point.dataset.chartLabel + ', ' + point.dataset.chartValue);
      }
    }
    for (const marker of graph.querySelectorAll('[data-chart-mark]')) {
      if (!marker.hasAttribute('data-chart-point')) marks.get(marker.dataset.chartMark)?.push(marker);
    }
    for (const button of buttons) {
      button.setAttribute('aria-pressed', String(button.dataset.chartSwitch === graph.dataset.chartType));
    }
  }

  function switchType(type) {
    const next = graphs.get(type);
    if (!next || next === graph) return;
    show(null);
    graph.replaceWith(next);
    graph = next;
    indexGraph();
    stage.setAttribute('data-chart-animate', '');
  }

  controls?.addEventListener('click', event => {
    const button = event.target.closest('button[data-chart-switch]');
    if (button) switchType(button.dataset.chartSwitch);
  });
  stage.addEventListener('pointerover', event => {
    const point = findPoint(event.target);
    if (point) show(point);
  });
  stage.addEventListener('pointerout', event => {
    if (!findPoint(event.relatedTarget)) show(findPoint(root.ownerDocument.activeElement));
  });
  stage.addEventListener('click', event => {
    const point = findPoint(event.target);
    if (point) {
      point.focus({preventScroll: true});
      show(point);
    }
  });
  stage.addEventListener('focusin', event => {
    const point = findPoint(event.target);
    if (!point) return;
    tabStop?.setAttribute('tabindex', '-1');
    tabStop = point;
    point.setAttribute('tabindex', '0');
    show(point);
  });
  stage.addEventListener('focusout', event => {
    if (!findPoint(event.relatedTarget)) show(null);
  });
  stage.addEventListener('keydown', event => {
    if (event.ctrlKey || event.metaKey || event.altKey) return;
    const point = findPoint(event.target);
    if (!point) return;
    if (event.key === 'Escape') { show(null); return; }
    const index = points.indexOf(point);
    let next;
    switch (event.key) {
      case 'ArrowRight': case 'ArrowDown': next = Math.min(index + 1, points.length - 1); break;
      case 'ArrowLeft': case 'ArrowUp': next = Math.max(0, index - 1); break;
      case 'Home': next = 0; break;
      case 'End': next = points.length - 1; break;
      default: return;
    }
    event.preventDefault();
    points[next].focus();
    show(points[next]);
  });

  indexGraph();
  if (controls && graphs.size > 1) controls.hidden = false;
  if (replay && points.length) {
    replay.hidden = false;
    replay.addEventListener('click', () => {
      stage.removeAttribute('data-chart-animate');
      // Commit the rest state before requesting a fresh CSS animation.
      void stage.offsetWidth;
      stage.setAttribute('data-chart-animate', '');
    });
  }
  // Run the entrance once as the plot comes into view. Reduced motion is
  // handled by CSS, including preference changes while the page is open.
  if (typeof IntersectionObserver === 'function') {
    const observer = new IntersectionObserver(entries => {
      if (!entries.some(entry => entry.isIntersecting)) return;
      stage.setAttribute('data-chart-animate', '');
      observer.disconnect();
    });
    observer.observe(stage);
  } else stage.setAttribute('data-chart-animate', '');
}
Use the HTML in a static site

Copy the rendered HTML above. Download these assets into the same folder as your page, then add the tags below to its head.

Shared CSS Component CSS Ready-to-use module

HTML head
<link rel="stylesheet" href="./base.css">
<link rel="stylesheet" href="./chart.css">
<script type="module" src="./chart.js"></script>

Copy into your project

Run this command from the Mono checkout. Set -out to the component directory in your application.

Terminal
go run ./cmd/mono-ui add -out ./components chart
Example properties (JSON)
example.json
{
  "Caption": "January–June 2026",
  "Items": [
    {
      "Label": "Jan",
      "Value": 860
    },
    {
      "Label": "Feb",
      "Value": 1240
    },
    {
      "Label": "Mar",
      "Value": 1080
    },
    {
      "Label": "Apr",
      "Value": 1760
    },
    {
      "Label": "May",
      "Value": 1420
    },
    {
      "Label": "Jun",
      "Value": 2040
    }
  ],
  "ShowTotal": true,
  "ShowTypes": true,
  "Title": "Print circulation",
  "Type": "area",
  "Unit": "copies"
}