CDN and plain HTML
html
<script src="https://nervurejs.github.io/nervure.min.js"></script>
<div id="chart" style="height: 300px"></div>
<script>
nervure.createChart(document.getElementById('chart'), {
type: 'treemap',
data: [{ name: 'Bread', value: 48 }, { name: 'Fruit', value: 36 }, { name: 'Cheese', value: 27 }],
});
</script>The web component is included:
html
<nervure-chart style="height: 300px" spec='{"type":"gauge","value":64}'></nervure-chart>In production, name a version: the file never changes.
html
<script src="https://cdn.jsdelivr.net/npm/nervure@0.14.0"></script>
<script src="https://unpkg.com/nervure@0.14.0"></script>Live data is included too: nervure.live, nervure.poll, nervure.events, nervure.socket and nervure.append, and so are createDashboard and loadMap.
The made-up data of every chart sits in a second file, so the main one stays lighter. Load it after the first one and nervure.sample(kind, seed) and the dashboard templates (nervure.template(name)) are there:
html
<script src="https://cdn.jsdelivr.net/npm/nervure@0.14.0/cdn/nervure.samples.min.js"></script>To draw Mermaid text with nervure, load the Mermaid reader after the first file: nervure.fromMermaid(text) gives a chart spec, or null when the text is not one nervure reads (see Mermaid).
html
<script src="https://cdn.jsdelivr.net/npm/nervure@0.14.0/cdn/nervure.mermaid.min.js"></script>