A charting library with dependencies on jQuery and Raphael
A charting library with dependencies on jQuery and Raphael.
Example
Add a <div>
tag in the <body>
that will contain your chart:
<div id="myfirstchart" style="height: 250px;"></div>
Add a <script>
tag with the following code:
new Morris.Line({
// ID of the element in which to draw the chart.
element: 'myfirstchart',
// Chart data records -- each entry in this array corresponds to a point on
// the chart.
data: [
{year: '2008', value: 20},
{year: '2009', value: 10},
{year: '2010', value: 5},
{year: '2011', value: 5},
{year: '2012', value: 20}
],
// The name of the data record attribute that contains x-values.
xkey: 'year',
// A list of names of data record attributes that contain y-values.
ykeys: ['value'],
// Labels for the ykeys -- will be displayed when you hover over the
// chart.
labels: ['Value']
});
The result:
Supported Chart Types
- Line and area charts
- Bar charts
- Donut charts
Latest stable version
- 0.5.1 / 15 June 2014
License
- Simplified BSD License
Visit the morris.js website for examples on how to get started or Github to see the source code.