Five chart types

Explore interactive tooltips, series legends and compact reporting views.

Pure SVG

Area chart

Smooth editorial traffic trend with tooltip.

01
Show code
HTML
<div class="chart" data-chart="area" data-labels='["Apr","May","Jun","Jul","Aug","Sep","Oct","Nov"]' data-series='[{"name":"Views","data":[62,78,74,91,98,108,121,142]},{"name":"Returning","data":[31,37,44,48,55,59,66,73]}]' data-height="250" data-format="compact"  role="img" aria-label="Area example chart for newsroom metrics"></div>

Line chart

Compare newsletter performance week over week.

02
Show code
HTML
<div class="chart" data-chart="line" data-labels='["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]' data-series='[{"name":"Opens","data":[32,41,39,51,48,57,61]},{"name":"Clicks","data":[10,15,12,21,19,25,27]}]' data-height="245" data-format="percent"  role="img" aria-label="Line example chart for newsroom metrics"></div>

Bar chart

See editorial output by desk or by channel.

03
Show code
HTML
<div class="chart" data-chart="bar" data-labels='["News","Business","Culture","Tech","Science","Sports"]' data-series='[{"name":"Published","data":[41,29,22,19,16,11]},{"name":"Scheduled","data":[12,7,8,8,4,5]}]' data-height="235" data-format="compact"  role="img" aria-label="Bar example chart for newsroom metrics"></div>

Stacked bars

Combine scheduled and published output.

04
Show code
HTML
<div class="chart" data-chart="bar" data-labels='["Apr","May","Jun","Jul","Aug","Sep","Oct","Nov"]' data-series='[{"name":"Web","data":[32,35,44,39,41,49,55,61]},{"name":"Newsletter","data":[14,16,18,22,25,27,28,31]}]' data-height="240" data-format="compact" data-stacked role="img" aria-label="Bar example chart for newsroom metrics"></div>

Donut chart

Audience sources share an interactive legend.

05
Show code
HTML
<div class="chart" data-chart="donut" data-labels='["Search","Direct","Social","Referral"]' data-series='[{"name":"Search","value":46},{"name":"Direct","value":29},{"name":"Social","value":16},{"name":"Referral","value":9}]' data-height="224" data-format="percent" data-center="Traffic sources" role="img" aria-label="Donut example chart for newsroom metrics"></div>

Sparkline

Dense summary cards with miniature trend lines.

06
Today's views12.8K
New subscribers248
Show code
HTML
<div class='ui-stat-row'><div class='stat'><span class='text-muted'>Today's views</span><strong class='stat-value'>12.8K</strong><div class="chart" data-chart="sparkline" data-labels='["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]' data-series='[{"name":"Views","data":[4,8,5,11,14,10,17]}]' data-height="60" data-format="compact" data-legend="false" role="img" aria-label="Sparkline example chart for newsroom metrics"></div></div><div class='stat'><span class='text-muted'>New subscribers</span><strong class='stat-value'>248</strong><div class="chart" data-chart="sparkline" data-labels='["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]' data-series='[{"name":"Subscribers","data":[5,7,6,8,9,10,12]}]' data-height="60" data-format="compact" data-legend="false" role="img" aria-label="Sparkline example chart for newsroom metrics"></div></div></div>

Chart options

No charting dependency required; all graphics use SVG and CSS theme variables.

AttributeValuePurpose
data-chartline, area, bar, donut, sparklineType of SVG visualization.
data-labelsJSON arrayX-axis labels or category names.
data-seriesJSON array of series objectsUse {name,data,color?} for line, area, bar and sparkline; use {name,value,color?} for donut.
data-heightpixelsExplicit chart height.
data-formatnumber, compact, percent, currency, durationTooltip and axis formatter.
data-stackedBoolean attributeStack bar series into one column.
data-legend="false"Boolean stringHide the series legend.
data-y-maxnumberOverride calculated axis maximum.
data-centertextCenter caption inside donut.

For dynamic updates: change data-series, then call window.NBCharts.render(element).

↑↓ to move Enter to open CtrlK to toggle