Diagramme in HTML5 Canvas darstellen
Show a line plot with x axis and y axis lin, log scaling.
Der Source code dazu:
<canvas id="Chartid" width="600" height="400"> </canvas> <br>
<div id="container1">
<canvas id="Chartid1" width="100" height="50"> </canvas>
<div id="controlsidx"> </div>
<script type="text/javascript">
<!-- Begin
var x=new Array();
for (var i=0; i<20; i++) {
x[i]= i-4;
x[i+20]=i/20;
x[i+40]=5*Math.sin(x[i]);
x[i+60]=7*Math.cos(x[i]);
}
ScatterPlot("Chartid","Chartname",x,20,"xaxisname","lin","auto","yaxisname","lin","auto","nogrid");
ScatterPlot("Chartid1","Chartname",x,20,"xaxisname","lin","auto","yaxisname","lin","auto","nogrid");
// End -->
</script>
Version0 19.10.2012:
- linear plots with nice axis
- Draw marker
- log scale
ToDo:
- Formatting of large number labels
- fine grid
- log scale has 0 value point
- Only points
- Boxplot with Histogram
- Scaling text to canvas
Sizing of graphs and text
There is a screen resolution dpi
There is a screen size 8..15"
There is a browser window
There is a canvas width and font size.
How doI achieve proper scaling?