A Bar chart with post-processing

[No canvas support]

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({
    object: obj,                  // The chart object
    x1: 0, y1: 0, x2: 0, y2: 250, // strartX, startY, endX, endY
    colors: [
        'rgba(255,255,255,.75)',  // Start color
        'rgba(255,255,255,0)'     // End color
    ]
});

The 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: