The Marker3 object


Usage example

View example on CodePen
<script>
    line = new RGraph.Line({
        id: 'cvs',
        data: [4,9,1,3,2,6,5],
        options: {
            spline: true,
            backgroundGridVlines:false,
            backgroundGridBorder:false,
            xaxis: false,
            yaxis: false,
            xaxisLabels: ['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],
            marginInner: 5,
            tickmarksStyle: 'endcircle',
            tickmarksSize: 10,
            colors: ['black'],
            textSize: 16
        }
    }).draw();

    x      = line.coords[2][0];
    y      = line.coords[2][1];
    radius = 25;

    marker3 = new RGraph.Drawing.Marker3({
        id: 'cvs',
        x: x,
        y: y,
        radius: radius,
        options: {
            colorsFill: 'green'
        }
    }).draw();
</script>

Properties

Color properties

PropertyDescriptionDefault
colorsFillThe color used to fill the circle.white
colorsFill
The color used to fill the circle.
Default: white

Other text properties

PropertyDescriptionDefault
textAccessibleA new feature in 2016 that allows you to use dom text in place of canvas text. It makes for much higher quality text that you can also select if desired (for copy/paste operations). It won't fit all situations and you can read more about the DOM text feature here. A good way to control borders/margins/padding etc is not to set them on the canvas but to wrap the canvas in a div and set them on that like this:
<div style="margin-left: 50px; display: inline-block">
    <canvas id="cvs" width="650" height="250"></canvas>
</div>
false
textThis allows you to add custom text to your chart if you want to. There's a dedicated page that describes this option here.null
textAccessible
A new feature in 2016 that allows you to use dom text in place of canvas text. It makes for much higher quality text that you can also select if desired (for copy/paste operations). It won't fit all situations and you can read more about the DOM text feature here. A good way to control borders/margins/padding etc is not to set them on the canvas but to wrap the canvas in a div and set them on that like this:
<div style="margin-left: 50px; display: inline-block">
    <canvas id="cvs" width="650" height="250"></canvas>
</div>

Default: false

text
This allows you to add custom text to your chart if you want to. There's a dedicated page that describes this option here.
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
highlightFillThis is the color that the circle is highlighted in (the fill) when the tooltip is shown. Because this Marker is animated and is constantly being redrawn this setting doesn't have a visible effect.rgba(255,255,255,0.7)
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

highlightFill
This is the color that the circle is highlighted in (the fill) when the tooltip is shown. Because this Marker is animated and is constantly being redrawn this setting doesn't have a visible effect.
Default: rgba(255,255,255,0.7)

Methods

obj.get(name)
An accessor that you can use to retrieve the values of properties.

obj.set(name, value)
An accessor that you can use to set the values of properties.

obj.getShape(event)
This method makes it easy to get hold of the marker when it has been clicked on or hovered over. It returns an object which has the following indexes available:
object The chart object.
x The center X coordinate of the marker.
y The center Y coordinate of the marker.
radius The radius of the marker.
dataset As there's only ever one element this is always zero.
index As there's only ever one element this is always zero.
sequentialIndex As there's only ever one element this is always zero.
tooltip If a tooltip is associated with the Marker3 object this will be it.id: strings are expanded for you (where the tooltip text is retrieved from the html tag with the matching ID).
Remember the Marker3 is animated so any drawing that you do on the marker will be cleared when the canvas is redrawn.
<script>
    marker3.onclick = function (e, shape)
    {
        marker3.on('draw',  function (obj)
        {
            obj.path(
                'lw 10 b a % % % 0 6.29 false s black f red',
                shape.x, shape.y, shape.radius
            );
        });
    }
</script>

obj.on(event, function)

This method can be used to set an event listener on an object. It operates similarly to the jquery on function. The first argument is the event that you wish to attach to and the second is the handler function. For example:

obj.on('draw', function (obj)
{
    // Put your event code here
});

The function is useful if you use method chaining when creating your charts:

obj = new RGraph.Drawing.Marker3({
    id: 'cvs',
}).on('draw', function (obj)
{
    // Put your draw event code here

}).on('click', function (e, shape)
{
    // Handle the click event

}).draw();

obj.exec(function)

The exec function is documented here.