An example of the drawing API X axis
This goes in the documents header:
<script src="RGraph.common.core.js"></script>
<script src="RGraph.common.dynamic.js"></script>
<script src="RGraph.common.tooltips.js"></script>
<script src="RGraph.drawing.xaxis.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:
<script>
bar = new RGraph.Bar({
id: 'cvs',
data: [4,6,8,4,5,3,7,5,4,9],
options: {
axes: false,
yaxisLabels: false,
labelsAbove: true,
colors: ['blue','blue','blue','blue','blue','red','red','red','red','red'],
colorsSequential: true,
backgroundGridBorder: false,
backgroundGridVlines: false
}
}).draw();
xaxes = new RGraph.Drawing.XAxis({
id: 'cvs',
y: bar.canvas.height - bar.get('marginBottom'),
options: {
xaxisLabels: ['Team A','Team B'],
marginLeft: 35,
marginRight: 35
}
}).on('click', function (e, obj)
{
alert('The X axis has been clicked!');
}).on('mousemove', function (e, obj)
{
return true;
}).draw();
</script>