A combined Bar and Line chart
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.line.js"></script>
,
Put this where you want the chart to show up:
<div style="width: 650px; height: 300px" id="chart-container"></div>
This is the code that generates the chart:
<script>
new RGraph.SVG.Bar({
id: 'chart-container',
data: [[-43,14],[57,-44],[-64,-16],[56,-36],[21,-89],[-39,-41],[-78,-10]],
options: {
yaxisTextSize: 10,
yaxisLabelsCount: 10,
yaxisMin: -100,
yaxisMax: 100,
hmargin: 10,
colors: ['rgba(255,0,0,0.2)','rgba(0,200,200,0.2)'],
gutterLeft: 50,
labelsAbove: true,
labelsAboveSize: 8
}
}).draw();
new RGraph.SVG.Line({
id: 'chart-container',
data: [19,-88,71,66,93,-96,55],
options: {
spline: true,
backgroundGrid: false,
gutterLeft: 50,
yaxisMax: 100,
yaxisMin: -100,
yaxis:false,
yaxisScale: false,
xaxis: false,
hmargin: 40,
filled: true,
filledColors: ['rgba(0,200,200,0.25)'],
colors: ['#0bb'],
linewidth: 3,
tickmarksStyle: 'filledcircle',
labelsAbove: true,
labelsAboveSize: 8
}
}).draw();
</script>
« Back