Highlighting a bar on an SVG Bar chart
This goes in the documents header:
<script src="RGraph.svg.common.core.js"></script>
<script src="RGraph.svg.common.tooltips.js"></script>
<script src="RGraph.svg.bar.js"></script>
Put this where you want the chart to show up:
<div style="padding: 15px">
<div style="width: 750px; height: 300px" id="chart-container"></div>
</div>
This is the code that generates the chart:
<script>
bar = new RGraph.SVG.Bar({
id: 'chart-container',
data: [8,5,9,3,5,2,4],
options: {
gutterTop: 50,
hmargin: 20,
xaxisLabels: ['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],
title: 'A highlighted Bar chart',
titleSubtitle: 'A chart adding highlight to one of the bars',
titleSubtitleItalic: true,
colors: ['red','pink'],
shadowOpacity: 0.2,
highlightStroke: 'black',
highlightLinewidth: 3
}
}).draw();
// Now highlight a bar on the chart
rect = bar.coords[2].object;
bar.highlight(rect);
</script>
« Back