Morris.js – 用于制作時間系列圖表的輕量級JS庫

mmp7 9年前發布 | 76K 次閱讀 Morris.js 圖表/報表制作

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']
});



項目主頁:http://www.baiduhome.net/lib/view/home/1429795017901

 本文由用戶 mmp7 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!