How to use the drawing API X axis object

  Read comments...

Summary
A guide for using the drawing API X axis object. By using this object you can have multiple X axes on your chart (which can also be clickable or have their own tooltips).

[No canvas support]

Formerly an API function - the RGraph drawing API now supports an X axis object by which you can have multiple X axes. Now that it's a drawing API object you can now also give the X axis tooltips and it supports the chart.events.click and chart.events.mousemove properties. It uses the same .get() and .set() methods for configuration as other drawing API objects and the chart types and is automatically redrawn as necessary so you don't need to worry about this. The full list of options is shown below.


<script>
    window.onload = (function ()
    {
        var bar = new RGraph.Bar({
            id: 'cvs',
            data: [4,8,6,3,5,2,1,5,6,8],
            options: {
                labels: ['Luis','Fred','Pete','Gill','Kevin','Jack','Jill','Freda','Bill','Olga'],
                gutterBottom: 50,
                hmargin: 5,
                colors: ['Gradient(white:blue)'],
                textAccessible: true,
                textSize:14
            }
        }).draw();
    
    var xaxis = new RGraph.Drawing.XAxis({
        id: 'cvs',
        y: bar.canvas.height - 20,
        options: {
            labels: ['Team A','Team B'],
            hmargin: 5,
            tooltips: ['This X axis shows you which teams had what members.'],
            textAccessible: true,
            textSize:14
        }
    }).draw()
</script>

See also

Share RGraph
X

Comments