The drawing API

The drawing API can be used to add extra information and/or interactivity to your charts. There are various shapes and objects available from primitives (eg rect/circle) to more complex objects (eg background/axes).

[No canvas support]

The RGraph Drawing API is a new addition in September 2012 and allows you to add shapes to your charts. These shapes allow you to extend both the interactivity of and the information presented on your charts by adding shapes to them. The shapes have a very similar structure to a chart library - you create and manipulate them in the same way. As well as this they support similar interactive properties - such as tooltips, the click event and the mousemove event. This makes them very useful for providing your users with extra information - much like tooltips do by themselves - and also highlighting areas on the chart.

The source to create the chart shown is provided below.

    line = new RGraph.Line({
        id: 'cvs',
        data: [4,9,1,3,2,6,5],
        options: {
            xaxisLabels: ['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],
            marginInner: 5,
            tickmarksStyle: 'endcircle',
            marginTop: 35,
            marginBottom: 45,
            colors: ['black'],
            xaxis: false,
            yaxis: false,
            yaxisScale: false,
            textSize: 14
    marker1 = new RGraph.Drawing.Marker1({
        id: 'cvs',
        x: line.coords[3][0],
        y: line.coords[3][1],
        radius: 15,
        text: 'W',
        options: {
            tooltips: [
                '<b>Winner!</b><br />Mark sold by far the most' +
                'widgets and as a result is the winner!'
            highlightFill: 'rgba(255,0,0,0.7)'
    circle = new RGraph.Drawing.Circle({
        id: 'cvs',
        x: line.coords[2][0],
        y: line.coords[2][1], 15,
        radius: 20,
        options: {
            colorsStroke: 'black',
            colorsFill: 'rgba(255,0,0,0.7)'
    }).on('click', function (e, shape)
        alert('[NOTICE] Also worthy of note is the low point of the competition - which was wednesday')
    }).on('mousemove', function (e, shape)
    { = 'pointer';

    image = new RGraph.Drawing.Image({
        id: 'cvs',
        x: line.get('marginLeft') + 5,
        y: line.canvas.height - line.get('marginBottom') - 5,
        src: '/images/logo.png',
        options: {
            valign: 'bottom',
            tooltips: [
                '<b>Information</b><br />The image drawing object could be ' +
                'used as a method of<br />' +
                'providing more information to your users.'
            tooltipsEvent: 'onclick'