Awesome Graphs
Awesome Graphs 2.0

Radial charts, rebuilt.

The same seven charts, redrawn from scratch: sharp on retina screens, responsive, theme-aware, and animated between any two states, including before/after comparisons.

  • No dependencies
  • HiDPI & responsive
  • Animated updates
  • Light & dark

Quick start

Plain script tags. No build step, no framework.

Include the library
<script src="v2/dist/awesome-graphs.js"></script>
Add a container
<div id="weekly"></div>
Create & update
const chart = new AwesomeGraphs.SegmentRing('#weekly', {
    values: [426, 515, 140, 251, 690],
    labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri'],
});

chart.update({ values: [480, 500, 220, 251, 610] });

API

Every chart shares the same lifecycle and base options.

Methods

CallWhat it does
new AwesomeGraphs.Radar(target, options)Create a chart. target is an element, an id or a CSS selector.
AwesomeGraphs.create('radar', target, options)Same as above, by type id.
chart.update(options, { animate, duration })Merge options and animate from the current frame. Returns a promise.
chart.replay()Play the entrance animation again.
chart.render()Redraw right away, e.g. after changing CSS theme variables.
chart.destroy()Remove the canvas, observers and listeners.

Shared options

OptionDefault
max900: the value that fills a bar or arc
size320: max width in px; shrinks to fit its container
baselinenull: values to compare against (ring, gauge, combo, radar)
formatnull: (value) => string
colors{ fill, success, danger, text, muted, grid }
animation{ duration: 900, easing: 'easeOutCubic', onVisible: true }
tooltiptrue

Coming from v1

Chained setters become one options object, and buildChanged() becomes baseline, which animates too.

v1v2Notes
TypeOneSegmentRingbuild(values) → values, setLabels → labels, setHover → tooltips, setCustomTotal → total
TypeTwoArcGaugebuild(value) → value, setHover → label
TypeThreeComboRingbuild(bars, pie, polygon, score) → bars, arc, shape, score. The built-in logo is now an optional image
TypeFourRadarbuild(values) → values, setMultiplier → size
TypeFiveConcentricArcsbuild(outer, inner) → values: [outer, inner, …], any number of rings
TypeSixSegmentedDialbuild(percent) → value, zone count via segments
TypeSevenNeedleMetersetRange → range, setLimits → limits, build(value, texts, showLimits) → value, captions, showLimits