The drawing API marker2 object

Share RGraph:   
[No canvas support]

The marker2 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>
    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'],
            tooltips: ['A','B','C','D','E','F','G'],
            textAccessible: true,
            textSize: 14
        }
    }).draw()

    var x = line.coords[3][0];
    var y = line.coords[3][1];

    var marker = new RGraph.Drawing.Marker2({
        id: 'cvs',
        x: x,
        y: y,
        text: 'Note',
        options: {
            tooltips: ['<b>Note</b><br />Extra information can be displayed'],
            highlightFill: 'rgba(255,0,0,0.5)',
            shadow: false,
            textAccessible: true,
            textAccessiblePointerevents: false,
            textSize: 14
        }
    }).draw();
</script>

Properties

 

Colors

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

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

 

Text

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

textSize
The size of the text.
Default: 12

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

 

Shadow

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

shadowColor
The color of the shadow.
Default: gray

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

 

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

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

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

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

 

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
This is the color that the circle is highlighted (the stroke) in when the tooltip is shown.
Default: black

highlightFill
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 used to draw the marker.
Default: 2

voffset
This allows you to control how "high" the flag is from the bottom of the "flag pole".
Default: 20

Comments

Add a new comment...