The drawing API Marker3 object

Summary: The drawing API Marker3 object which is a pulsing circle and can be added to your charts and provides a way for you to give your charts extra interactivity

[No canvas support]

Usage example

<script>
    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,
            tickmarksStyle: 'endcircle',
            colors: ['black']
        }
    }).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: 'white'
        }
    }).draw();
</script>

Properties

Color properties

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

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)
        {
            RGraph.path({
                object: obj,
                  path: 'lw 10 b a % % % 0 6.29 false s black f red',
                  args: [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 in a similar way 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.

Custom RGraph events that are available

Custom RGraph events are events that RGraph fires when certain actions occur. There is a more comprehensive list of these events here . Here's some example code that show you how to add these events to your chart.

There's more documentation about events available here: Summary of events documentation

<script>
    marker3 = new RGraph.Drawing.Marker3({
        id: 'cvs',
        x: 50,
        y: 50,
        radius: 50,
        options: {
        }
    }).draw().on('click', function (e, shape)
    {
        // Add your click event listener code here

    }).on('mousemove', function (e, shape)
    {
        // Add your mousemove event listener code here

    }).on('mouseover', function (e, shape)
    {
        // Add your mouseover event listener code here

    }).on('mouseout', function (obj)
    {
        // Add your mouseout event listener code here
    });
</script>