A Bar chart with post-processing
Summary: A Bar chart that shows you that by using the draw event along with the coordinates you can do post-processing on your charts
This Bar chart uses the custom RGraph
draw event to add
highlight to each bar.
There's an SVG version of this chart in the download archive.
The highlight is added using the
draw event (which is triggered at the end of the
draw() function) so the coordinates of the bars are available.
The gradient is created using this bit of code, which uses an RGraph function for creating gradients easily:
obj.context.fillStyle = RGraph.linearGradient( obj, // The chart object 0, 0, 0, 250, // strartX, startY, endX, endY 'rgba(255,255,255,.75)', // Start color 'rgba(255,255,255,0)' // End color );
responsive() function reduces the size of the text, turns off axes and the shadow
and removes the CSS
float from the canvas tag.
This goes in the documents header:
<script src="RGraph.common.core.js"></script> <script src="RGraph.bar.js"></script>Put this where you want the chart to show up:
<canvas id="cvs" width="600" height="250"> [No canvas support] </canvas>This is the code that generates the chart: