Important: The RGraph website has recently experienced some downtime. It's now back up and available once more but keep this in mind as you may experience errors or oddities when browsing the site.

The drawing API circle object

[No canvas support]

The circle object allows you to add a circle to your charts. You could use this as a "button" to provide extra information (with the circle tooltip) or simply to highlight a point. The circle object is very similar in function to the rect object.


Usage example

<script>
    $(document).ready(function ()
    {
        var line = new RGraph.Line({
            id: 'cvs',
            data: [4,9,1,3,2,6,5],
            options: {
                labels: ['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],
                hmargin: 5,
                tickmarks: 'endcircle',
                colors: ['black']
            }
        }).draw()
        
        var x      = line.coords[2][0]
        var y      = line.coords[2][1]
        var radius = 15;

        var circle = new RGraph.Drawing.Circle({
            id: 'cvs',
            x: x,
            y: y,
            radius: radius,
            options: {
                strokestyle: 'black',
                fillstyle: 'rgba(255,0,0,0.7)',
                tooltips: ['<b>Example</b><br />This is an example tooltip'],
                shadow: {
                    self: true,
                    offsetx: 0,
                    offsety: 0,
                    blur: 5
                },
                events: {
                    click: function (e, shape) {alert('In the click listener!');},
                    mousemove: function (e, shape) {e.target.style.cursor = 'pointer';}
                }
            }
        }).draw()
    })
</script>

Properties

 

Colors

strokestyle
The color used to stroke the circle.
Default: transparent

fillstyle
The color used to fill the circle.
Default: red

 

Shadow

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

shadow.color
The color of the shadow.
Default: gray

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

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

 

Interactive features

tooltips
The tooltip for the circle. Even though you can only have one - this should still be an array: mycircle.set('tooltips', ['The tooltip']);
Default: null

tooltips.event
This can be onclick or onmousemove and controls what event is used to trigger the tooltip.
Default: onclick

tooltips.highlight
This stipulates whether the circle will be highlighted when the tooltip is shown.
Default: true

 

Events

events.click
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

events.mousemove
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

 

Miscellaneous

highlight.stroke
This is the color that the circle is highlighted (the stroke) in when the tooltip is shown.
Default: black

highlight.fill
This is the color that the circle is highlighted in (the fill) when the tooltip is shown.
Default: rgba(255,255,255,0.7)

linewidth
This is the linewidth that is used when stroking the circle.
Default: 2