The drawing API Poly object

[No canvas support]

The Poly object (which is short for polygon) is a drawing API object which you can use to add regular or irregular shapes to your charts.

Usage example

    var bar = new RGraph.Bar({
        id: 'cvs',
        data: [4,8,6,5,6,9,9,4],
        options: {
            noaxes: true,
            gutterBottom: 45
    var poly = new RGraph.Drawing.Poly({
        id: 'cvs',
        coords: [[50,150],[75,25],[100,150]],
        options: {
            shadow: true,
            shadowColor: 'rgba(225,225,225,0.2)',
            tooltips: ['<b>The Drawing API Poly object</b>'],
            tooltipsOverride: function (obj, text, x, y, index)
                alert('[DRAWING.POLY] Poly object has been clicked!');


Layout style:     


strokestyleThe strokeStyle used to draw the shape'black'
fillstyleThe fillStyle used to draw the shape'red'

Interactive features

tooltipsThis can be array of tooltips (only the first element is used) that are shown when the axis is clicked on.null
tooltipsEventThis is the event that triggers the tooltips. It can be either onclick or onmousemove.onclick
tooltipsEffectThe effect used for showing tooltips. Can be either fade or none.fade
tooltipsCssClassThis is the name of the CSS class the chart uses.RGraph_tooltip
tooltipsOverrideIf you wish to handle showing tooltips yourself, this should be a function object which does just that. There's more information on the tooltips documentation pagenull
tooltipsNohideonclearNot an option that you'll need particularly often if at all. Setting this to true means that when you call the RGraph.clear() API function tooltip DO NOT get hidden.false


eventsClickIf you want to add your own onclick function you can do so by assigning it to this property. See here for details.null
eventsMousemoveIf you want to add your own onmousemove function you can do so by assigning it to this property. See here for details.null


shadowThis controls whether the shadow is enabled or not.false
shadowColorThe color of the shadow.rgba(0,0,0,0.2)
shadowOffsetxThe X offset that the shadow is drawn at.3
shadowOffsetyThe Y offset that the shadow is drawn at.3
shadowBlurThe severity of the shadow blur.5


highlightStyleBy default this is null but you can set it to a function if you wish so that function is called to do the chart highlighting. Its passed the shape object as an argument.null
RGraph on social media