Line chart API reference

Documentation about the Line chart including information about all of the options that are available to you. The Line chart is a commonly used type of chart and can show one or more datasets. It's one of the more commonly used types of chart and as such there are a lot of Line chart demos.

Note: With the Line chart, there isn't an option to have a scale on the X axis. For this you'll need a Scatter chart with the line option set to true. You can either use labels across the X axis or an X scale. Or as of February 2013 you can also use the X axis drawing object.

Example

<script>
    data = [
        [8,7,6,4,9,5,6,7,9],
        [4,3,5,8,6,4,2,4,9],
        [8,4,9,5,3,5,1,2,5]
    ];

    new RGraph.Line({
        id: 'cvs',
        data: data,
        options: {
            backgroundGridColor: 'rgba(238,238,238,1)',
            colors: ['black'],
            linewidth: 3,
            filled: true,
            filledColors: ['red','blue','#0f0'],
            spline: true,
            shadow: false,
            tickmarksStyle: null,
            xaxisLabels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
            axes: false,
            marginLeft: 40
        }
    }).trace();
</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 is shown above.

Background properties

PropertyDescriptionDefault
backgroundBarsCountThe number of background bars.5
backgroundBarsColor1The color of the background bars (1 of 2).rgba(0,0,0,0)
backgroundBarsColor2The color of the background bars (2 of 2).rgba(0,0,0,0)
backgroundGridWhether to show the background grid or not.true
backgroundGridColorThe color of the background grid.#eee
backgroundHbarsAn array of information stipulating horizontal colored bars. You can use these to indicate limits. Eg: obj.set('hbars', [[75, 10, 'yellow'], [85, 15, 'red']]); This would give you two bars, one red and a lower yellow bar. The units correspond to your scale, and are the starting point and the height.null
backgroundGridLinewidthThe width of the background grid.1
backgroundGridBorderDetermines whether a border line is drawn around the grid.true
backgroundGridHlinesDetermines whether to draw the horizontal grid lines.true
backgroundGridVlinesDetermines whether to draw the vertical grid lines.true
backgroundGridAutofitInstead of specifying a pixel width/height for the background grid, you can use autofit and specify how many horizontal and vertical lines you want.true
backgroundGridHlinesCountWhen using autofit this allows you to specify how many horizontal grid lines you want.5
backgroundGridVlinesCountWhen using autofit this allows you to specify how many vertical grid lines you want.20
backgroundGridAlignIf you want to have your grid lines line up with the labels (both X and Y axes), you can set this to true and RGraph will attempt to make the grid lines line up. If you have a marginInner set then the alignment will be thrown out.true
backgroundGridDottedIf you want to have your background grid dashed then set this to true.false
backgroundGridDashedIf you want to have your background grid dotted then set this to true. This takes precedence over dashed lines.false
backgroundImageIf you want to specify a background image to use on your chart, specify it with this property. If you use effects with a background image on your chart it may make the effect flicker. Using a background image with the draw event may mean that the event fires twice. There is a property that you can check though that is set when the image has loaded: obj.__rgraph_background_image_loaded__ Simply check this flag in your ondraw event. If it's true then the background image has loaded.null
backgroundImageStretchBy default your background image is stretched (if necessary) to cover the whole chart area (margins not included). If this is not what you want then set this property to false.true
backgroundImageXThe X position of the image. The coordinates are the top left corner of the image.null
backgroundImageYThe Y position of the image. The coordinates are the top left corner of the image.null
backgroundImageWThe width of the image. If you have a large canvas with many charts - you may need to specify this.null
backgroundImageHThe height of the image. If you have a large canvas with many charts - you may need to specify this.null
backgroundImageAlignInstead of specifying the coordinates of the image, you can instead simply align it top, bottom, left or right. Examples are:
  • top left
  • bottom right
  • bottom
  • right
null
backgroundImageAlphaThe alpha value (the opacity) of the image.1
backdropWhen enabled this specifies that the line(s) will have a backdrop effect. You can control the transparency with the other backdrop settings).false
backdropSizeThis controls the size/extent of the backdrop effect.30
backdropAlphaThis controls how much transparency the backdrop effect has. It can go from 0 - 1.0.2
backgroundBarsCount
The number of background bars.
Default: 5

backgroundBarsColor1
The color of the background bars (1 of 2).
Default: rgba(0,0,0,0)

backgroundBarsColor2
The color of the background bars (2 of 2).
Default: rgba(0,0,0,0)

backgroundGrid
Whether to show the background grid or not.
Default: true

backgroundGridColor
The color of the background grid.
Default: #eee

backgroundHbars
An array of information stipulating horizontal colored bars. You can use these to indicate limits. Eg: obj.set('hbars', [[75, 10, 'yellow'], [85, 15, 'red']]); This would give you two bars, one red and a lower yellow bar. The units correspond to your scale, and are the starting point and the height.
Default: null

backgroundGridLinewidth
The width of the background grid.
Default: 1

backgroundGridBorder
Determines whether a border line is drawn around the grid.
Default: true

backgroundGridHlines
Determines whether to draw the horizontal grid lines.
Default: true

backgroundGridVlines
Determines whether to draw the vertical grid lines.
Default: true

backgroundGridAutofit
Instead of specifying a pixel width/height for the background grid, you can use autofit and specify how many horizontal and vertical lines you want.
Default: true

backgroundGridHlinesCount
When using autofit this allows you to specify how many horizontal grid lines you want.
Default: 5

backgroundGridVlinesCount
When using autofit this allows you to specify how many vertical grid lines you want.
Default: 20

backgroundGridAlign
If you want to have your grid lines line up with the labels (both X and Y axes), you can set this to true and RGraph will attempt to make the grid lines line up. If you have a marginInner set then the alignment will be thrown out.
Default: true

backgroundGridDotted
If you want to have your background grid dashed then set this to true.
Default: false

backgroundGridDashed
If you want to have your background grid dotted then set this to true. This takes precedence over dashed lines.
Default: false

backgroundImage
If you want to specify a background image to use on your chart, specify it with this property. If you use effects with a background image on your chart it may make the effect flicker. Using a background image with the draw event may mean that the event fires twice. There is a property that you can check though that is set when the image has loaded: obj.__rgraph_background_image_loaded__ Simply check this flag in your ondraw event. If it's true then the background image has loaded.
Default: null

backgroundImageStretch
By default your background image is stretched (if necessary) to cover the whole chart area (margins not included). If this is not what you want then set this property to false.
Default: true

backgroundImageX
The X position of the image. The coordinates are the top left corner of the image.
Default: null

backgroundImageY
The Y position of the image. The coordinates are the top left corner of the image.
Default: null

backgroundImageW
The width of the image. If you have a large canvas with many charts - you may need to specify this.
Default: null

backgroundImageH
The height of the image. If you have a large canvas with many charts - you may need to specify this.
Default: null

backgroundImageAlign
Instead of specifying the coordinates of the image, you can instead simply align it top, bottom, left or right. Examples are:

Default: null

backgroundImageAlpha
The alpha value (the opacity) of the image.
Default: 1

backdrop
When enabled this specifies that the line(s) will have a backdrop effect. You can control the transparency with the other backdrop settings).
Default: false

backdropSize
This controls the size/extent of the backdrop effect.
Default: 30

backdropAlpha
This controls how much transparency the backdrop effect has. It can go from 0 - 1.
Default: 0.2

General axis properties

PropertyDescriptionDefault
axesWhether the axes are drawn.true
axesColorThe color of the axes.black
axesLinewidthThe linewidth of the axes.1
axes
Whether the axes are drawn.
Default: true

axesColor
The color of the axes.
Default: black

axesLinewidth
The linewidth of the axes.
Default: 1

X axis properties

PropertyDescriptionDefault
xaxisLabelsInsideThis controls whether the X labels are drawn inside the X axis or not. By using this you can significantly reduce the size of the margins needed.false
xaxisLabelsInsideBorderWhether the inside X axis labels have a border or not.false
xaxisLabelsOffsetxThis allows you finer grained control in the horizontal direction over the X label positioning if you need it.0
xaxisLabelsOffsetyThis allows you finer grained control in the vertical direction over the X label positioning if you need it.0
xaxisLabelsAn array of the X labels for the chart.An empty array
xaxisLabelsFontThe font used to render the X axis labels.null (defaults to textFont)
xaxisLabelsSizeThe size of the X axis labels.null (defaults to textSize)
xaxisLabelsColorThe color of the X axis labels.null (defaults to textColor)
xaxisLabelsBoldWhether the X axis labels are bold or not.null (defaults to textBold)
xaxisLabelsItalicWhether the X axis labels are italic or not.null (defaults to textItalic)
xaxisLabelsAngleThe angle of the X axis labels. This can be from 90 to -90 degrees.0 (Horizontal)
xaxisTitleThis allows you to specify a title for the X axis.none
xaxisTitleSizeThis allows you to specify a size for the X axis title.null (defaults to the textSize setting)
xaxisTitleFontThis allows you to specify a font for the X axis title.null (defaults to the textFont setting)
xaxisTitleBoldThis controls whether the X axis title is bold or not.true
xaxisTitleItalicThis controls whether the X axis title is italic or not.null (defaults to the textItalic setting)
xaxisTitleColorThis controls the color of the X axis title.null (defaults to the textColor setting)
xaxisTitleXBy giving this you can specifically set the X position of the X axis title.null
xaxisTitleYBy giving this you can specifically set the Y position of the X axis title.null
xaxisTitlePosThis is multiplied with the margin to give the position of the X axis title.0.25
xaxisTickmarksCountThe number of X tickmarks.null (linked to number of data points)
xaxisPositionThe position of the X axis. It can be bottom, center or top.bottom
xaxisTickmarksLastWhen you're combining the Bar and Line charts, you may want to use this property to stop the end X tick from being drawn.true
xaxisLabelsInside
This controls whether the X labels are drawn inside the X axis or not. By using this you can significantly reduce the size of the margins needed.
Default: false

xaxisLabelsInsideBorder
Whether the inside X axis labels have a border or not.
Default: false

xaxisLabelsOffsetx
This allows you finer grained control in the horizontal direction over the X label positioning if you need it.
Default: 0

xaxisLabelsOffsety
This allows you finer grained control in the vertical direction over the X label positioning if you need it.
Default: 0

xaxisLabels
An array of the X labels for the chart.
Default: An empty array

xaxisLabelsFont
The font used to render the X axis labels.
Default: null (defaults to textFont)

xaxisLabelsSize
The size of the X axis labels.
Default: null (defaults to textSize)

xaxisLabelsColor
The color of the X axis labels.
Default: null (defaults to textColor)

xaxisLabelsBold
Whether the X axis labels are bold or not.
Default: null (defaults to textBold)

xaxisLabelsItalic
Whether the X axis labels are italic or not.
Default: null (defaults to textItalic)

xaxisLabelsAngle
The angle of the X axis labels. This can be from 90 to -90 degrees.
Default: 0 (Horizontal)

xaxisTitle
This allows you to specify a title for the X axis.
Default: none

xaxisTitleSize
This allows you to specify a size for the X axis title.
Default: null (defaults to the textSize setting)

xaxisTitleFont
This allows you to specify a font for the X axis title.
Default: null (defaults to the textFont setting)

xaxisTitleBold
This controls whether the X axis title is bold or not.
Default: true

xaxisTitleItalic
This controls whether the X axis title is italic or not.
Default: null (defaults to the textItalic setting)

xaxisTitleColor
This controls the color of the X axis title.
Default: null (defaults to the textColor setting)

xaxisTitleX
By giving this you can specifically set the X position of the X axis title.
Default: null

xaxisTitleY
By giving this you can specifically set the Y position of the X axis title.
Default: null

xaxisTitlePos
This is multiplied with the margin to give the position of the X axis title.
Default: 0.25

xaxisTickmarksCount
The number of X tickmarks.
Default: null (linked to number of data points)

xaxisPosition
The position of the X axis. It can be bottom, center or top.
Default: bottom

xaxisTickmarksLast
When you're combining the Bar and Line charts, you may want to use this property to stop the end X tick from being drawn.
Default: true

Y axis properties

PropertyDescriptionDefault
yaxisLabelsCan be true or false and determines whether the chart has Y axis labels.true
yaxisLabelsCountA value that controls how many Y labels there are. Formerly this could be 1/3/5/10 but now it can be any number.5
yaxisLabelsFontThe font used for the Y axis text.null
yaxisLabelsSizeThe size used for the Y axis text.null
yaxisLabelsColorThe color used for the Y axis text.null
yaxisLabelsBoldWhether the Y axis text is bold or not.null
yaxisLabelsItalicWhether the Y axis text is italic or not.null
yaxisLabelsInsideWhether the Y axis labels are drawn inside the axis.false
yaxisLabelsSpecificYou can use this option to give your own Y labels (eg ['Low', 'Medium', 'High']. Note: Since March 2013 you may now need to add an extra (optionally) empty element to the array of labels to achieve your desired result.null
yaxisLabelsOffsetxThis allows you finer grained control in the horizontal direction over the Y label positioning if you need it.0
yaxisLabelsOffsetyThis allows you finer grained control in the vertical direction over the Y label positioning if you need it.0
yaxisTitleThis allows you to specify a title for the Y axis.none
yaxisTitleSizeThis allows you to specify a size for the Y axis title.null
yaxisTitleFontThis allows you to specify a font for the Y axis title.null
yaxisTitleBoldThis controls whether the Y axis title is bold or not.null
yaxisTitleItalicThis controls whether the Y axis title is italic or not.null
yaxisTitleColorThis controls what color the Y axis is.null
yaxisTitlePosThis is multiplied with the margin to give the position of the Y axis title.0.25
yaxisTitleXBy giving this you can specifically set the X position of the Y axis title.null
yaxisTitleYBy giving this you can specifically set the Y position of the Y axis title.null
yaxisScaleUnitsPostThe units (if any) that the Y axis is measured in (gets appended to the number).none
yaxisScaleUnitsPreThe units (if any) that the Y axis is measured in (gets prepended to the number).none
yaxisScaleDecimalsDetermines the precision of the numbers used as the scale.0
yaxisScalePointThe character used as the decimal point..
yaxisScaleThousandThe character used as the thousand separator.,
yaxisScaleRoundWhether to round the maximum scale value up or not. This will produce slightly better scales in some instances.null
yaxisScaleInvertReverses the Y axis scale so that the minimum value is at the top, instead of the bottom.false
yaxisScaleZerostartWhether the scale starts at zero or not.true
yaxisScaleMinThe optional minimum Y scale value. If not specified then it will be zero.null
yaxisScaleMaxThe optional maximum Y scale value. If not specified then it will be calculated.null (It's calculated)
yaxisScaleFormatterTo allow thoroughly custom formats of numbers in the scale, you can use this option to specify a function that is used by RGraph to format numbers. This function should handle ALL of the formatting. Eg:

function myFormatter(obj, num)
{
    return num + 'F'; // An example of formatting
}
myGraph.set('scale.formatter', myFormatter);
null
yaxisTickmarksCountThe number of Y tickmarks.10
yaxisPositionSpecifies the Y axis position. Can be left or right.left
yaxisTickmarksLastWhen you're combining the Bar and Line charts, you may want to use this property to stop the end Y tick from being drawn.true
outofboundsNormally, out-of-bounds values are not drawn. By setting this to true you can change this behaviour.false
outofboundsClipIf you've enabled the outofbounds option but you're not interested in seeing the bits which fall outside of the chart area (eg in the margins) then you can enable this option. There's a demo of the outofboundsClip option in the download archive (line-overflow-clipped.html).false
yaxisLabels
Can be true or false and determines whether the chart has Y axis labels.
Default: true

yaxisLabelsCount
A value that controls how many Y labels there are. Formerly this could be 1/3/5/10 but now it can be any number.
Default: 5

yaxisLabelsFont
The font used for the Y axis text.
Default: null

yaxisLabelsSize
The size used for the Y axis text.
Default: null

yaxisLabelsColor
The color used for the Y axis text.
Default: null

yaxisLabelsBold
Whether the Y axis text is bold or not.
Default: null

yaxisLabelsItalic
Whether the Y axis text is italic or not.
Default: null

yaxisLabelsInside
Whether the Y axis labels are drawn inside the axis.
Default: false

yaxisLabelsSpecific
You can use this option to give your own Y labels (eg ['Low', 'Medium', 'High']. Note: Since March 2013 you may now need to add an extra (optionally) empty element to the array of labels to achieve your desired result.
Default: null

yaxisLabelsOffsetx
This allows you finer grained control in the horizontal direction over the Y label positioning if you need it.
Default: 0

yaxisLabelsOffsety
This allows you finer grained control in the vertical direction over the Y label positioning if you need it.
Default: 0

yaxisTitle
This allows you to specify a title for the Y axis.
Default: none

yaxisTitleSize
This allows you to specify a size for the Y axis title.
Default: null

yaxisTitleFont
This allows you to specify a font for the Y axis title.
Default: null

yaxisTitleBold
This controls whether the Y axis title is bold or not.
Default: null

yaxisTitleItalic
This controls whether the Y axis title is italic or not.
Default: null

yaxisTitleColor
This controls what color the Y axis is.
Default: null

yaxisTitlePos
This is multiplied with the margin to give the position of the Y axis title.
Default: 0.25

yaxisTitleX
By giving this you can specifically set the X position of the Y axis title.
Default: null

yaxisTitleY
By giving this you can specifically set the Y position of the Y axis title.
Default: null

yaxisScaleUnitsPost
The units (if any) that the Y axis is measured in (gets appended to the number).
Default: none

yaxisScaleUnitsPre
The units (if any) that the Y axis is measured in (gets prepended to the number).
Default: none

yaxisScaleDecimals
Determines the precision of the numbers used as the scale.
Default: 0

yaxisScalePoint
The character used as the decimal point.
Default: .

yaxisScaleThousand
The character used as the thousand separator.
Default: ,

yaxisScaleRound
Whether to round the maximum scale value up or not. This will produce slightly better scales in some instances.
Default: null

yaxisScaleInvert
Reverses the Y axis scale so that the minimum value is at the top, instead of the bottom.
Default: false

yaxisScaleZerostart
Whether the scale starts at zero or not.
Default: true

yaxisScaleMin
The optional minimum Y scale value. If not specified then it will be zero.
Default: null

yaxisScaleMax
The optional maximum Y scale value. If not specified then it will be calculated.
Default: null (It's calculated)

yaxisScaleFormatter
To allow thoroughly custom formats of numbers in the scale, you can use this option to specify a function that is used by RGraph to format numbers. This function should handle ALL of the formatting. Eg:

function myFormatter(obj, num)
{
    return num + 'F'; // An example of formatting
}
myGraph.set('scale.formatter', myFormatter);

Default: null

yaxisTickmarksCount
The number of Y tickmarks.
Default: 10

yaxisPosition
Specifies the Y axis position. Can be left or right.
Default: left

yaxisTickmarksLast
When you're combining the Bar and Line charts, you may want to use this property to stop the end Y tick from being drawn.
Default: true

outofbounds
Normally, out-of-bounds values are not drawn. By setting this to true you can change this behaviour.
Default: false

outofboundsClip
If you've enabled the outofbounds option but you're not interested in seeing the bits which fall outside of the chart area (eg in the margins) then you can enable this option. There's a demo of the outofboundsClip option in the download archive (line-overflow-clipped.html).
Default: false

Other label properties

PropertyDescriptionDefault
labelsAboveWhether the values are shown in labels drawn above the line.false
labelsAboveBoldWhether the labelsAbove labels are bold or not.null (defaults to the textBold setting)
labelsAboveItalicWhether the labelsAbove labels are italic or not.null (defaults to the textItalic setting)
labelsAboveSizeThe size of the labels which are drawn above the line.8
labelsAboveColorThe text color of the labels.Same as the textColor setting
labelsAboveFontThe font used to render the labels.Same as textFont
labelsAboveDecimalsThe number of decimals to fit the numbers to. If left unset decimals may still be shown (depending on your data) - but some numbers may have lots of decimals, some not so many and some none at all. It all depends on your data.null
labelsAbovePointThe decimal point character for the labels above labels..
labelsAboveThousandThe thousand separator character for the labels above labels.,
labelsAboveBackgroundThe background color of the labels.rgba(255,255,255,0.7)
labelsAboveBorderWhether the labels have a border or not.false
labelsAboveOffsetyThe Y offset of the label from the point on the line.5
labelsAboveUnitsPreThe units that appear before the label.none
labelsAboveUnitsPostThe units that appear after the label.none
labelsAboveSpecificThis can be an array of (text) labels that you want to appear above the line instead of the values.null
labelsIngraphAn array of labels for the chart which are drawn "inside" the chart. If you have 5 data points then this should have a corresponding number of elements, though there is a shorthand available.null
labelsIngraphFontThe font that the ingraph labels are rendered in.null
labelsIngraphSizeThe size of the ingraph labels.null
labelsIngraphColorThe color of the ingraph labels.null
labelsIngraphBoldWhether the ingraph labels are bold or not.null
labelsIngraphItalicWhether the ingraph labels are italic or not.null
textSizeThe size of the text (in points).12
textFontThe font used to render the text.Arial
textColorThe color of the labels.black
textBoldThe color of the labels.black
textItalicThe color of the labels.black
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
labelsAbove
Whether the values are shown in labels drawn above the line.
Default: false

labelsAboveBold
Whether the labelsAbove labels are bold or not.
Default: null (defaults to the textBold setting)

labelsAboveItalic
Whether the labelsAbove labels are italic or not.
Default: null (defaults to the textItalic setting)

labelsAboveSize
The size of the labels which are drawn above the line.
Default: 8

labelsAboveColor
The text color of the labels.
Default: Same as the textColor setting

labelsAboveFont
The font used to render the labels.
Default: Same as textFont

labelsAboveDecimals
The number of decimals to fit the numbers to. If left unset decimals may still be shown (depending on your data) - but some numbers may have lots of decimals, some not so many and some none at all. It all depends on your data.
Default: null

labelsAbovePoint
The decimal point character for the labels above labels.
Default: .

labelsAboveThousand
The thousand separator character for the labels above labels.
Default: ,

labelsAboveBackground
The background color of the labels.
Default: rgba(255,255,255,0.7)

labelsAboveBorder
Whether the labels have a border or not.
Default: false

labelsAboveOffsety
The Y offset of the label from the point on the line.
Default: 5

labelsAboveUnitsPre
The units that appear before the label.
Default: none

labelsAboveUnitsPost
The units that appear after the label.
Default: none

labelsAboveSpecific
This can be an array of (text) labels that you want to appear above the line instead of the values.
Default: null

labelsIngraph
An array of labels for the chart which are drawn "inside" the chart. If you have 5 data points then this should have a corresponding number of elements, though there is a shorthand available.
Default: null

labelsIngraphFont
The font that the ingraph labels are rendered in.
Default: null

labelsIngraphSize
The size of the ingraph labels.
Default: null

labelsIngraphColor
The color of the ingraph labels.
Default: null

labelsIngraphBold
Whether the ingraph labels are bold or not.
Default: null

labelsIngraphItalic
Whether the ingraph labels are italic or not.
Default: null

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

textFont
The font used to render the text.
Default: Arial

textColor
The color of the labels.
Default: black

textBold
The color of the labels.
Default: black

textItalic
The color of the labels.
Default: black

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

Margin properties

PropertyDescriptionDefault
marginLeftThe left margin of the chart, (the margin is where the labels and title are)).25
marginRightThe right margin of the chart, (the margin is where the labels and title are).25
marginTopThe top margin of the chart, (the margin is where the labels and title are).25
marginBottomThe bottom margin of the chart, (the margin is where the labels and title are).25
marginInnerThe size of the horizontal margin. This is on the inside of the axes.0
marginLeft
The left margin of the chart, (the margin is where the labels and title are)).
Default: 25

marginRight
The right margin of the chart, (the margin is where the labels and title are).
Default: 25

marginTop
The top margin of the chart, (the margin is where the labels and title are).
Default: 25

marginBottom
The bottom margin of the chart, (the margin is where the labels and title are).
Default: 25

marginInner
The size of the horizontal margin. This is on the inside of the axes.
Default: 0

Color properties

PropertyDescriptionDefault
colorsAn array of line colors.['#f00', '#0f0', '', '#00f', '#f0f', '#ff0', '#0ff']
colorsAlternateSet this to true if you want your line color(s) to be alternated.false
filledWhether the area under the line is filled or not. This looks best when there is no horizontal margin.

Note: When showing multiple lines the values are additive by default. This means that if you have two lines they will be "stacked" on top of each other. If this is not the desired behaviour then you can set the option below to false.
false
filledColorsA single color or an array of colors that filled line charts will use.

Important: This used to be a string, and still can be, but can now also be an array.
null
filledAccumulativeWhen showing multiple filled lines the values are by default accumulative (ie added to each other). If this is not the desired behaviour, then you can set this property to false to have them drawn "non-accumulatively".

Note: If you use fully opaque colors in conjunction with this option set to false it's feasible that you might not see one or more of the lines, or parts of the line. If you want to see all of the lines you should leave this option set to its default true setting. You can see an example of this setting here.

true
filledRangeThis is useful for indicating a range. Exactly two datasets are required, with the space between them filled. This is useful for indicating a range.false
filledRangeThresholdWhen drawing a filled range chart you set a threshold in the case where you want the range to be one color above the threshold and another below.null
filledRangeThresholdColorsThis is a two element array that defines the colors when using a dual color range chart. There's an example of the dual color range chart in the download archive (line-dual-color-range.html).['red', 'green']
colors
An array of line colors.
Default: ['#f00', '#0f0', '', '#00f', '#f0f', '#ff0', '#0ff']

colorsAlternate
Set this to true if you want your line color(s) to be alternated.
Default: false

filled
Whether the area under the line is filled or not. This looks best when there is no horizontal margin.

Note: When showing multiple lines the values are additive by default. This means that if you have two lines they will be "stacked" on top of each other. If this is not the desired behaviour then you can set the option below to false.
Default: false

filledColors
A single color or an array of colors that filled line charts will use.

Important: This used to be a string, and still can be, but can now also be an array.
Default: null

filledAccumulative
When showing multiple filled lines the values are by default accumulative (ie added to each other). If this is not the desired behaviour, then you can set this property to false to have them drawn "non-accumulatively".

Note: If you use fully opaque colors in conjunction with this option set to false it's feasible that you might not see one or more of the lines, or parts of the line. If you want to see all of the lines you should leave this option set to its default true setting. You can see an example of this setting here.


Default: true

filledRange
This is useful for indicating a range. Exactly two datasets are required, with the space between them filled. This is useful for indicating a range.
Default: false

filledRangeThreshold
When drawing a filled range chart you set a threshold in the case where you want the range to be one color above the threshold and another below.
Default: null

filledRangeThresholdColors
This is a two element array that defines the colors when using a dual color range chart. There's an example of the dual color range chart in the download archive (line-dual-color-range.html).
Default: ['red', 'green']

Shadow properties

PropertyDescriptionDefault
shadowWhether a drop shadow is applied.false
shadowColorThe color of the shadow.rgba(0,0,0,0.5)
shadowOffsetxThe X offset of the shadow.2
shadowOffsetyThe Y offset of the shadow.2
shadowBlurThe severity of the shadow blurring effect.3
shadow
Whether a drop shadow is applied.
Default: false

shadowColor
The color of the shadow.
Default: rgba(0,0,0,0.5)

shadowOffsetx
The X offset of the shadow.
Default: 2

shadowOffsety
The Y offset of the shadow.
Default: 2

shadowBlur
The severity of the shadow blurring effect.
Default: 3

Interactive features properties

PropertyDescriptionDefault
tooltipsA numerically indexed array of tooltips that are shown when a bar is clicked. These can contain HTML.An empty array
tooltipsEffectThe effect used for showing tooltips. Can be either fade or none.fade
tooltipsCssClassThis is the name of the CSS class the chart uses.RGraph_tooltip
tooltipsOverrideIf you wish to handle showing tooltips yourself, this should be a function object 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
tooltipsHotspotXonlySet this to true if you want the tooltips to be triggered by the mouse X position only.false
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 tooltips do not get hidden.false
tooltipsHotspotSizeThe size of the hotspot area for tooltips.5
crosshairsIf true, you will get crosshairs centered on the current mouse position.false
crosshairsLinewidthThis controls the linewidth of the crosshairs.1
crosshairsColorThe color of the crosshairs.#333
crosshairsHlineThis determines whether the horizontal crosshair is shown.true
crosshairsVlineThis determines whether the vertical crosshair is shown.true
contextmenuAn array of context menu items. More information about context menus is here.[] (An empty array)
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 bar chart will be adjustable.false
adjustableOnlyThis should be an array of values that determine whether a point is adjustable or not. A truthy value for when it is, a falsey value for when it's not.null
tooltips
A numerically indexed array of tooltips that are shown when a bar is clicked. These can contain HTML.
Default: An empty array

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

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

tooltipsOverride
If you wish to handle showing tooltips yourself, this should be a function object 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

tooltipsHotspotXonly
Set this to true if you want the tooltips to be triggered by the mouse X position only.
Default: false

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 tooltips do not get hidden.
Default: false

tooltipsHotspotSize
The size of the hotspot area for tooltips.
Default: 5

crosshairs
If true, you will get crosshairs centered on the current mouse position.
Default: false

crosshairsLinewidth
This controls the linewidth of the crosshairs.
Default: 1

crosshairsColor
The color of the crosshairs.
Default: #333

crosshairsHline
This determines whether the horizontal crosshair is shown.
Default: true

crosshairsVline
This determines whether the vertical crosshair is shown.
Default: true

contextmenu
An array of context menu items. More information about context menus is here.
Default: [] (An empty array)

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 bar chart will be adjustable.
Default: false

adjustableOnly
This should be an array of values that determine whether a point is adjustable or not. A truthy value for when it is, a falsey value for when it's not.
Default: null

Title properties

PropertyDescriptionDefault
titleThe title of the chart.none
titleFontThe font that the title is rendered in. If not specified the textFont setting is used (usually Arial).null
titleSizeThe size of the title. If not specified the size is usually 2pt bigger than the textSize setting.null
titleBoldWhether the title is bold or not.true
titleItalicWhether the title is italic or not.false
titleColorThe color of the title.black
titleBackgroundThe background color (if any) for the title.null
titleXTo give the exact X coordinate for the title - use this. This can also be a string like this: "-5" -- in which case it's converted to a number and added to the calculated coordinate - allowing you to adjust the calculated coordinate.null
titleYTo give the exact Y coordinate for the title - use this. This can also be a string like this: "-5" -- in which case it's converted to a number and added to the calculated coordinate - allowing you to adjust the calculated coordinate.null
title
The title of the chart.
Default: none

titleFont
The font that the title is rendered in. If not specified the textFont setting is used (usually Arial).
Default: null

titleSize
The size of the title. If not specified the size is usually 2pt bigger than the textSize setting.
Default: null

titleBold
Whether the title is bold or not.
Default: true

titleItalic
Whether the title is italic or not.
Default: false

titleColor
The color of the title.
Default: black

titleBackground
The background color (if any) for the title.
Default: null

titleX
To give the exact X coordinate for the title - use this. This can also be a string like this: "-5" -- in which case it's converted to a number and added to the calculated coordinate - allowing you to adjust the calculated coordinate.
Default: null

titleY
To give the exact Y coordinate for the title - use this. This can also be a string like this: "-5" -- in which case it's converted to a number and added to the calculated coordinate - allowing you to adjust the calculated coordinate.
Default: null

Key properties

key properties are documented on the key documentation page.

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
tickmarksStyleWhat kind of tickmarks to use on the chart. This can be:
  • circle
  • filledcircle
  • endcircle
  • filledendcircle
  • square
  • endsquare
  • filledsquare
  • filledendsquare
  • tick
  • halftick
  • endtick
  • cross
  • dot
  • borderedcircle (same as dot)
  • arrow
  • filledarrow
  • triangle
  • filledtriangle

Note that arrow and filledarrow look better with a thinner (1 or 2) linewidth setting.

Also note that as well as a string, this can be an array of different tickmark styles.

As of August 2014 this can be a location/URL of an image file to use as the tickmarks or a data: URL. See below for details.

null
tickmarkSizeThe size of the tickmarks.3
tickmarksStyleDotStrokeThis is the color of the filled part of the dot/borderedcircle style tickmarks.null (defaults to the line color)
tickmarksStyleDotFillThis is the color of the stroked part of the dot/borderedcircle style tickmarks.null (defaults to the line color)
tickmarksStyleDotLinewidthThis is the width of the line used when drawing the tickmarks.0
tickmarksStyleImageHalignThis can be left right or center and determines the horizontal alignment of the tickmark.center
tickmarksStyleImageValignThis can be top bottom or center and determines the vertical alignment of the tickmark.center
tickmarksStyleImageOffsetxAfter the alignment has been applied, this is added to the X coordinate of the tickmark.0
tickmarksStyleImageOffsetyAfter the alignment has been applied, this is added to the Y coordinate of the tickmark.0
steppedDraws the line as stepped. Useful for showing stock performance for example.false
linewidthThe width of the line (ie the actual line on the chart). Note: If your line is stepped and filled, and you don't want a trailing line indicating the last value, you can set this to zero.1
animationUnfoldXThis is used by the unfold() Line chart animation and dictates whether the X value is unfolded.false
animationUnfoldYThis is used by the unfold() Line chart animation and dictates whether the Y value is unfolded.true
animationUnfoldInitialThis property can be used to set the initial factor for the unfold() animation. Setting this to a value less than one will cause the line to expand outwards, whilst a value greater than one will cause the line to contract towards the correct values.2
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.

Updated: As of June 2016 you can also set this to halo to get a new style of highlighting. This style of highlighting doesn't work with the tooltipsHotspotXonly option.

null
highlightStrokeIf you use tooltips, this controls the color of the highlight stroke.black
highlightFillIf you use tooltips, this controls the color of the highlight fill.rgba(255,255,255,0.5)
splineThis option causes the line to be drawn as a spline - ie curvy. Not all options will work with splines - however the introduction of real splines over the previous curvy option is a significant improvement. There are numerous examples of this in the demos that are included in the download file. Null values will not work with splines.false
cleartoThis is used in animations and effects as the default color to use when the canvas.null
combinedEffectSet this to the name of an effect (eg grow() ) and the CombinedChart object will use that effect to draw the chart instead of the regular draw() function.null
combinedEffectOptionsThis should be a STRING that contains a JavaScript object of options for the effect function like this:
combinedchartEffectOptions: '{frames: 300}'
It has to be a string because of a quirk of the option parsing system.
null
combinedEffectCallbackA function that runs when this objects effect has completed.null
dottedWhether the line (not the background grid) is dotted or not. This is a new addition in January 2017 and is thanks to a submission by Garaged.false
dashedWhether the line (not the background grid) is dashed or not. This is a new addition in January 2017 and is thanks to a submission by Garaged.false
tickmarksStyle
What kind of tickmarks to use on the chart. This can be:

Note that arrow and filledarrow look better with a thinner (1 or 2) linewidth setting.

Also note that as well as a string, this can be an array of different tickmark styles.

As of August 2014 this can be a location/URL of an image file to use as the tickmarks or a data: URL. See below for details.
Default: null

tickmarkSize
The size of the tickmarks.
Default: 3

tickmarksStyleDotStroke
This is the color of the filled part of the dot/borderedcircle style tickmarks.
Default: null (defaults to the line color)

tickmarksStyleDotFill
This is the color of the stroked part of the dot/borderedcircle style tickmarks.
Default: null (defaults to the line color)

tickmarksStyleDotLinewidth
This is the width of the line used when drawing the tickmarks.
Default: 0

tickmarksStyleImageHalign
This can be left right or center and determines the horizontal alignment of the tickmark.
Default: center

tickmarksStyleImageValign
This can be top bottom or center and determines the vertical alignment of the tickmark.
Default: center

tickmarksStyleImageOffsetx
After the alignment has been applied, this is added to the X coordinate of the tickmark.
Default: 0

tickmarksStyleImageOffsety
After the alignment has been applied, this is added to the Y coordinate of the tickmark.
Default: 0

stepped
Draws the line as stepped. Useful for showing stock performance for example.
Default: false

linewidth
The width of the line (ie the actual line on the chart). Note: If your line is stepped and filled, and you don't want a trailing line indicating the last value, you can set this to zero.
Default: 1

animationUnfoldX
This is used by the unfold() Line chart animation and dictates whether the X value is unfolded.
Default: false

animationUnfoldY
This is used by the unfold() Line chart animation and dictates whether the Y value is unfolded.
Default: true

animationUnfoldInitial
This property can be used to set the initial factor for the unfold() animation. Setting this to a value less than one will cause the line to expand outwards, whilst a value greater than one will cause the line to contract towards the correct values.
Default: 2

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.

Updated: As of June 2016 you can also set this to halo to get a new style of highlighting. This style of highlighting doesn't work with the tooltipsHotspotXonly option.
Default: null

highlightStroke
If you use tooltips, this controls the color of the highlight stroke.
Default: black

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

spline
This option causes the line to be drawn as a spline - ie curvy. Not all options will work with splines - however the introduction of real splines over the previous curvy option is a significant improvement. There are numerous examples of this in the demos that are included in the download file. Null values will not work with splines.
Default: false

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

combinedEffect
Set this to the name of an effect (eg grow() ) and the CombinedChart object will use that effect to draw the chart instead of the regular draw() function.
Default: null

combinedEffectOptions
This should be a STRING that contains a JavaScript object of options for the effect function like this:

combinedchartEffectOptions: '{frames: 300}'
It has to be a string because of a quirk of the option parsing system.
Default: null

combinedEffectCallback
A function that runs when this objects effect has completed.
Default: null

dotted
Whether the line (not the background grid) is dotted or not. This is a new addition in January 2017 and is thanks to a submission by Garaged.
Default: false

dashed
Whether the line (not the background grid) is dashed or not. This is a new addition in January 2017 and is thanks to a submission by Garaged.
Default: false

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 easier to get hold of which point on the Line chart has been hovered over. It returns an array of:

The shape also includes textual indexes like this: shape['object'] And they are:

An example usage is:
<canvas id="cvs" width="600" height="300">[No canvas support]</canvas>

<script src="RGraph.common.core.js"></script>
<script src="RGraph.line.js"></script>

<script>
    var line = new RGraph.Line({
        id: 'cvs',
        data: [10,4,2,4,1],
        options: {
            marginInner: 10,
            tickmarksStyle: 'endcircle',
            xaxisLabels: ['Fred','John','Kev','Lou','Pete']
        }
    }).draw();
    
    
    line.canvas.onmousemove = function (e)
    {
        RGraph.fixEventObject(e);

        var ca  = e.target,
            co  = ca.getContext('2d'),
            obj = ca.__object__;
       
        // This is the method which simplifies getting coordinates
        var point = obj.getShape(e);
       
       
        if (point) {

            if (line.hidden(point.dataset)) {
                return;
            }
             
            ca.style.cursor = 'pointer';
             
            // Determine if this is the same tooltip as the one (if any) that's already being shown
            if (RGraph.Registry.get('chart.tooltip') && RGraph.Registry.get('chart.tooltip').__index__ == point[3]) {
                return;
            }

            // Redraw the chart
            RGraph.redraw();

            // Show the tooltip
             if (obj.get('xaxisLabels')[point[3]] !== undefined && obj.get('xaxisLabels')[point[3]] !== null) {


                // Show the tooltip
                 RGraph.tooltip(
                    obj,
                    obj.get('xaxisLabels')[point[3]].toString(),
                    e.pageX,
                    e.pageY,
                    point[3],
                    e
                );


                // Highlight the point
                co.strokeStyle = 'gray';
                co.fillStyle   = 'white';

                co.beginPath();
                    co.moveTo(point[1], point[2]);
                    co.arc(
                        point[1],
                        point[2],
                        2,
                        0,
                        6.26,
                        false
                    );
                co.stroke();
                co.fill();
            }
             
            return;
        }
         
        ca.style.cursor = 'default';
    }




    window.onclick = function ()
    {
        RGraph.redraw();
    }
</script>
obj.getValue(mixed)

This method can be used to get the value at a particular point or at the mouse coordinates based on the scale that is in use. Not simply the coordinates of the mouse. The argument can either be an event object (for use in event listener functions) OR a two element array consisting of the X and Y coordinates (ie when you're not necessarily in an event listener). It returns null if the mouse or coordinates are in the margin areas. An example:

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

This method can be used to get an appropriate Y coordinate for a value when you're doing custom drawing on the chart. It returns the coordinate for the maximum or minimum value if the given number is out of range.

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:

.on('draw', function (obj)
{
    // Put event code here
});
The exec option and method

The exec function is documented here.

obj.hide([index])

The hide function hides a line by setting the color to rgba(0,0,0,0). Tooltips and other interactive features still work even though the line is not visible. You can give an integer (the index of the relevant line), an array of line indexes, or no argument at all in which case all of the lines on the chart are hidden

obj.show([index])

This function is the reverse of the above.

obj.hidden(index)

This function returns true or false as to whether the given line index is hidden or not.

Errorbars

Errorbars can allow you to show an upper and lower range for a particular point like the example page line-errorbars.html in the download archive shows. You can specify errorbars like this:

var line = new RGraph.Line({
    id: 'cvs',
    data: [12,18,10,8,5,4,3,2,14,5,6,9],
    options: {
        yaxisScaleMin: 5,
        errorbars: [1, [1,5],[5,1,'red',10],3,3,3,3,3,3,3,3,3,3],
        //errorbarsLinewidth: 10,
        //errorbarsColor: 'red',
        //errorbarsCapped: false,
        //errorbarsCappedWidth: 50,
        marginInner: 15,
        tickmarksStyle: 'circle',
        xaxis: false
    }
}).draw();

This would give you errorbars for each point and the elements of each errorbar array are (each one is optional - specify null if you want to give no value):

Combining the Line and Bar charts

You can combine the Bar and Line charts. Find out more here. In the same vein, you can have Y axes on both the left and right sides.

Alternative colors

Instead of a string stipulating the color, each element of the colors array can be a two element array stipulating the up color, and the down color. To use alternating colors you must also stipulate the alternate property:

myLine.set('colors.alternate', true);
myLine.set('colors', ['red', ['blue', 'yellow'], 'green]);

Accumulative filled Line charts

The default behaviour of filled Line charts is to "stack" the lines on top of each other. This allows them all to be totally visible, no matter what (unless a line has a zero value of course). If this is not desired, then there is an option (filledAccumulative - true/false) to change this behaviour so that the lines are plotted "as-is". Keep in mind that if you set this option to false (ie the Lines are plotted as-is) it may be wiser to use semi-transparent colors or some parts of data sets (or even entire data sets) may be hidden by others. There's a comparison of the different modes here.

Custom tickmarks

If none of the available tickmark styles are suitable, you can instead specify a function object that draws the tickmark, enabling you to make the tickmark yourself. For example:

<script>
    line.set('tickmarksStyle', myTick);

    /**
    * The function that is called once per tickmark, to draw it
    * 
    * @param object obj   The chart object
    * @param array  data  The entire line data
    * @param number value The individual point's value
    * @param number index The current index in the data array
    * @param number x     The X coordinate
    * @param number y     The Y coordinate
    * @param string color The color of the line
    * @param number prevX The previous X coordinate
    * @param number prevY The previous Y coordinate
    */
    function myTick (obj, data, value, index, x, y, color, prevX, prevY)
    {
        // Draw your custom tickmark here
    }
</script>

As of August 2014 you can also specify an image to use as a tickmark. Various styles of URL are supported:

obj.set({tickmarksStyle: 'image:foo.png'});     // Starts with image: prefix
obj.set({tickmarksStyle: '/images/foo.png'});   // Starts with a /
obj.set({tickmarksStyle: '../images/foo.png'}); // Starts with ../
obj.set({tickmarksStyle: 'data: ...'});         // Starts with data: (for inline images)
obj.set({tickmarksStyle: 'images/foo.png'});    // Starts with images/

The coords2 array

An alternative method of indexing the chart coordinates is available in obj.coords2. With this array all of the first lines coordinates are available in obj.coords2[0], the second lines coordinates in obj.coords2[1] and so on.

The __index2__ property on tooltips

When showing tooltips, one property of the tooltip is __index2__. This is the index that pertains to the individual dataset. In a function called from the tooltip event you can access it like this:

function myFunc (obj)
{
    var idx = RGraph.Registry.get('chart.tooltip').__index2__;
}
RGraph.addCustomEventListener(obj, 'ontooltip', myFunc  );

Note about the data_arr array

Sometimes you may wish to view your data as one big array, instead of one array per dataset. In this case the obj.data_arr is available. This is one long array containing all of the individual data points.

Animation 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)
    {
        // ...
    }

    var obj = new RGraph.Gauge({
        id: 'cvs',
        min: 0,
        max: 100,
        value: 56,
        options: {
            marginLeft: 35,
            marginInner: 5
        }
    }).trace2({frames: 60}, myCallback)
    // .unfold({frames: 60}, myCallback)
    // .unfoldFromCenter({frames: 60}, myCallback)
    // .unfoldFromCenterTace({frames: 60}, myCallback)
    // .foldToCenter({frames: 60}, myCallback)
    // .trace2({frames: 60}, myCallback)
</script>