The drawing API circle object

Share RGraph:   To help my Google visibility (it can't get much worse!), if you like and use RGraph I'd appreciate it if you could link to me
[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>
    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'],
            textAccessible: true,
            textSize: 14
        }
    }).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: true,
            shadowOffsetx: 0,
            shadowOffsety: 0,
            textAccessible: true,
            textSize: 14,
            shadowBlur: 5,
            eventsClick: function (e, shape) {alert('In the click listener!');},
            eventsMousemove: function (e, shape) {e.target.style.cursor = 'pointer';}
        }
    }).draw();
</script>

Properties

Layout style:     
  

Colors

PropertyDescriptionDefault
strokestyleThe color used to stroke the circle.transparent
fillstyleThe color used to fill the circle.red

Shadow

PropertyDescriptionDefault
shadowThis controls whether the shadow is enabled or not.false
shadowColorThe color of the shadow.gray
shadowOffsetxThe X offset that the shadow is drawn at.3
shadowOffsetyThe Y offset that the shadow is drawn at.3

Interactive features

PropertyDescriptionDefault
tooltipsThe tooltip for the circle. Even though you can only have one - this should still be an array: mycircle.set('tooltips', ['The tooltip']);null
tooltipsEventThis can be onclick or onmousemove and controls what event is used to trigger the tooltip.onclick
tooltipsHighlightThis stipulates whether the circle will be highlighted when the tooltip is shown.true
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

Events

PropertyDescriptionDefault
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
eventsMouseoverIf you want to add your own onmouseover function you can do so by assigning it to this property. See here for details.null

Miscellaneous

PropertyDescriptionDefault
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
highlightStrokeThis is the color that the circle is highlighted (the stroke) in when the tooltip is shown.black
highlightFillThis is the color that the circle is highlighted in (the fill) when the tooltip is shown.rgba(255,255,255,0.7)
linewidthThis is the linewidth that is used when stroking the circle.2

Comments

© Copyright Richard Heyes 2008-2017
Terms and conditions   Privacy policy   Sitemap   About