The drawing API marker1 object

Summary: The drawing API marker1 object can be added to your chart and provides a way for you to bring attention to a point or provide extra information to your users.

[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>
    var line = new RGraph.Line({
        id: 'cvs',
        data: [4,9,1,3,2,6,5],
        options: {
            xaxisLabels: ['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],
            marginInner: 5,
            colors: ['black']
        }
    }).draw();

    var marker = new RGraph.Drawing.Marker1({
        id: 'cvs',
        x: line.coords[3][0],
        y: line.coords[3][1],
        radius: 25,
        text: 'Note',
        options: {
            colorsStroke: 'pink',
            tooltips: [
                '<b>Note</b><br />The marker object can be used as a trigger for ' +
                'showing<br /> extra information'
            ],
            highlightFill: 'rgba(255,0,0,0.5)',
            align: 'center'
        }
    }).draw();
</script>

Properties

Color properties

PropertyDescriptionDefault
colorsStrokeThe color used to stroke the circle.transparent
colorsFillThe color used to fill the circle.red
colorsStroke
The color used to stroke the circle.
Default: transparent

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

Text properties

PropertyDescriptionDefault
textFontThis is the font that the text is rendered in.Arial
textSizeThe size of the text.12
textColorThe color that the text is rendered in.black
textBoldWhether the text is bold or not.false
textItalicWhether the text is italic or not.false
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

textBold
Whether the text is bold or not.
Default: false

textItalic
Whether the text is italic or not.
Default: false

Shadow properties

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
shadowBlurThe severity of the shadow blur.5
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 properties

PropertyDescriptionDefault
tooltipsThe tooltip for the circle. Even though you can only have one - this should still be an array: marker.set('tooltips', ['The tooltip']);null
tooltipsEventThis can be click or mousemove 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 the tooltip DOES NOT get hidden.false
tooltips
The tooltip for the circle. Even though you can only have one - this should still be an array: marker.set('tooltips', ['The tooltip']);
Default: null

tooltipsEvent
This can be click or mousemove 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 the tooltip DOES NOT get hidden.
Default: false

Event properties

PropertyDescriptionDefault
eventsClickIf you want to add your own click function you can do so by assigning it to this property. See here for details.null
eventsMousemoveIf you want to add your own mousemove function you can do so by assigning it to this property. See here for details.null
eventsMouseoverIf you want to add your own mouseover function you can do so by assigning it to this property. See here for details.null
eventsMouseoutIf you want to add your own mouseout function you can do so by assigning it to this property. See here for details.null
eventsClick
If you want to add your own click 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 mousemove function you can do so by assigning it to this property. See here for details.
Default: null

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

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

Miscellaneous properties

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. It's 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 used to draw the marker.2
alignYou can use this to align the marker left or right.right
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. It's 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

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