本文介紹使用HTML5 canvas標籤搭配RGraph函式
先看一下RGraph官網介紹
Title:Build faster websites with RGraph
先看一下RGraph官網介紹
Title:Build faster websites with RGraph
內文
RGraph is a HTML5 charts library written in Javascript
that uses the HTML5 canvas tag to draw
and supports over twenty different types of charts.
RGraph is a HTML5 charts library written in Javascript
that uses the HTML5 canvas tag to draw
and supports over twenty different types of charts.
<script>
window.onload = function ()
{
var data = [5,4,1,6,8,5,3]; //data也可以是二維陣列
// Create the br chart. The arguments are the ID of the canvas tag and the data
var bar = new RGraph.Bar('cvs', data);
bar.Set('chart.labels', ['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday']); //橫座標項目
bar.Set('chart.background.barcolor1', 'white');
bar.Set('chart.background.barcolor2', 'white');
bar.Set('chart.background.grid', true); //是否顯示格線
// bar.Set('chart.colors', ['red']); //控制長條圖顏色
// Now call the .Draw() method to draw the chart
bar.Draw();
}
</script>
沒有留言:
張貼留言