The drawing API Poly object

Share RGraph:   
[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

<script>
    var bar = new RGraph.Bar({
        id: 'cvs',
        data: [4,8,6,5,6,9,9,4],
        options: {
            noaxes: true,
            gutterBottom: 45
        }
    }).draw();
    
    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!');
            }
        }
    }).draw();
</script>

Properties

 

Colors

strokestyle
The strokeStyle used to draw the shape
Default: 'black'

fillstyle
The fillStyle used to draw the shape
Default: 'red'

 

Interactive features

tooltips
This can be array of tooltips (only the first element is used) that are shown when the axis is clicked on.
Default: null

tooltipsEvent
This is the event that triggers the tooltips. It can be either onclick or onmousemove.
Default: onclick

tooltipsEffect
The effect used for showing tooltips. Can be either fade or none.
Default: fade

tooltipsCssClass
This is the name of the CSS class the chart uses.
Default: RGraph_tooltip

tooltipsOverride
If 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 page
Default: null

tooltipsNohideonclear
Not 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.
Default: false

 

Events

eventsClick
If you want to add your own onclick function you can do so by assigning it to this property. See here for details.
Default: null

eventsMousemove
If you want to add your own onmousemove function you can do so by assigning it to this property. See here for details.
Default: null

 

Shadow

shadow
This controls whether the shadow is enabled or not.
Default: false

shadowColor
The color of the shadow.
Default: rgba(0,0,0,0.2)

shadowOffsetx
The X offset that the shadow is drawn at.
Default: 3

shadowOffsety
The Y offset that the shadow is drawn at.
Default: 3

shadowBlur
The severity of the shadow blur.
Default: 5

 

Miscellaneous

highlightStyle
By 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.
Default: null

highlightStroke

Default: rgba(0,0,0,0)

highlightFill

Default: rgba(255,255,255,0.7)

Comments

Add a new comment...