Und hier ist auch schon der Test, den Du verwenden kannst, um eine angemessene Funktion zu finden:
<DOCTYPE html>
<html lang="de">
<head>
<title>Canvas Plot Test</title>
</head>
<body>
<canvas id="plot" width="800" height="400">
<script type="text/javascript">
var plotfunc=function(x){
return Math.pow(Math.sin(x/Math.PI/20),2)*200+100;
}
var img=new Image(),
plot=document.getElementById('plot'),
plotcontext=plot.getContext('2d');
img.src='http://konfin.de/de/start.png';
img.onload=function(){
plotcontext.drawImage(img, 0,0, 800, img.height/img.width*800);
plotcontext.strokeColor='#00FF00';
plotcontext.beginPath();
for (var x=0; x<800; x++) {
if (x==0) { plotcontext.moveTo(x, plotfunc(x)); }
else { plotcontext.lineTo(x, plotfunc(x)); }
}
plotcontext.stroke();
};
</script>
</body>
</html>
Viel Spaß beim Suchen!
Gruß, LX
--
RFC 2324, Satz 7 (Sicherheit): Jeder, der zwischen meinem Kaffee und mir steht, gilt als unsicher.
RFC 2324, Satz 7 (Sicherheit): Jeder, der zwischen meinem Kaffee und mir steht, gilt als unsicher.