A canvas-based black Line chart
This is quite an old demo of a Line chart but it has stood up through the years very well and still looks very presentable.
It's a black Line chart with two datasets that both use custom tickmarks.
These custom tickmarks are drawn by utilising the
function. This is a function that makes drawing with the
far less verbose than it usually is.
Before drawing commences, using the
beforedraw event, the
to a plain black color. You might find this as a performance-enhancing tip
canvas performance articles though by the second frame you'll
not be drawing on a transparent
canvas - so it might be a redundant
trace Line chart effect is used here - but an options
object is passed
to the effects function call. This is just a regular
contains a single property:
As the name suggests this stipulates the number of frames in the animation.
Lower numbers make for quicker animations that finish sooner.
responsive function changes the size of the text and the margins, changes the
none and a
callback function updates a global
variable that controls the size of the custom tickmarks. The
callback function runs after
the chart has been redrawn so if you change anything here (as we're doing) then you need to redraw
the chart. That can be done by calling the
<script src="RGraph.common.core.js"></script> <script src="RGraph.line.js"></script>Put this where you want the chart to show up:
<div style="float: right"> <canvas id="cvs" width="600" height="250" style="border-radius: 5px; box-shadow: 3px 3px 3px #ccc">[No canvas support]</canvas> </div>This is the code that generates the chart - it should be placed AFTER the