Morris.js – 用于制作时间系列图表的轻量级JS库
mmp7
10年前
Morris.js是一个轻量级的JS库用于创创建时间系列图表。它拥有非常简单的API来绘制曲线图,柱状图,区域图和饼图。
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'] });