Share RGraph on Twitter Share RGraph on Google Plus Like RGraph on Facebook


The RGraph drawing API - The marker1 object

 Please remember to link to the RGraph website and give your feedback here. Thanks! 

[No canvas support]

The marker1 object allows you to add extra information to your charts in the form of markers. These markers can then give even more information in the form of tooltips or by using the event properties.


Usage example

<script>
    window.onload = function (e)
    {
        var line = new RGraph.Line('cvs', [4,9,1,3,2,6,5])
            .Set('chart.labels', ['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'])
            .Set('chart.hmargin', 5)
            .Set('chart.tickmarks', 'endcircle')
            .Set('chart.colors', ['black'])
            .Set('chart.tooltips', ['A','B','C','D','E','F','G'])
            .Draw();

        var marker = new RGraph.Drawing.Marker1('cvs', line.coords[3][0], line.coords[3][1], 21, 'Note')
            .Set('chart.tooltips', ['The marker'])
            .Set('chart.highlight.fill', 'rgba(255,0,0,0.5)')
            .Draw();
    }
</script>

Properties

Colors

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

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

Text

chart.text.font
This is the font that the text is rendered in.
Default: Arial

chart.text.size
The size of the text.
Default: 12

chart.text.color
The color that the text is rendered in.
Default: black

Shadow

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

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

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

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

chart.shadow.blur
The severity of the shadow blur.
Default: 5

Interactive features

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

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

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

Events

chart.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

chart.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

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

chart.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)

chart.linewidth
This is the linewidth used to draw the marker.
Default: 2

chart.align
You can use this to align the marker left or right.
Default: right

© Copyright RGraph licensing 2008-2013 All rights reserved. Privacy policy, Terms and conditions