Charts
Pages comes bundled with two popular charting libraries: Rickshaw and NVD3. These libraries render charts in SVG format which makes them highly customizable using CSS and JS.
Rickshaw Charts
Rickshaw is a simple framework for drawing charts of time series data on a web page, built on top of Mike Bostock's delightful D3 library. These charts can be powered by static historical data sets, or living data that continuously updates in real time.
Please refer to Rickshaw Tutorial to learn more about the library
Step one
Include the plugin stylesheet rickshaw.min.css.css <head>
Step two
Include the plugin javascript file and D3 library inside the <body>
before core template script inclusions, if it's not there already.
Step three
Create the markup
Step four
Apply the plugin. This example renders a basic area chart
Step three
Add following markup to your page. Note the use of directive rickshaw
NVD3 Charts
NVD3 is an attempt to build re-usable charts and chart components for d3.js without taking away the power that d3.js gives you.
Please refer to NVD3 Tutorial to learn about the basics of the library
Step one
Include the plugin stylesheet rickshaw.min.css.css <head>
.
Step two
Include the plugin javascript files inside the <body>
before core template script inclusions, if it's not there already.
Step three
Create the markup. Apply the class line-chart
to get the Pages pre-defined style for NVD3 charts. Use data-attributes to customize the style
Available data attributes:
DATA ATTRIBUTE
AVAILABLE VALUES
DESCRIPTION
data-line-color
white | master | success | info | complete | primary | warning | danger
Change the line color of a line chart
data-area-color
white | master | success | info | complete | primary | warning | danger
Change the area color of a line chart with area option
data-points
true | false
Show/hide point circles
data-point-color
white | master | success | info | complete | primary | warning | danger
Change the point color
data-stroke-width
1 | 2 | 3
Change the stroke width of a line chart. Values are in pixels
Sparkline Charts
This jQuery plugin generates sparklines (small inline charts) directly in the browser using data supplied either inline in the HTML, or via javascript.
Please refer to Sparkline Documentation to learn more about the library
Step one
Include the plugin javascript files inside the <body>
before core template script inclusions.
Step two
Create the markup.
Step three
Apply the plugin. This example renders a basic line chart
Last updated