...

View Full Version : problem



kunapareddy
12-04-2012, 01:21 PM
how can I build the code for graphs and pie charts in javascripts

Philip M
12-04-2012, 03:24 PM
how can I build the code for graphs and pie charts in javascripts

Google is your friend! Have you searched?

donna1
12-04-2012, 05:55 PM
do you want to write it from scratch or use a library?
I have got the hang of canvas, line and arc so can make a small demo if u want?
Here's a starter which draws a segment of a pie chart



<!DOCTYPE HTML>
<html>
<body>
<canvas id="myCanvas" width="800" height="600">>Your browser does not support the canvas tag.</canvas>
<script>
var canvas = document.getElementById('myCanvas');
var ctx = canvas.getContext('2d');

function pieSeg(x,y,r,angleRad,col){
ctx.fillStyle = col;
ctx.beginPath();
ctx.moveTo(x,y);
ctx.arc(x,y,r,0,angleRad, true);
ctx.lineTo(x,y);
ctx.closePath();
ctx.fill();
}

pieSeg(300,300,200,4,"red");
</script>
</body>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum