Skip to content

Chart

Bar, horizontal bar, line/area and donut charts from plain markup. Each noodle draws them in its own style.

CSS + mian.js JSON Markdown Registry item

Bars

Line and area

Horizontal bars

Donut

  • Pro
  • Team
  • Free
  • Enterprise

Installation

Everything ships in one stylesheet and one small script. There is nothing to import per component.

<link rel="stylesheet" href="https://mian.ro/dist/mian.css">
<script src="https://mian.ro/dist/mian.js" defer></script>

Prefer to own the files? /r/chart.json is a registry item with this component's CSS and example markup, ready to copy into your project with any tool that reads the open registry-item format.

Class reference

Class / attributeDescription
mn-chartA <figure> wrapper with an optional <figcaption>.
mn-chart-bars · mn-barColumn chart. Set --max on the container and --v on each bar; data-value shows on hover and with the arrow keys; mn-hl highlights.
mn-chart-hHorizontal bars.
svg.mn-chart-line[data-values]Line and area chart drawn by mian.js. Add data-values-2 for a second series. Hover, touch or arrow keys show a guide line and the values at that point.
data-labels · data-names · data-unitOn the line chart: the x labels (comma-separated), the series names, and a unit for values (“€” gives €12, “k” gives 12k, “ km” gives 12 km).
mn-donut · --s1…--s4Donut. Segment sizes in percent.
mn-legendLegend list; colours follow the series order.
--mn-series-1…4Series colours. Default: primary, accent, success, warning.

Accessibility

  • Charts are images: give the figure role="img" and an aria-label that states the key numbers, or provide the data in a table next to it.
  • Colour is never the only differentiator in the legend: order and labels match the series.
Choose a noodle

Minimal

Flat

Pixel

Linear

Thin

Glass

Textured

Bold

Elegant

Rounded

On this page