-
Notifications
You must be signed in to change notification settings - Fork 473
Chart Types
We currently support three three chart types, with a fourth that we'll be adding soon.
1. Line charts: these are the most common and extensive types of charts we make, so we invested a bit of time in covering all the use cases we encounter.
2. Histograms: we use histograms a fair bit in some projects, and so v0.3 will see the introduction of histograms a new chart type.
3. Scatterplots: Scatterplots are useful, though not necessarily as common for us as the line chart. We have a basic scatterplot chart type, which we will be extending in v0.4.
4. Quantile plots: Quantile plots arise fairly commonly for us. We are often in the position of figuring out how distributions change over time.
We have a clean way of separating out code that is common to constructing charts from code that is idiosyncratic. This makes our framework extensible, allowing us to easily add new chart types. Each chart type in metrics-graphics.js has four functions:
- init: Precomputes data if necessary and builds the chart's axes. It also takes care of cleanly updating an existing chart if it is repopulated with data
- mainPlot: Constructs the chart area in the target container and populates it with data
- markers: Adds any annotations and baselines that may have been specified
- rollover: Specifies the rollover functionality for elements by in turn calling rolloverOn and rolloverOff
Building a chart type is hence as easy as this
charts.point(args).markers().mainPlot().rollover();