An SVG 3D Bar chart with custom background bars
This goes in the documents header:
<script src="RGraph.svg.common.core.js"></script>
<script src="RGraph.svg.bar.js"></script>
<script src="RGraph.svg.hbar.js"></script>
Put this where you want the chart to show up:
<div style="width: 750; height: 500px" id="chart-container"></div>
This is the code that generates the chart:
<script>
bar_data = [213,268,542,355,129,985,465,854,123,653,452,584];
hbar_data = [];
for (var i=0; i<(bar_data.length * 2); i++) {
hbar_data.push(i % 2 === 1 ? 1 : 0);
}
var hbar = new RGraph.SVG.HBar({
id: 'cc',
data: hbar_data,
options: {
vmargin: 0,
colors: ['rgba(248,248,248,1)','white'],
gutterLeft: 50,
gutterRight: 25,
gutterTop: 25,
gutterBottom: 25,
xaxis: false,
xaxisScale: false,
yaxis: false,
backgroundGrid: false
}
}).draw();
var bar = new RGraph.SVG.Bar({
id: 'cc',
data: bar_data,
options: {
gutterLeft: 75,
gutterRight: 25,
gutterTop: 25,
gutterBottom: 25,
colors: ['gradient(red:#faa)'],
yaxisMax:1200,
yaxisLabelsCount:12,
yaxis: false,
xaxisLabels: ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],
backgroundGridColor: '#eee',
backgroundGridHlinesCount: 24,
yaxisUnitsPost: 'km',
shadow: true,
shadowOpacity: 0.2
}
}).wave();
</script>