Activity meter API reference

Summary: Documentation about the Activity meter including information about all of the options that are available to you. This chart was formerly a variant of the Pie chart but has now been promoted to its own chart type.

Example

[No canvas support]
<script>
    activity = new RGraph.Activity({
        id: 'cvs',
        min: 0,
        max: 100,
        value: [12,38,65],
        options: {
            width: 30,
            labelsCenter: true,
            marginLeft: 5,
            marginRight: 5,
            marginTop: 5,
            marginBottom: 5
        }
    }).grow();
    

    setInterval(function ()
    {
        for (var i=0,rand=[]; i<3; ++i) {
            rand[i] = RGraph.random(-10,10);
            activity.value[i] += rand[i];
        }
    
        activity.grow();
    },2500);
</script>

Properties

You can use these properties to control how the chart appears. You can set them by including them in the options section of the configuration as above.

Chart configuration properties

PropertyDescriptionDefault
centerxThe X coordinate of the meter.null (the horizontal center of the canvas)
centeryThe Y coordinate of the meter.null (the vertical center of the canvas)
radiusThe radius of the chart.null (this is generated based on the size of the canvas)
widthThis is the width of the circular bars that make up the chart.null
centerx
The X coordinate of the meter.
Default: null (the horizontal center of the canvas)

centery
The Y coordinate of the meter.
Default: null (the vertical center of the canvas)

radius
The radius of the chart.
Default: null (this is generated based on the size of the canvas)

width
This is the width of the circular bars that make up the chart.
Default: null

Margin properties

PropertyDescriptionDefault
marginLeftThe left margin of the chart.15
marginRightThe right margin of the chart.15
marginTopThe top margin of the chart.15
marginBottomThe bottom margin of the chart.15
marginInnerThe margin either side of the indicator bar.1
marginLeft
The left margin of the chart.
Default: 15

marginRight
The right margin of the chart.
Default: 15

marginTop
The top margin of the chart.
Default: 15

marginBottom
The bottom margin of the chart.
Default: 15

marginInner
The margin either side of the indicator bar.
Default: 1

Background properties

PropertyDescriptionDefault
backgroundGridColorThe color of the background grid.#666
backgroundGridCirclesWhether the background grid circular lines are enabled.false
backgroundGridCirclesCountThe number of background grid circular lines. By default this number is dependent on how many values you're showing on the chart.null
backgroundGridRadialsWhether the background grid radial lines are enabled (the lines that emanate from the center and go outwards).true
backgroundGridRadialsCountThe number of background grid radial lines. 8
backgroundRingsWhether the background rings are drawn. These are the rings which serve as backgrounds to the bars.true
backgroundRingsColorsIf you wish you can stipulate the exact colors for the background rings with this property..null
backgroundRingsAlphaThe alpha value (ie the transparency) of the colors of the background rings.0.5
backgroundGridColor
The color of the background grid.
Default: #666

backgroundGridCircles
Whether the background grid circular lines are enabled.
Default: false

backgroundGridCirclesCount
The number of background grid circular lines. By default this number is dependent on how many values you're showing on the chart.
Default: null

backgroundGridRadials
Whether the background grid radial lines are enabled (the lines that emanate from the center and go outwards).
Default: true

backgroundGridRadialsCount
The number of background grid radial lines.
Default: 8

backgroundRings
Whether the background rings are drawn. These are the rings which serve as backgrounds to the bars.
Default: true

backgroundRingsColors
If you wish you can stipulate the exact colors for the background rings with this property..
Default: null

backgroundRingsAlpha
The alpha value (ie the transparency) of the colors of the background rings.
Default: 0.5

Color properties

PropertyDescriptionDefault
backgroundColorThe background color of the canvas.black
colorsThe colors of the indicator bars. These can be solid colors or gradients.[#f45b5b, #90ee7e, #2b908f, red, green, blue, yellow, pink]
backgroundColor
The background color of the canvas.
Default: black

colors
The colors of the indicator bars. These can be solid colors or gradients.
Default: [#f45b5b, #90ee7e, #2b908f, red, green, blue, yellow, pink]

Labels and 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>
true
textAccessibleOverflowThis can be visible or hidden and it controls whether the text is clipped to the edges of the canvas. It defaults to be visible and means you can set small margins if you wish.visible
textAccessiblePointereventsThis controls whether the DOM text responds to mouse based events or not (it sets the pointer-events CSS property to none).true
textFontThe font used to render the text.Arial, Verdana, sans-serif
textColorThe color of the label.#aaa
textSizeThe size of the text (in points).12
textBoldWhether text on the chart is bold or not.false
textItalicWhether text on the chart is italic or not.false
labelsLabels are placed to the left of the start of the bars (at the top middle). You can also give this option a string if you prefer and use formatted labels[] (an empty array)
labelsFontThe font used by the labels. null
labelsSizeThe size of the labels.null
labelsColorThe color of the labels.null
labelsBoldWhether the labels are bold or not.null
labelsItalicWhether the labels are italic or not.null
labelsBackgroundFillWith this you can give a color for the background fill to the labels.null
labelsBackgroundStrokeWith this you can give a color for the background stroke to the labels.null
labelsOffsetxThis allows you finer grained control in the horizontal direction over the text positioning if you need it. 0
labelsOffsetyThis allows you finer grained control in the vertical direction over the text positioning if you need it. 0
labelsFormattedDecimalsWhen using formatted labels this is the number of decimals that are applied to the %{value_formatted} macro. 0
labelsFormattedPointWhen using formatted labels this is the decimal point character that's used with the %{value_formatted} macro..
labelsFormattedThousandWhen using formatted labels this is the thousand separator character that's used with the %{value_formatted} macro.,
labelsFormattedUnitsPreWhen using formatted labels these are the units that are prepended to the number with the %{value_formatted} macro.(an empty string)
labelsFormattedUnitsPostWhen using formatted labels this are the units that are appended to the number with the %{value_formatted} macro.(an empty string)
labelsCenterWhether the center label is drawn or not.false
labelsCenterIndexThis is the index that corresponds to the index of the relevant rings value that you want to display.0
labelsCenterFontThe font of the center label.null
labelsCenterSizeThe size of the center label.50
labelsCenterColorThe color of the center label.null
labelsCenterBoldWhether the center label is bold or not.null
labelsCenterItalicWhether the center label is italic or not.null
labelsCenterUnitsPreUnits that are prepended to the value.[an empty string]
labelsCenterUnitsPostUnits that are appended to the value.[an empty string]
labelsCenterDecimalsThe number of decimals that are shown. 0
labelsCenterPointThe character that's used as the decimal point..
labelsCenterThousandThe character that's used as the thousand separator.,
labelsCenterSpecificIf you want to specify the exact label to show you can do so with this property.[an empty string]
labelsCenterOffsetxThis allows you finer grained control in the horizontal direction over the text positioning if you need it. 0
labelsCenterOffsetyThis allows you finer grained control in the vertical direction over the text positioning if you need it. 0
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: true

textAccessibleOverflow
This can be visible or hidden and it controls whether the text is clipped to the edges of the canvas. It defaults to be visible and means you can set small margins if you wish.
Default: visible

textAccessiblePointerevents
This controls whether the DOM text responds to mouse based events or not (it sets the pointer-events CSS property to none).
Default: true

textFont
The font used to render the text.
Default: Arial, Verdana, sans-serif

textColor
The color of the label.
Default: #aaa

textSize
The size of the text (in points).
Default: 12

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

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

labels
Labels are placed to the left of the start of the bars (at the top middle). You can also give this option a string if you prefer and use formatted labels
Default: [] (an empty array)

labelsFont
The font used by the labels.
Default: null

labelsSize
The size of the labels.
Default: null

labelsColor
The color of the labels.
Default: null

labelsBold
Whether the labels are bold or not.
Default: null

labelsItalic
Whether the labels are italic or not.
Default: null

labelsBackgroundFill
With this you can give a color for the background fill to the labels.
Default: null

labelsBackgroundStroke
With this you can give a color for the background stroke to the labels.
Default: null

labelsOffsetx
This allows you finer grained control in the horizontal direction over the text positioning if you need it.
Default: 0

labelsOffsety
This allows you finer grained control in the vertical direction over the text positioning if you need it.
Default: 0

labelsFormattedDecimals
When using formatted labels this is the number of decimals that are applied to the %{value_formatted} macro.
Default: 0

labelsFormattedPoint
When using formatted labels this is the decimal point character that's used with the %{value_formatted} macro.
Default: .

labelsFormattedThousand
When using formatted labels this is the thousand separator character that's used with the %{value_formatted} macro.
Default: ,

labelsFormattedUnitsPre
When using formatted labels these are the units that are prepended to the number with the %{value_formatted} macro.
Default: (an empty string)

labelsFormattedUnitsPost
When using formatted labels this are the units that are appended to the number with the %{value_formatted} macro.
Default: (an empty string)

labelsCenter
Whether the center label is drawn or not.
Default: false

labelsCenterIndex
This is the index that corresponds to the index of the relevant rings value that you want to display.
Default: 0

labelsCenterFont
The font of the center label.
Default: null

labelsCenterSize
The size of the center label.
Default: 50

labelsCenterColor
The color of the center label.
Default: null

labelsCenterBold
Whether the center label is bold or not.
Default: null

labelsCenterItalic
Whether the center label is italic or not.
Default: null

labelsCenterUnitsPre
Units that are prepended to the value.
Default: [an empty string]

labelsCenterUnitsPost
Units that are appended to the value.
Default: [an empty string]

labelsCenterDecimals
The number of decimals that are shown.
Default: 0

labelsCenterPoint
The character that's used as the decimal point.
Default: .

labelsCenterThousand
The character that's used as the thousand separator.
Default: ,

labelsCenterSpecific
If you want to specify the exact label to show you can do so with this property.
Default: [an empty string]

labelsCenterOffsetx
This allows you finer grained control in the horizontal direction over the text positioning if you need it.
Default: 0

labelsCenterOffsety
This allows you finer grained control in the vertical direction over the text positioning if you need it.
Default: 0

Interactive features properties

PropertyDescriptionDefault
tooltipsA numerically indexed array of tooltips that are shown when a bar is clicked. These can contain HTML.null
tooltipsEffectThe effect used for showing tooltips. Can be either or none.fade
tooltipsEventThis is the event that triggers the tooltips. It can be either click or mousemove.click
tooltipsOverrideIf you wish to handle showing tooltips yourself, this should be a function which does just that. There's more information on the tooltips documentation page.null
tooltipsHighlightSet this to false if you don't want your charts to be highlighted.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
tooltipsFormattedPointWhen using formatted tooltip strings this is used as the point when using the %{value_formatted} option..
tooltipsFormattedThousandWhen using formatted tooltip strings this is used as the thousand separator when using the %{value_formatted} option.,
tooltipsFormattedDecimalsWhen using formatted tooltip strings this specifies the number of decimals when using the %{value_formatted} option.0
tooltipsFormattedUnitsPreWhen using formatted tooltip strings these units are prepended to the number when using the %{value_formatted} option.(an empty string)
tooltipsFormattedUnitsPostWhen using formatted tooltip strings these units are appended to the number when using the %{value_formatted} option.(an empty string)
tooltipsFormattedKeyColorsWhen using formatted tooltip strings you can give specific colors for the %{key} option to use.null
tooltipsFormattedKeyColorsShapeThis is the shape that's used in the tooltip key. It can be square or circlesquare
tooltipsFormattedKeyColorsCss By using this property you can add CSS values to the key color shape that appears in the tooltip key. Note the property name is "color" and not "colors" like previous properties. It should be an object of CSS properties like this:
tooltipsFormattedKeyColorsCss : {
    border: "1px solid #ddd";
}
null
tooltipsFormattedKeyLabelsWhen using formatted tooltip strings these are the labels that are displayed.[] (an empty array)
tooltipsFormattedListTypeWith this property you can switch between an unordered list (the default) and an ordered list. Possible values are ul and ol.ul
tooltipsFormattedListItemsThis should be a two-dimension array of the list items that are to be shown for all of the tooltips. An example of this property is:
tooltipsFormattedListItems: [
    ['Bill','Jerry','Berty'], // First tooltip
    ['Gill','Carrie','Lucy'], // Second tooltip
    ['Pob','Nobby','Hilda']   // Third tooltip
]
You can use CSS to style this list - for example:
.RGraph_tooltip ul#rgraph_formatted_tooltips_list li {
    text-align: left;
    color: yellow;
}
null
tooltipsFormattedTableHeadersWhen showing a table in the tooltips this can be an array of headers for the table. These are added to the tooltip using <th> tags.null
tooltipsFormattedTableDataThis is the data that is added to the table. This is a 3-dimensional array so it's easy to make a mistake. See the example, copy the code from it and then modify it suit. You'll create fewer bugs this way.null)
tooltipsPointerBy default the tooltips have a small triangular pointer that points to the shape that was clicked on. You can turn this off with this property.true
tooltipsPointerCssIf you want any CSS values applied to the tooltips pointer (for example a CSS border) then specify an object containing those values to this property. For example:
tooltips: {
    borderLeft: 'gray 2px solid',
    borderBottom: 'gray 2px solid'
}
null
tooltipsPositionStaticThe new default (as of August 2020) is for tooltips to be positioned statically and not be dependent on the mouse position. If you don't want this for whatever reason, you can disable it with this setting. When you set it to false tooltips are positioned next to the mouse pointer.true
tooltipsCssIf you want to specify some CSS that gets applied to all of the tooltips, but don't want to use the RGraph.tooltips.style object (which gets applied to all of the tooltips on the page for every chart) you can use this property to give some per-object CSS for the tooltips. These are CSS styles that get applied to all of the tooltips for the specific object only. It should look like this:
tooltipsCss: {
    fontFamily: 'Verdana',
    fontSize: '20pt',
    backgroundColor: 'black',
    color: 'white'
}
null
tooltipsCssClassThis is the name of the CSS class the chart uses.RGraph_tooltip
tooltipsOffsetxThis property allows you to shift the tooltips left or right.0
tooltipsOffsetyThis property allows you to shift the tooltips up or down.0
contextmenuAn array of context menu items. More information about context menus is here.null
annotatableWhether annotations are enabled for the chart (ie you can draw on the chart interactively.false
annotatableColorIf you do not allow the use of the palette, then this will be the only color allowed for annotations.black
annotatableLinewidthThis is the linewidth of the annotations.1
adjustableDefaulting to false, this determines whether your meter will be adjustable (click the bars and drag them).false
tooltips
A numerically indexed array of tooltips that are shown when a bar is clicked. These can contain HTML.
Default: null

tooltipsEffect
The effect used for showing tooltips. Can be either or none.
Default: fade

tooltipsEvent
This is the event that triggers the tooltips. It can be either click or mousemove.
Default: click

tooltipsOverride
If you wish to handle showing tooltips yourself, this should be a function which does just that. There's more information on the tooltips documentation page.
Default: null

tooltipsHighlight
Set this to false if you don't want your charts to be highlighted.
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

tooltipsFormattedPoint
When using formatted tooltip strings this is used as the point when using the %{value_formatted} option.
Default: .

tooltipsFormattedThousand
When using formatted tooltip strings this is used as the thousand separator when using the %{value_formatted} option.
Default: ,

tooltipsFormattedDecimals
When using formatted tooltip strings this specifies the number of decimals when using the %{value_formatted} option.
Default: 0

tooltipsFormattedUnitsPre
When using formatted tooltip strings these units are prepended to the number when using the %{value_formatted} option.
Default: (an empty string)

tooltipsFormattedUnitsPost
When using formatted tooltip strings these units are appended to the number when using the %{value_formatted} option.
Default: (an empty string)

tooltipsFormattedKeyColors
When using formatted tooltip strings you can give specific colors for the %{key} option to use.
Default: null

tooltipsFormattedKeyColorsShape
This is the shape that's used in the tooltip key. It can be square or circle
Default: square

tooltipsFormattedKeyColorsCss
By using this property you can add CSS values to the key color shape that appears in the tooltip key. Note the property name is "color" and not "colors" like previous properties. It should be an object of CSS properties like this:
tooltipsFormattedKeyColorsCss : {
    border: "1px solid #ddd";
}

Default: null

tooltipsFormattedKeyLabels
When using formatted tooltip strings these are the labels that are displayed.
Default: [] (an empty array)

tooltipsFormattedListType
With this property you can switch between an unordered list (the default) and an ordered list. Possible values are ul and ol.
Default: ul

tooltipsFormattedListItems
This should be a two-dimension array of the list items that are to be shown for all of the tooltips. An example of this property is:
tooltipsFormattedListItems: [
    ['Bill','Jerry','Berty'], // First tooltip
    ['Gill','Carrie','Lucy'], // Second tooltip
    ['Pob','Nobby','Hilda']   // Third tooltip
]
You can use CSS to style this list - for example:
.RGraph_tooltip ul#rgraph_formatted_tooltips_list li {
    text-align: left;
    color: yellow;
}

Default: null

tooltipsFormattedTableHeaders
When showing a table in the tooltips this can be an array of headers for the table. These are added to the tooltip using <th> tags.
Default: null

tooltipsFormattedTableData
This is the data that is added to the table. This is a 3-dimensional array so it's easy to make a mistake. See the example, copy the code from it and then modify it suit. You'll create fewer bugs this way.
Default: null)

tooltipsPointer
By default the tooltips have a small triangular pointer that points to the shape that was clicked on. You can turn this off with this property.
Default: true

tooltipsPointerCss
If you want any CSS values applied to the tooltips pointer (for example a CSS border) then specify an object containing those values to this property. For example:
tooltips: {
    borderLeft: 'gray 2px solid',
    borderBottom: 'gray 2px solid'
}

Default: null

tooltipsPositionStatic
The new default (as of August 2020) is for tooltips to be positioned statically and not be dependent on the mouse position. If you don't want this for whatever reason, you can disable it with this setting. When you set it to false tooltips are positioned next to the mouse pointer.
Default: true

tooltipsCss
If you want to specify some CSS that gets applied to all of the tooltips, but don't want to use the RGraph.tooltips.style object (which gets applied to all of the tooltips on the page for every chart) you can use this property to give some per-object CSS for the tooltips. These are CSS styles that get applied to all of the tooltips for the specific object only. It should look like this:
tooltipsCss: {
    fontFamily: 'Verdana',
    fontSize: '20pt',
    backgroundColor: 'black',
    color: 'white'
}

Default: null

tooltipsCssClass
This is the name of the CSS class the chart uses.
Default: RGraph_tooltip

tooltipsOffsetx
This property allows you to shift the tooltips left or right.
Default: 0

tooltipsOffsety
This property allows you to shift the tooltips up or down.
Default: 0

contextmenu
An array of context menu items. More information about context menus is here.
Default: null

annotatable
Whether annotations are enabled for the chart (ie you can draw on the chart interactively.
Default: false

annotatableColor
If you do not allow the use of the palette, then this will be the only color allowed for annotations.
Default: black

annotatableLinewidth
This is the linewidth of the annotations.
Default: 1

adjustable
Defaulting to false, this determines whether your meter will be adjustable (click the bars and drag them).
Default: false

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. As of version 5.23 you can also set this to invert as well. If you do this on a dark background you may find that you need to change the highlightFill color setting as well.null
highlightStrokeIf you use tooltips, this controls the color of the highlight stroke.rgba(0,0,0,0)
highlightFillIf you use tooltips, this controls the color of the highlight fill.rgba(255,255,255,0.5)
iconsThis can be an array of filenames (including their paths) of icons that are placed at the start of each bar. Eg ['/images/first.png', '/images/second.png', '/images/third.png'][]
iconsWidthWith this you can give a specific width for the images.null
iconsHeightWith this you can give a specific height for the images.null
iconsOffsetxThis should be a number (either positive or negative) which is added to the X coordinate of the image. 0
iconsOffsetyThis should be a number (either positive or negative) which is added to the Y coordinate of the image. 0
endsThis determines whether the ends of the bars will be round or straight. Possible values are: round straight and squareround
cleartoThis is used in animations and effects as the default color to use when clearing the canvas.null
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. As of version 5.23 you can also set this to invert as well. If you do this on a dark background you may find that you need to change the highlightFill color setting as well.
Default: null

highlightStroke
If you use tooltips, this controls the color of the highlight stroke.
Default: rgba(0,0,0,0)

highlightFill
If you use tooltips, this controls the color of the highlight fill.
Default: rgba(255,255,255,0.5)

icons
This can be an array of filenames (including their paths) of icons that are placed at the start of each bar. Eg ['/images/first.png', '/images/second.png', '/images/third.png']
Default: []

iconsWidth
With this you can give a specific width for the images.
Default: null

iconsHeight
With this you can give a specific height for the images.
Default: null

iconsOffsetx
This should be a number (either positive or negative) which is added to the X coordinate of the image.
Default: 0

iconsOffsety
This should be a number (either positive or negative) which is added to the Y coordinate of the image.
Default: 0

ends
This determines whether the ends of the bars will be round or straight. Possible values are: round straight and square
Default: round

clearto
This is used in animations and effects as the default color to use when clearing the canvas.
Default: null

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 which bar 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
y The center Y coordinate
angleStart The start angle of the segment.
angleEnd The end angle of the segment.
radiusInner The inside radius of the segment.
radiusOuter The outside radius of the segment.
label The relevant label for this ring.
tooltip If a tooltip is associated with this bar or segment this will be it. id: strings are expanded for you (where the tooltip text is retrieved from the HTML tag with the matching ID).
dataset This is always zero.
index The zero-indexed numerical index of the bar.
sequentialIndex The zero-indexed sequential index of the bar.
<script>
    obj.canvas.onclick = function (e)
    {
        RGraph.redraw();
    
        var canvas  = e.target,
            obj     = canvas.__object__,
            shape   = obj.getShape(e);

        if (shape) {
            var x           = shape.x,
                y           = shape.y,
                start       = shape.angleStart,
                end         = shape.angleEnd,
                radiusInner = shape.radiusInner,
                radiusInner = shape.radiusOuter;
            
            obj.path(
                'b    a % % % % % false    a % % % % % true    s black f red',
                x, y, radiusInner, start, end,
                x, y, radiusOuter, end, start
            );
        }
    }
</script>

obj.getValue(event)

This method can be used to get the value at a particular point when you click on the chart. An example:

obj.canvas.onclick = function (e)
{
    var obj   = e.target.__object__;
    var value = obj.getValue(e);
    
    // ...
}

obj.getAngle(value)
This method will return you an appropriate angle for the given value.

obj.getIndexByRadius(radius)
This method will return the index that corresponds to the ring that you're currently hovering over or clicking on.

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 event code here
});

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

var obj = new RGraph.Activity({
    id: 'cvs',
    min: 0,
    max: 100,
    value: [25,35,46]
}).on('draw', function (e, shape)
{
    // Put the draw event code here
})
.on('click', function (e, shape)
{
    // Handle the click event
}).draw();
obj.exec(function)

The exec function is documented here.


obj.responsive(configuration)

The responsive() function helps your charts respond to different browser window sizes and screen resolutions. For example for smaller screens you might want to show a smaller version of the chart.

The responsive() function is documented on its own page here.

Events

RGraph supports custom events that allow you to easily add interactivity to your charts if required. The following events are available:

For example:
new RGraph.Activity({
    id: 'cvs',
    min: 0,
    max: 100,
    value:[26,35,34],
    options: {
    }
}).on('draw', function (obj)
{
    console.log('The draw event has fired');
    
}).draw();

Effects

These effects are available and can be used instead of the draw() function. There are also generic effects available which you can see here: Generic effects and transitions
<script>
    /**
    * Optional callback function that's called when the effect is complete
    */
    function myCallback (obj)
    {
        // ...
    }

    obj = new RGraph.Activity({
        id: 'cvs',
        min: 0,
        max: 100,
        value: 56,
        options: {
        }
    }).grow({frames: 60}, myCallback)
</script>