Scatter chart

Example

View example on CodePen
<script>
    tooltip = '%{key}';

    new RGraph.Scatter({
        id: 'cvs',
        data: [
            [
                [10,78,null,tooltip],
                [20,69,null,tooltip],
                [34,42,null,tooltip],
                [35,66,null,tooltip],
                [46,45,null,tooltip],
                [64,38,null,tooltip],
                [78,29,null,tooltip],
                [78,34,null,tooltip],
                [112,26,null,tooltip],
                [119,15,null,tooltip]
            ],
            [
                [186,54,'red',tooltip],
                [195,56,'red',tooltip],
                [210,58,'red',tooltip],
                [214,53,'blue',tooltip],
                [233,51,'red',tooltip],
                [245,48,'red',tooltip],
                [270,61,'red',tooltip],
                [281,43,'red',tooltip],
                [299,52,'red',tooltip],
                [312,77,'red',tooltip]
            ]
        ],
        options: {
            tooltipsFormattedKeyLabels: ['Richard','John','Luis','Pob','Pete','Olga','Kiffen','Hevin','Joy','Hoolio'],
            tooltipsFormattedKeyColors: ['black','red'],
            tooltipsCss: {
                fontSize: '16pt',
                boxShadow: '',
                textAlign: 'left'
            },
            trendline: true,
            trendlineColor: ['gray','red'],
            trendlineMargin: 5,
            backgroundGridBorder: false,
            backgroundGridVlines: false,
            yaxis: false,
            backgroundGridColor: '#eee',
            marginLeft: 30,
            xaxisLabels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
            xaxisScaleMax: 365,
            tickmarksSize: 10
        }
    }).draw();
</script>

Format of the data array (colors/tooltips)

Each point on the Scatter chart is made by supplying an array of up to 4 elements (from version 6.11 it can also be an object which has up to four properties - details below):

If you wish to specify a tooltip, but not a color (ie use the default color instead), you can pass null instead of a color.

<script>
    //
    // A single dataset
    //
    data = [
        [67,78],                            // A basic datapoint
        [67,40,'red'],                      // A datapoint with a color specified
        [150,26,'green','A tooltip!'],      // A datapoint with a color and tooltip specified
        [164,35, null, 'Just the tooltip'], // A datapoint with no color and a tooltip
    ];
    
    //
    // Multiple datasets
    //
    data = [
        [
            [67,78],                           // A basic datapoint
            [67,40,'red'],                     // A datapoint with a color specified
            [150,26,'green','A tooltip!'],     // A datapoint with a color and tooltip specified
            [164,35, null, 'Just the tooltip'] // A datapoint with no color and a tooltip
        ],
        [
            [7,41],
            [9,45,'red'],
            [8,23,'green','A tooltip!'],
            [15,32, null, 'Just the tooltip']
        ]
    ];
    
    

    new RGraph.Scatter({
        id: 'cvs',
        data: data,
        options: {
            xaxisScaleMax: 365
        }
    }).draw();
</script>

Object based point definitions

From version 6.11 the canvas Scatter chart can handle the array for each point being an object instead. You may find that this is easier to create and understand. There's an example of this below that shows the datasets from the above code converted to use objects instead.

<script>
    //
    // A single dataset
    //
    data = [
        {x: 67,  y: 78 },                                       // A basic datapoint
        {x: 67,  y: 40, color: 'red'},                          // A datapoint with a color specified
        {x: 150, y: 26, color: 'green', tooltip: 'A tooltip!'}, // A datapoint with a color and tooltip specified
        {x: 164, y: 35, tooltip: 'Just the tooltip'}            // A datapoint with no color and a tooltip
    ];
    
    //
    // Multiple datasets
    //
    data = [
        [
            {x: 67,  y: 78},                                        // A basic datapoint
            {x: 67,  y: 40, color: 'red'},                          // A datapoint with a color specified
            {x: 150, y: 26, color: 'green', tooltip: 'A tooltip!'}, // A datapoint with a color and tooltip specified
            {x: 164, y: 35, tooltip: 'Just the tooltip'}            // A datapoint with no color and a tooltip
        ],
        [
            {x: 7,  y: 41},
            {x: 9,  y: 45, color: 'red'},
            {x: 8,  y: 23, color: 'green', tooltip: 'A tooltip!'},
            {x: 15, y: 32, tooltip: 'Just the tooltip'}
        ]
    ];
    
    

    new RGraph.Scatter({
        id: 'cvs',
        data: data,
        options: {
            xaxisScaleMax: 365
        }
    }).draw();
</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 shown above.

Background properties

PropertyDescriptionDefault
backgroundColorIf you want to have a single background color for your chart you can use this. It doesn't cover the margins. If you want that then you can simply apply a css background color to the canvas tag.null
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:
myScatter.set('backgroundHbars', [[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
backgroundVbarsAn array of vertical bar information. They're specified like his:
myScatter.set('backgroundVbars', [[0, 181, 'rgba(0,255,0,0.5)']]);
Normally the values are:
  • The start value
  • The extent of the bar (the width in scale terms)
  • The color
However when you're using a Date/Time chart that isn't very practical - so when you're using Date/Time values the two values that you specify should be the start and end Date/Times like this:
obj.set('backgroundVbars', [['2013/06/01','2013/07/01','pink']]);
null
backgroundGridBorderDetermines whether a border is drawn around the grid.true
backgroundGridHlinesDetermines whether to draw the horizontal gridlines.true
backgroundGridVlinesDetermines whether to draw the vertical gridlines.true
backgroundGridHlinesCountWhen using autofit this allows you to specify how many horizontal gridlines you want.5
backgroundGridVlinesCountWhen using autofit this allows you to specify how many vertical gridlines you want.20
backgroundGridAlignIf you want to have your gridlines line up with the labels (both X and Y axes), you can set this to true and RGraph will attempt to make the gridlines line up.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 draw 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 coordinate of the image. The coordinates are the top left corner of the image.null
backgroundImageYThe Y coordinate 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
backgroundColor
If you want to have a single background color for your chart you can use this. It doesn't cover the margins. If you want that then you can simply apply a css background color to the canvas tag.
Default: null

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:
myScatter.set('backgroundHbars', [[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

backgroundVbars
An array of vertical bar information. They're specified like his:
myScatter.set('backgroundVbars', [[0, 181, 'rgba(0,255,0,0.5)']]);
Normally the values are: However when you're using a Date/Time chart that isn't very practical - so when you're using Date/Time values the two values that you specify should be the start and end Date/Times like this:
obj.set('backgroundVbars', [['2013/06/01','2013/07/01','pink']]);

Default: null

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

backgroundGridHlines
Determines whether to draw the horizontal gridlines.
Default: true

backgroundGridVlines
Determines whether to draw the vertical gridlines.
Default: true

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

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

backgroundGridAlign
If you want to have your gridlines line up with the labels (both X and Y axes), you can set this to true and RGraph will attempt to make the gridlines line up.
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 draw 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 coordinate of the image. The coordinates are the top left corner of the image.
Default: null

backgroundImageY
The Y coordinate 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

X-axis properties

PropertyDescriptionDefault
xaxisSet this to true if you don't want an x-axis.true
xaxisPositionThis determines where the x-axis is positioned. If you wish to show negative values then you should set this to center or you can now (Jul 2016) use an offset x-axis by leaving this property at the default bottom and using the yaxisScaleMax and yaxisScaleMin properties.bottom
xaxisLinewidthThe linewidth used for the x-axis and the x-axis tickmarks.1
xaxisColorThe color of the x-axis (and its tickmarks.black
xaxisTickmarksWhether the x-axis tickmarks are shown.true
xaxisTickmarksLastLeftWhether the last tickmark on the left is displayed.null
xaxisTickmarksLastRightWhether the last tickmark on the right is displayed.null
xaxisTickmarksLengthThe length of the tickmarks.3
xaxisTickmarksCountThe number of tickmarks that are shown on the x-axis.null
xaxisLabelsAn array of the labels to be used on the chart. You can also give this option a string if you prefer and use formatted labels.An empty array
xaxisLabelsFontThe font used to render the labels.null
xaxisLabelsSizeThe size of the labels.null
xaxisLabelsColorThe color of the labels.null
xaxisLabelsBoldWhether the labels are bold or not.null
xaxisLabelsItalicWhether the labels are italic or not.null
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
xaxisLabelsFormattedDecimalsWhen using formatted labels this is the number of decimals that are applied to the %{value_formatted} macro. 0
xaxisLabelsFormattedPointWhen using formatted labels this is the decimal point character that's used with the %{value_formatted} macro..
xaxisLabelsFormattedThousandWhen using formatted labels this is the thousand separator character that's used with the %{value_formatted} macro.,
xaxisLabelsFormattedUnitsPreWhen using formatted labels these are the units that are prepended to the number with the %{value_formatted} macro.(an empty string)
xaxisLabelsFormattedUnitsPostWhen using formatted labels these are the units that are appended to the number with the %{value_formatted} macro.(an empty string)
xaxisLabelsCountWhen using formatted labels you can specify how many labels there should be with this property.null
xaxisLabelsHalignThe horizontal alignment of the labels.center
xaxisLabelsValignThe vertical alignment of the labels.top
xaxisLabelsAngleThe angle of the x-axis labels. For example, you could set this to 45 to get angled labels.0 (Horizontal)
xaxisLabelsPositionThis property controls how the labels are arranged - section for most chart types and edge for Line charts. You probably won't need to change this.section
xaxisLabelsClassThis property allows you to add your own css class to the x-axis labels which you can then use for styling purposes or to make retrieving the span tags easier (the dom elements). If you inspect the labels in your browser's javascript console (you will first need to enable the textAccessiblePointerevents property) you will be able to see the other css classes that are assigned to the labels.[none]
xaxisLabelsSpecificAlignThis determines the alignment of the specific labels. You probably won't need this.left
xaxisScaleIf true then an X scale is drawn instead of X labels.false
xaxisScaleUnitsPreThese are units that are prepended to the number.none
xaxisScaleUnitsPostThese are units that are appended to the number.none
xaxisScaleDecimalsThe number of decimals used for the X scale. If not specified the scaleDecimals property is used.null
xaxisScaleFormatterThis can be a function that is passed the object and the number and should return a formatted number (formatted as you wish).
function myFormatter(opt)
{
    var obj = opt.object,
        num = opt.number;

    return num + 'F'; // An example of formatting
}
null
xaxisScaleLabelsCountThis is a number representing how many X labels there should be when you're using the X scale.10
xaxisScaleMinThe minimum x-axis value you wish to set. 0
xaxisScaleMaxThe maximum x-axis value you wish to set. For example, if you're displaying products sold in a year, you might use 365.none - must be supplied
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
xaxisTitleFontThis allows you to specify a font for the x-axis title.null
xaxisTitleBoldThis controls whether the x-axis title is bold or not.null
xaxisTitleItalicThis controls whether the x-axis title is italic or not.null
xaxisTitleColorThis controls the color of the x-axis title.null
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
xaxisTitleOffsetxThe horizontal pixel offset that's applied to the title. 0
xaxisTitleOffsetyThe vertical pixel offset that's applied to the title. 0
xaxisTitleHalignThe horizontal alignment of the title.center
xaxisTitleValignThe vertical alignment of the title.top
xaxisTitlePosThis is a multiplier (ie a digit usually between 0 and 1) that gets multiplied with the margin to get the Y position of the title.null
xaxis
Set this to true if you don't want an x-axis.
Default: true

xaxisPosition
This determines where the x-axis is positioned. If you wish to show negative values then you should set this to center or you can now (Jul 2016) use an offset x-axis by leaving this property at the default bottom and using the yaxisScaleMax and yaxisScaleMin properties.
Default: bottom

xaxisLinewidth
The linewidth used for the x-axis and the x-axis tickmarks.
Default: 1

xaxisColor
The color of the x-axis (and its tickmarks.
Default: black

xaxisTickmarks
Whether the x-axis tickmarks are shown.
Default: true

xaxisTickmarksLastLeft
Whether the last tickmark on the left is displayed.
Default: null

xaxisTickmarksLastRight
Whether the last tickmark on the right is displayed.
Default: null

xaxisTickmarksLength
The length of the tickmarks.
Default: 3

xaxisTickmarksCount
The number of tickmarks that are shown on the x-axis.
Default: null

xaxisLabels
An array of the labels to be used on the chart. You can also give this option a string if you prefer and use formatted labels.
Default: An empty array

xaxisLabelsFont
The font used to render the labels.
Default: null

xaxisLabelsSize
The size of the labels.
Default: null

xaxisLabelsColor
The color of the labels.
Default: null

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

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

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

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

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

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

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

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

xaxisLabelsCount
When using formatted labels you can specify how many labels there should be with this property.
Default: null

xaxisLabelsHalign
The horizontal alignment of the labels.
Default: center

xaxisLabelsValign
The vertical alignment of the labels.
Default: top

xaxisLabelsAngle
The angle of the x-axis labels. For example, you could set this to 45 to get angled labels.
Default: 0 (Horizontal)

xaxisLabelsPosition
This property controls how the labels are arranged - section for most chart types and edge for Line charts. You probably won't need to change this.
Default: section

xaxisLabelsClass
This property allows you to add your own css class to the x-axis labels which you can then use for styling purposes or to make retrieving the span tags easier (the dom elements). If you inspect the labels in your browser's javascript console (you will first need to enable the textAccessiblePointerevents property) you will be able to see the other css classes that are assigned to the labels.
Default: [none]

xaxisLabelsSpecificAlign
This determines the alignment of the specific labels. You probably won't need this.
Default: left

xaxisScale
If true then an X scale is drawn instead of X labels.
Default: false

xaxisScaleUnitsPre
These are units that are prepended to the number.
Default: none

xaxisScaleUnitsPost
These are units that are appended to the number.
Default: none

xaxisScaleDecimals
The number of decimals used for the X scale. If not specified the scaleDecimals property is used.
Default: null

xaxisScaleFormatter
This can be a function that is passed the object and the number and should return a formatted number (formatted as you wish).
function myFormatter(opt)
{
    var obj = opt.object,
        num = opt.number;

    return num + 'F'; // An example of formatting
}

Default: null

xaxisScaleLabelsCount
This is a number representing how many X labels there should be when you're using the X scale.
Default: 10

xaxisScaleMin
The minimum x-axis value you wish to set.
Default: 0

xaxisScaleMax
The maximum x-axis value you wish to set. For example, if you're displaying products sold in a year, you might use 365.
Default: none - must be supplied

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

xaxisTitleFont
This allows you to specify a font for the x-axis title.
Default: null

xaxisTitleBold
This controls whether the x-axis title is bold or not.
Default: null

xaxisTitleItalic
This controls whether the x-axis title is italic or not.
Default: null

xaxisTitleColor
This controls the color of the x-axis title.
Default: null

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

xaxisTitleOffsetx
The horizontal pixel offset that's applied to the title.
Default: 0

xaxisTitleOffsety
The vertical pixel offset that's applied to the title.
Default: 0

xaxisTitleHalign
The horizontal alignment of the title.
Default: center

xaxisTitleValign
The vertical alignment of the title.
Default: top

xaxisTitlePos
This is a multiplier (ie a digit usually between 0 and 1) that gets multiplied with the margin to get the Y position of the title.
Default: null

Y-axis properties

PropertyDescriptionDefault
yaxisWhether the y-axis is drawn.true
yaxisPositionSpecifies the y-axis position. Can be left or right.left
yaxisLinewidthThe linewidth of the y-axis.1
yaxisColorThe color of the y-axis.black
yaxisTickmarks.Whether the y-axis tickmarks are drawn.true
yaxisTickmarksLengthThe length of the y-axis tickmarks.3
yaxisTickmarksCountThis allows you to stipulate how many y-axis tickmarks there are.null (related to how many labels there are)
yaxisTickmarksLastTopWhether the top-most tickmark is drawn.null (displayed if the x-axis position warrants it)
yaxisTickmarksLastBottomWhether the bottom-most tickmark is drawn.null (displayed if the x-axis position warrants it)
yaxisLabelsCountA value that controls how many Y labels there are. This value could formerly be either 1/3/5/10 however now it can be any number.5
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
yaxisLabelsPositionThis controls how the specific labels are positioned on the y-axis. It does not affect a scale.edge
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
yaxisLabelsFontThe font that's used by the y-axis labels.null
yaxisLabelsSizeThe size of the y-axis labels.null
yaxisLabelsColorThe color of the y-axis labels.null
yaxisLabelsBoldWhether the y-axis labels are bold or not.null
yaxisLabelsItalicWhether the y-axis labels are italic or not.null
yaxisLabelsHalignThe horizontal alignment of the y-axis labels.null
yaxisLabelsValignThe vertical alignment of the y-axis labels.null
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
yaxisTitleColorThis controls what color the y-axis title is.null
yaxisTitleItalicThis controls whether the y-axis title is italic or not.null
yaxisTitlePosThis is multiplied with the margin to give the position of the y-axis title.0.25
yaxisTitleOffsetxThe pixel offset that's added to the y-axis titles X coordinate. 0
yaxisTitleOffsetyThe pixel offset that's added to the y-axis titles Y coordinate. 0
yaxisTitleXBy giving this you can specifically set the horizontal position of the y-axis title.null
yaxisTitleYBy giving this you can specifically set the vertical position of the y-axis title.null
yaxisTitleHalignThe horizontal alignment of the y-axis title. 0
yaxisTitleValignThe vertical alignment of the y-axis title. 0
yaxisTitleAccessibleWith this property you can control whether the y-axis title is accessible or not.true
yaxisScaleWhether the y-axis scale is displayed or not.true
yaxisScaleRoundWhether the y-axis scale is rounded up or not.false
yaxisScaleUnitsPreThe units that the y-axis is measured in. This string is displayed before the actual number, allowing you to specify values such as $50.none
yaxisScaleUnitsPostThe units that the y-axis is measured in. This string is displayed after the actual number, allowing you to specify values such as 50ms.none
yaxisScaleMaxThe optional maximum Y scale value. If not specified then it will be calculated.null (It's calculated)
yaxisScaleMinThe optional minimum Y scale value. If not specified then it will be 0. 0
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(opt)
{
    var num = Number(opt.number) * 5;

    return String(num)
}
obj.set('yaxisScaleFormatter', myFormatter);
null
yaxisScaleRoundWhether to round the scale up. eg A maximum value of 59 results in scale to 100.false
yaxisScaleDecimalsThe number of decimal places to display for the Y scale. 0
yaxisScalePointThe character that's used as the decimal point..
yaxisScaleThousandThe character that's used as the thousand separator.,
yaxisScaleInvertWhether the y-axis scale is inverted or not.false
yaxis
Whether the y-axis is drawn.
Default: true

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

yaxisLinewidth
The linewidth of the y-axis.
Default: 1

yaxisColor
The color of the y-axis.
Default: black

yaxisTickmarks.
Whether the y-axis tickmarks are drawn.
Default: true

yaxisTickmarksLength
The length of the y-axis tickmarks.
Default: 3

yaxisTickmarksCount
This allows you to stipulate how many y-axis tickmarks there are.
Default: null (related to how many labels there are)

yaxisTickmarksLastTop
Whether the top-most tickmark is drawn.
Default: null (displayed if the x-axis position warrants it)

yaxisTickmarksLastBottom
Whether the bottom-most tickmark is drawn.
Default: null (displayed if the x-axis position warrants it)

yaxisLabelsCount
A value that controls how many Y labels there are. This value could formerly be either 1/3/5/10 however now it can be any number.
Default: 5

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

yaxisLabelsPosition
This controls how the specific labels are positioned on the y-axis. It does not affect a scale.
Default: edge

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

yaxisLabelsFont
The font that's used by the y-axis labels.
Default: null

yaxisLabelsSize
The size of the y-axis labels.
Default: null

yaxisLabelsColor
The color of the y-axis labels.
Default: null

yaxisLabelsBold
Whether the y-axis labels are bold or not.
Default: null

yaxisLabelsItalic
Whether the y-axis labels are italic or not.
Default: null

yaxisLabelsHalign
The horizontal alignment of the y-axis labels.
Default: null

yaxisLabelsValign
The vertical alignment of the y-axis labels.
Default: null

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

yaxisTitleColor
This controls what color the y-axis title is.
Default: null

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

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

yaxisTitleOffsetx
The pixel offset that's added to the y-axis titles X coordinate.
Default: 0

yaxisTitleOffsety
The pixel offset that's added to the y-axis titles Y coordinate.
Default: 0

yaxisTitleX
By giving this you can specifically set the horizontal position of the y-axis title.
Default: null

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

yaxisTitleHalign
The horizontal alignment of the y-axis title.
Default: 0

yaxisTitleValign
The vertical alignment of the y-axis title.
Default: 0

yaxisTitleAccessible
With this property you can control whether the y-axis title is accessible or not.
Default: true

yaxisScale
Whether the y-axis scale is displayed or not.
Default: true

yaxisScaleRound
Whether the y-axis scale is rounded up or not.
Default: false

yaxisScaleUnitsPre
The units that the y-axis is measured in. This string is displayed before the actual number, allowing you to specify values such as $50.
Default: none

yaxisScaleUnitsPost
The units that the y-axis is measured in. This string is displayed after the actual number, allowing you to specify values such as 50ms.
Default: none

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

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

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(opt)
{
    var num = Number(opt.number) * 5;

    return String(num)
}
obj.set('yaxisScaleFormatter', myFormatter);

Default: null

yaxisScaleRound
Whether to round the scale up. eg A maximum value of 59 results in scale to 100.
Default: false

yaxisScaleDecimals
The number of decimal places to display for the Y scale.
Default: 0

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

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

yaxisScaleInvert
Whether the y-axis scale is inverted or not.
Default: false

Color properties

PropertyDescriptionDefault
colorsDefaultThis is the default color of tickmarks that is used if a color isn't given.#000
colorsBubbleGraduatedBy default the Bubble chart bubbles are graduated in color. By setting this to false you can disable the gradients and use flat colors.true
colorsBubbleStrokeIf you want a stroke around your bubbles (if you're showing a Bubble chart) you can set this to a color.null
colorsDefault
This is the default color of tickmarks that is used if a color isn't given.
Default: #000

colorsBubbleGraduated
By default the Bubble chart bubbles are graduated in color. By setting this to false you can disable the gradients and use flat colors.
Default: true

colorsBubbleStroke
If you want a stroke around your bubbles (if you're showing a Bubble chart) you can set this to a color.
Default: null

Labels and text properties

PropertyDescriptionDefault
labelsAboveIf true this will show the values of the points above them.false
labelsAboveFontThe font used to render the text.null
labelsAboveSizeIf you're showing the labels above the points, this controls their size.null
labelsAboveColorThe color of the text.null
labelsAboveBoldWhether the labels are bold or not.null
labelsAboveItalicWhether the labels are italic or not.null
labelsAboveDecimalsIf your points have lots of decimals, you use this option to curtail them. 0
labelsAboveFormatterXIf you need to format the X value then you can use this function to do so. An example function to format a DateTime value is:
labelsAboveFormatterX: function (obj, value)
{
    var d = new Date(value);
        date = d.getDate();
        month = d.getMonth();
        year  = d.getFullYear();
    
    return '{1}/{2}/{3}'.format(date, month, year);
},
null
labelsAboveFormatterYIf you need to format the X value then you can use this function to do so. An example function to format a DateTime value is:
labelsAboveFormatterY: function (obj, value)
{
    return value;
},
null
labelsAboveOffsetxThis allows you finer-grained control in the horizontal direction over the text positioning if you need it. 0
labelsAboveOffsetyThis allows you finer-grained control in the vertical direction over the text positioning if you need it. 0
labelsIngraphAn array of labels for the chart that 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 style 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
labelsIngraphOffsetxThis allows you finer-grained control in the horizontal direction over the text positioning if you need it. 0
labelsIngraphOffsetyThis allows you finer-grained control in the vertical direction over the text positioning if you need it. 0
textFontThe font used to render the text.Arial
textColorThe color of the labels.black
textSizeThe size of the text (in points).12
textBoldWhether the text is bold or not.false
textItalicWhether the text is bold or not.false
textAccessibleA new feature in 2016 that allows you to use dom text in place of canvas text. It makes for much higher quality text that you can also select if desired (for copy/paste operations). It won't fit all situations and you can read more about the DOM text feature here. A good way to control borders/margins/padding etc is not to set them on the canvas but to wrap the canvas in a div and set them on that like this:
<div style="margin-left: 50px; display: inline-block">
    <canvas id="cvs" width="650" height="250"></canvas>
</div>
false
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
textThis allows you to add custom text to your chart if you want to. There's a dedicated page that describes this option here.null
labelsAbove
If true this will show the values of the points above them.
Default: false

labelsAboveFont
The font used to render the text.
Default: null

labelsAboveSize
If you're showing the labels above the points, this controls their size.
Default: null

labelsAboveColor
The color of the text.
Default: null

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

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

labelsAboveDecimals
If your points have lots of decimals, you use this option to curtail them.
Default: 0

labelsAboveFormatterX
If you need to format the X value then you can use this function to do so. An example function to format a DateTime value is:
labelsAboveFormatterX: function (obj, value)
{
    var d = new Date(value);
        date = d.getDate();
        month = d.getMonth();
        year  = d.getFullYear();
    
    return '{1}/{2}/{3}'.format(date, month, year);
},

Default: null

labelsAboveFormatterY
If you need to format the X value then you can use this function to do so. An example function to format a DateTime value is:
labelsAboveFormatterY: function (obj, value)
{
    return value;
},

Default: null

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

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

labelsIngraph
An array of labels for the chart that 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 style 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

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

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

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

textColor
The color of the labels.
Default: black

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

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

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

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

Default: false

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

text
This allows you to add custom text to your chart if you want to. There's a dedicated page that describes this option here.
Default: null

Margin properties

PropertyDescriptionDefault
marginLeftThe left margin of the chart, (the margin is where the labels and title are)).35
marginRightThe right margin of the chart, (the margin is where the labels and title are).35
marginTopThe top margin of the chart, (the margin is where the labels and title are).35
marginBottomThe bottom margin of the chart, (the margin is where the labels and title are).35
marginLeft
The left margin of the chart, (the margin is where the labels and title are)).
Default: 35

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

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

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

Tickmark properties

PropertyDescriptionDefault
tickmarksStyleThe style of the tickmarks. Can be: cross, plus, circle, diamond, square or null (no tickmarks). As of August 2014, this can be a location of an image file to use as the tickmarks or a data: URL. See below for details. This property can also be a function which allows you to draw the tickmark yourself - details below.cross
tickmarksSizeThe size of the tickmarks.3
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
tickmarksStyle
The style of the tickmarks. Can be: cross, plus, circle, diamond, square or null (no tickmarks). As of August 2014, this can be a location of an image file to use as the tickmarks or a data: URL. See below for details. This property can also be a function which allows you to draw the tickmark yourself - details below.
Default: cross

tickmarksSize
The size of the tickmarks.
Default: 3

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

Title properties

PropertyDescriptionDefault
titleThe title of the chart, if any.null
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 4pt bigger than the textSize setting.null
titleBoldWhether the title is bold or not.null
titleItalicWhether the title is italic or not.null
titleColorThe color of 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
titleHalignThe horizontal alignment of the title.center (can change depending on other options)
titleValignThe vertical alignment of the title.center (can change depending on other options)
titleOffsetxYou can use this property to adjust the positioning of the title in the horizontal direction (positive values adjust the title to the right and negative values adjust it to the left). 0
titleOffsetyYou can use this property to adjust the positioning of the title in the vertical direction (positive values adjust the title downwards and negative values adjust it upwards). 0
titleSubtitleThe subtitle of the chart. If a subtitle is specified the title is moved up to accommodate it. As such you might need to give a larger marginTop value.null
titleSubtitleSizeThe size of the font used to render the subtitle.null
titleSubtitleColorThe color of the subtitle.#aaa
titleSubtitleFontThe font used to render the subtitle.null
titleSubtitleBoldWhether the subtitle is bold or not.null
titleSubtitleItalicWhether the subtitle is italic or not.null
titleSubtitleOffsetxUse this property to adjust the horizontal position of the subtitle. 0
titleSubtitleOffsetyUse this property to adjust the vertical position of the subtitle. 0
title
The title of the chart, if any.
Default: null

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 4pt bigger than the textSize setting.
Default: null

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

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

titleColor
The color of 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

titleHalign
The horizontal alignment of the title.
Default: center (can change depending on other options)

titleValign
The vertical alignment of the title.
Default: center (can change depending on other options)

titleOffsetx
You can use this property to adjust the positioning of the title in the horizontal direction (positive values adjust the title to the right and negative values adjust it to the left).
Default: 0

titleOffsety
You can use this property to adjust the positioning of the title in the vertical direction (positive values adjust the title downwards and negative values adjust it upwards).
Default: 0

titleSubtitle
The subtitle of the chart. If a subtitle is specified the title is moved up to accommodate it. As such you might need to give a larger marginTop value.
Default: null

titleSubtitleSize
The size of the font used to render the subtitle.
Default: null

titleSubtitleColor
The color of the subtitle.
Default: #aaa

titleSubtitleFont
The font used to render the subtitle.
Default: null

titleSubtitleBold
Whether the subtitle is bold or not.
Default: null

titleSubtitleItalic
Whether the subtitle is italic or not.
Default: null

titleSubtitleOffsetx
Use this property to adjust the horizontal position of the subtitle.
Default: 0

titleSubtitleOffsety
Use this property to adjust the vertical position of the subtitle.
Default: 0

Interactive features properties

PropertyDescriptionDefault
tooltipsEffectThe effect used for showing tooltips. Possible values are slide fade or none.slide
tooltipsHotspotThis controls the size of the hotspot on the chart for tooltips.3
tooltipsHighlightSet this to false if you don't want your charts to be highlighted.true
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
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's 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 (a css border, for example) then specify an object containing those values to this property. For example:
tooltipsPointerCss: {
    borderLeft: 'gray 2px solid',
    borderBottom: 'gray 2px solid'
}
null
tooltipsPointerOffsetxThis allows you to adjust the vertical position of the tooltips pointer. 0
tooltipsPointerOffsetyThis allows you to adjust the vertical position of the tooltips pointer (for example, if you add a border you may need to move it down slightly). 0
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'
}
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
tooltipsHotspotIgnoreThis can be a number of things and can be used to ignore certain tooltip hotspots - which can allow charts to the rear to be clickable. There's an example of this in the download archive called pie-tooltipshotspotignore.html. You can use the transparent color to allow the rear chart to be seen in such a case. It can be:
  • A single boolean value (ie true or false) to enable or disable all of the hotspots - true means the hotspot will be ignored
  • A single number (the zero-indexed number corresponding to the hotspot to ignore)
  • An array of numbers (the numbers are the indexes of hotspots to ignore)
  • An array of boolean true or false values - the position of these values correspond to the index(es) of the segments to ignore (for example [false, false, true, false, false] - true means the corresponding hotspot will be ignored)
null
crosshairsIf true, you will get a crosshair centering on the current mouse position.false
crosshairsLinewidthThis controls the linewidth of the crosshairs.1
crosshairsColorThe color of the crosshairs.#333
crosshairsCoordsIf true, this will show the coordinates that the crosshairs are currently over.false
crosshairsCoordsFixedIf true, this makes the coordinates static (attached), instead of following the pointer around.false
crosshairsCoordsLabelsXInstead of X and Y, you can specify more meaningful labels.X
crosshairsCoordsLabelsYInstead of X and Y, you can specify more meaningful labels.Y
crosshairsCoordsFormatterXThis can be a function with which you can format the value to appear just as you want. Simply return the value that you wish to be displayed. The single argument is an object that has two properties: object (which is the chart object) and value (which is the X value).null
crosshairsCoordsFormatterYThis can be a function with which you can format the value to appear just as you want. Simply return the value that you wish to be displayed. The single argument is an object that has two properties: object (which is the chart object) and value (which is the Y value).null
crosshairsHlineThis determines whether the horizontal crosshair line is shown.true
crosshairsVlineThis determines whether the vertical crosshair line is shown.true
contextmenuAn array of context menu items. More information about context menus is here.An empty array
adjustableWhether the chart can be adjusted by dragging the points on the chart around.false
adjustableOnlyThis should be an array of values that determine whether a point is adjustable or not. A true value for when it is, a false value for when it's not.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
tooltipsEffect
The effect used for showing tooltips. Possible values are slide fade or none.
Default: slide

tooltipsHotspot
This controls the size of the hotspot on the chart for tooltips.
Default: 3

tooltipsHighlight
Set this to false if you don't want your charts to be highlighted.
Default: true

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

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's 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 (a css border, for example) then specify an object containing those values to this property. For example:
tooltipsPointerCss: {
    borderLeft: 'gray 2px solid',
    borderBottom: 'gray 2px solid'
}

Default: null

tooltipsPointerOffsetx
This allows you to adjust the vertical position of the tooltips pointer.
Default: 0

tooltipsPointerOffsety
This allows you to adjust the vertical position of the tooltips pointer (for example, if you add a border you may need to move it down slightly).
Default: 0

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'
}

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

tooltipsHotspotIgnore
This can be a number of things and can be used to ignore certain tooltip hotspots - which can allow charts to the rear to be clickable. There's an example of this in the download archive called pie-tooltipshotspotignore.html. You can use the transparent color to allow the rear chart to be seen in such a case. It can be:
Default: null

crosshairs
If true, you will get a crosshair centering 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

crosshairsCoords
If true, this will show the coordinates that the crosshairs are currently over.
Default: false

crosshairsCoordsFixed
If true, this makes the coordinates static (attached), instead of following the pointer around.
Default: false

crosshairsCoordsLabelsX
Instead of X and Y, you can specify more meaningful labels.
Default: X

crosshairsCoordsLabelsY
Instead of X and Y, you can specify more meaningful labels.
Default: Y

crosshairsCoordsFormatterX
This can be a function with which you can format the value to appear just as you want. Simply return the value that you wish to be displayed. The single argument is an object that has two properties: object (which is the chart object) and value (which is the X value).
Default: null

crosshairsCoordsFormatterY
This can be a function with which you can format the value to appear just as you want. Simply return the value that you wish to be displayed. The single argument is an object that has two properties: object (which is the chart object) and value (which is the Y value).
Default: null

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

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

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

adjustable
Whether the chart can be adjusted by dragging the points on the chart around.
Default: false

adjustableOnly
This should be an array of values that determine whether a point is adjustable or not. A true value for when it is, a false value for when it's not.
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

Line properties

PropertyDescriptionDefault
lineWhether to show a connecting line (like in the sixth example).false
lineColorsThe colors of the lines connecting the tickmarks.['green', 'red']
lineShadowColorThe color of the shadow of the line (if any).rgba(0,0,0,0)
lineShadowOffsetxThe horizontal offset of the shadow.3
lineShadowOffsetyThe vertical offset of the shadow.3
lineShadowBlurThe severity of the shadows blurring effect.2
lineSteppedLike the Line chart, Scatter chart lines can be stepped by setting this to true.false
lineLinewidthThis can be either a number or an array of numbers (for multiple lines) and controls the linewidth that is used for the lines.1
lineDashWith this setting you can control the linedash setting so your lines can be dashed (or dotted).

Note: Browser support is limited (but growing) for dashed/dotted lines - so depending on your browser you may see just a solid line.
null
line
Whether to show a connecting line (like in the sixth example).
Default: false

lineColors
The colors of the lines connecting the tickmarks.
Default: ['green', 'red']

lineShadowColor
The color of the shadow of the line (if any).
Default: rgba(0,0,0,0)

lineShadowOffsetx
The horizontal offset of the shadow.
Default: 3

lineShadowOffsety
The vertical offset of the shadow.
Default: 3

lineShadowBlur
The severity of the shadows blurring effect.
Default: 2

lineStepped
Like the Line chart, Scatter chart lines can be stepped by setting this to true.
Default: false

lineLinewidth
This can be either a number or an array of numbers (for multiple lines) and controls the linewidth that is used for the lines.
Default: 1

lineDash
With this setting you can control the linedash setting so your lines can be dashed (or dotted).

Note: Browser support is limited (but growing) for dashed/dotted lines - so depending on your browser you may see just a solid line.
Default: null

Trend line properties

PropertyDescriptionDefault
trendlineIf you want it to RGraph can generate a "best-fit" trend line for your data. This can be both a boolean or an array of boolean values for when you have multiple datasets.false
trendlineColorsUse this property to specify either a single color or an array of colors for the trend line(s).[gray]
trendlineLinewidthUse this property to specify the linewidth of the trend line(s). It can be a single number or an array of numbers if you have multiple datasets.1
trendlineMarginUse this property to specify the margin of the trend line(s). It can be a single number or an array of numbers if you have multiple datasets.25
trendlineDashedIf true then the trend lines on the chart will be dashed.true
trendlineDottedIf true then the trend lines on the chart will be dotted,false
trendlineDashArrayIf you want to give your own style of dashes then you can with this. It should be an array containing numbers - alternating between the length of a dash and the length of a gap after the dash.null
trendlineClippingIf set to false then the chart will not be clipped to the area that the tickmarks are located in. This means that the trend line will cover the whole of the chart area (albeit with a small margin and you can turn this off with the trendlineMargin property).null
trendline
If you want it to RGraph can generate a "best-fit" trend line for your data. This can be both a boolean or an array of boolean values for when you have multiple datasets.
Default: false

trendlineColors
Use this property to specify either a single color or an array of colors for the trend line(s).
Default: [gray]

trendlineLinewidth
Use this property to specify the linewidth of the trend line(s). It can be a single number or an array of numbers if you have multiple datasets.
Default: 1

trendlineMargin
Use this property to specify the margin of the trend line(s). It can be a single number or an array of numbers if you have multiple datasets.
Default: 25

trendlineDashed
If true then the trend lines on the chart will be dashed.
Default: true

trendlineDotted
If true then the trend lines on the chart will be dotted,
Default: false

trendlineDashArray
If you want to give your own style of dashes then you can with this. It should be an array containing numbers - alternating between the length of a dash and the length of a gap after the dash.
Default: null

trendlineClipping
If set to false then the chart will not be clipped to the area that the tickmarks are located in. This means that the trend line will cover the whole of the chart area (albeit with a small margin and you can turn this off with the trendlineMargin property).
Default: null

Bubble properties

PropertyDescriptionDefault
bubbleMinThe minimum value that the bubble represents 0
bubbleMaxThe maximum value that the bubble representsnull
bubbleWidthThe maximum width of a bubble on the chartnull
bubbleDataThe bubble values for each of the points on the chartnull
bubbleLinewidthAllows you to set the linewidth of the stroke around the bubbles if you have one.1
bubbleShadowWhether shadows for the bubbles are enabled or not.false
bubbleShadowColorThe color of the bubble shadows.#aaa
bubbleShadowOffsetxThe horizontal offset for the bubble shadows.2
bubbleShadowOffsetyThe vertical offset for the bubble shadows.2
bubbleShadowBlurThe extent of the blurring effect for the bubble shadows.3
bubbleMin
The minimum value that the bubble represents
Default: 0

bubbleMax
The maximum value that the bubble represents
Default: null

bubbleWidth
The maximum width of a bubble on the chart
Default: null

bubbleData
The bubble values for each of the points on the chart
Default: null

bubbleLinewidth
Allows you to set the linewidth of the stroke around the bubbles if you have one.
Default: 1

bubbleShadow
Whether shadows for the bubbles are enabled or not.
Default: false

bubbleShadowColor
The color of the bubble shadows.
Default: #aaa

bubbleShadowOffsetx
The horizontal offset for the bubble shadows.
Default: 2

bubbleShadowOffsety
The vertical offset for the bubble shadows.
Default: 2

bubbleShadowBlur
The extent of the blurring effect for the bubble shadows.
Default: 3

Lasso properties

PropertyDescriptionDefault
lassoThe Lasso feature allows you to select points on your chart with your mouse. You can draw rectangles around them and then use the callback function to integrate into your own code.false
lassoStrokeThe color of the outline of the square highlight area.#006
lassoFillThe color of the fill of the square highlight area.#0064
lassoLinewidthThe linewidth of the outline of the square highlight area.1
lassoHighlightStrokeWhen a point on the chart is highlighted - this is the color of the stroke.transparent
lassoHighlightFillWhen a point on the chart is highlighted - this is the color of the fill.red
lassoHighlightLinewidthWhen a point on the chart is highlighted - this is the linewidth of the stroke.1
lassoCallbackWhen an area is highlighted this function is called - allowing you to call your own code. The function is passed a state object and you can access the state.points property to get a list of datasets/indexes of points which are highlighted. For example:
// ...
lassoCallback: function (state)
{
    // You can access the state.points array to get the points which are highlighted
}
// ...
null
lassoClearCallbackAnother callback function which is called when the lasso areas are cleared. Note that this event can be called multiple times.null
lassoPersistThis controls whether the lasso data (the selected areas and points) is persisted across page refreshes or not. By default persistence just uses the window.localStorage variable to store information.false
lassoPersistLocalBy default, persistence uses the window.localStorage variable to store the data. If you use the lassoPersistSave and lassoPersistLoad properties to store data somewhere else you might not want this to occur - so, using this property, you can turn it off.true
lassoPersistSaveUsing this property you can integrate the loading and saving into your own backend software. For example, by using this function you can make an ajax call to save the persistence information to your server. For example:
// ...
lassoPersistSave: function (state)
{
    // You can access the state.points array to get the points which are highlighted
}
// ...
null
lassoPersistLoadComplementing the above property, by using this property you can integrate the loading and saving into your own backend software. For example, by using this function you can make an ajax call to load the persistence information from your server. For example:
// ...
lassoPersistLoad: function ()
{
    // Load the persistence data here and return it

    // return data;
}
// ...
null
lasso
The Lasso feature allows you to select points on your chart with your mouse. You can draw rectangles around them and then use the callback function to integrate into your own code.
Default: false

lassoStroke
The color of the outline of the square highlight area.
Default: #006

lassoFill
The color of the fill of the square highlight area.
Default: #0064

lassoLinewidth
The linewidth of the outline of the square highlight area.
Default: 1

lassoHighlightStroke
When a point on the chart is highlighted - this is the color of the stroke.
Default: transparent

lassoHighlightFill
When a point on the chart is highlighted - this is the color of the fill.
Default: red

lassoHighlightLinewidth
When a point on the chart is highlighted - this is the linewidth of the stroke.
Default: 1

lassoCallback
When an area is highlighted this function is called - allowing you to call your own code. The function is passed a state object and you can access the state.points property to get a list of datasets/indexes of points which are highlighted. For example:
// ...
lassoCallback: function (state)
{
    // You can access the state.points array to get the points which are highlighted
}
// ...

Default: null

lassoClearCallback
Another callback function which is called when the lasso areas are cleared. Note that this event can be called multiple times.
Default: null

lassoPersist
This controls whether the lasso data (the selected areas and points) is persisted across page refreshes or not. By default persistence just uses the window.localStorage variable to store information.
Default: false

lassoPersistLocal
By default, persistence uses the window.localStorage variable to store the data. If you use the lassoPersistSave and lassoPersistLoad properties to store data somewhere else you might not want this to occur - so, using this property, you can turn it off.
Default: true

lassoPersistSave
Using this property you can integrate the loading and saving into your own backend software. For example, by using this function you can make an ajax call to save the persistence information to your server. For example:
// ...
lassoPersistSave: function (state)
{
    // You can access the state.points array to get the points which are highlighted
}
// ...

Default: null

lassoPersistLoad
Complementing the above property, by using this property you can integrate the loading and saving into your own backend software. For example, by using this function you can make an ajax call to load the persistence information from your server. For example:
// ...
lassoPersistLoad: function ()
{
    // Load the persistence data here and return it

    // return data;
}
// ...

Default: null

Key properties

The key properties are documented on the key documentation page.

Marimekko properties

PropertyDescriptionDefault
marimekkoLinewidthThis is the linewidth of the stroke that's used around the segments.15
marimekkoColorsAn array of colors that are used for the segments on the chart.['#faa', '#afa', '#aaf', '#ffa', '#faf', '#aff']
marimekkoColorsStrokeThe color of the stroke that's used on the chart.transparent
marimekkoColorsSequentialBy default, the colors that you give with the marimekkoColors property are used in order, for each bar. With this property set to true though the colors are used in the order that you give across the whole set of bars.false
marimekkoLabelsUse this property to specify an array of labels which are placed above the bars in the top margin. This can either be an array of simple strings, an array of strings that use substitution macros or a string that uses substitution macros. This last option is probably the most useful option. Read the formatted labels documentation for more information on this last option.null
marimekkoLabelsColorThe color of the labels. It falls back to the textColor property.null
marimekkoLabelsSizeThe size of the labels. It falls back to the textSize property.null
marimekkoLabelsFontThe font that's used for the labels. It falls back to the textFont property.null
marimekkoLabelsBoldWhether the labels are bold or not. It falls back to the textBold property.null
marimekkoLabelsItalicWhether the labels are italic or not. It falls back to the textItalic property.null
marimekkoLabelsOffsetxIf you want to adjust the position of the labels slightly in the horizontal direction you can do so with this property. 0
marimekkoLabelsOffsetyIf you want to adjust the position of the labels slightly in the vertical direction you can do so with this property. 0
marimekkoLabelsFormattedDecimalsWhen using formatted labels this is the number of decimals that are applied to the %{value_formatted} macro. 0
marimekkoLabelsFormattedPointWhen using formatted labels this is the decimal point character that's used with the %{value_formatted} macro..
marimekkoLabelsFormattedThousandWhen using formatted labels this is the thousand separator character that's used with the %{value_formatted} macro.,
marimekkoLabelsFormattedUnitsPreWhen using formatted labels these are the units that are prepended to the number with the %{value_formatted} macro.[none]
marimekkoLabelsFormattedUnitsPostWhen using formatted labels these are the units that are appended to the number with the %{value_formatted} macro.[none]
marimekkoLabelsIngraphThis can be true or false and determines whether labels are drawn inside the bars - showing the value.false
marimekkoLabelsIngraphColorThis is the color of the ingraph labels. It defaults to the textColor property.null
marimekkoLabelsIngraphSizeThis is the size of the ingraph labels.10
marimekkoLabelsIngraphFontThis is the font that's used for the ingraph labels. It defaults to the textFont property.null
marimekkoLabelsIngraphBoldWhether the labels are bold or not. It defaults to the textBold property.null
marimekkoLabelsIngraphItalicWhether the labels are italic or not. It defaults to the textItalic property.null
marimekkoLabelsIngraphUnitsPreUnits which are appended to the label.[none]
marimekkoLabelsIngraphUnitsPostUnits which are prepended to the label.[none]
marimekkoLabelsIngraphPointThe character(s) used as the decimal point..
marimekkoLabelsIngraphThousandThe character(s) used as the thousand seperator.,
marimekkoLabelsIngraphDecimalsThe number of decimals that are displayed on labels.0
marimekkoLabelsIngraphOffsetxIf you want to adjust the position of the labels slightly in the horizontal direction you can do so with this property.0
marimekkoLabelsIngraphOffsetyIf you want to adjust the position of the labels slightly in the vertical direction you can do so with this property.0
marimekkoLabelsIngraphBackgroundFillThe fill color for the background of the labels.#fffa
marimekkoLabelsIngraphBackgroundStrokeThe stroke color for the background of the labels.transparent
marimekkoLabelsIngraphSpecificThis property can be used to specify the exact labels that you want to appear on the chart. You can specify text as well as numbers if you wish.null
marimekkoLinewidth
This is the linewidth of the stroke that's used around the segments.
Default: 15

marimekkoColors
An array of colors that are used for the segments on the chart.
Default: ['#faa', '#afa', '#aaf', '#ffa', '#faf', '#aff']

marimekkoColorsStroke
The color of the stroke that's used on the chart.
Default: transparent

marimekkoColorsSequential
By default, the colors that you give with the marimekkoColors property are used in order, for each bar. With this property set to true though the colors are used in the order that you give across the whole set of bars.
Default: false

marimekkoLabels
Use this property to specify an array of labels which are placed above the bars in the top margin. This can either be an array of simple strings, an array of strings that use substitution macros or a string that uses substitution macros. This last option is probably the most useful option. Read the formatted labels documentation for more information on this last option.
Default: null

marimekkoLabelsColor
The color of the labels. It falls back to the textColor property.
Default: null

marimekkoLabelsSize
The size of the labels. It falls back to the textSize property.
Default: null

marimekkoLabelsFont
The font that's used for the labels. It falls back to the textFont property.
Default: null

marimekkoLabelsBold
Whether the labels are bold or not. It falls back to the textBold property.
Default: null

marimekkoLabelsItalic
Whether the labels are italic or not. It falls back to the textItalic property.
Default: null

marimekkoLabelsOffsetx
If you want to adjust the position of the labels slightly in the horizontal direction you can do so with this property.
Default: 0

marimekkoLabelsOffsety
If you want to adjust the position of the labels slightly in the vertical direction you can do so with this property.
Default: 0

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

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

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

marimekkoLabelsFormattedUnitsPre
When using formatted labels these are the units that are prepended to the number with the %{value_formatted} macro.
Default: [none]

marimekkoLabelsFormattedUnitsPost
When using formatted labels these are the units that are appended to the number with the %{value_formatted} macro.
Default: [none]

marimekkoLabelsIngraph
This can be true or false and determines whether labels are drawn inside the bars - showing the value.
Default: false

marimekkoLabelsIngraphColor
This is the color of the ingraph labels. It defaults to the textColor property.
Default: null

marimekkoLabelsIngraphSize
This is the size of the ingraph labels.
Default: 10

marimekkoLabelsIngraphFont
This is the font that's used for the ingraph labels. It defaults to the textFont property.
Default: null

marimekkoLabelsIngraphBold
Whether the labels are bold or not. It defaults to the textBold property.
Default: null

marimekkoLabelsIngraphItalic
Whether the labels are italic or not. It defaults to the textItalic property.
Default: null

marimekkoLabelsIngraphUnitsPre
Units which are appended to the label.
Default: [none]

marimekkoLabelsIngraphUnitsPost
Units which are prepended to the label.
Default: [none]

marimekkoLabelsIngraphPoint
The character(s) used as the decimal point.
Default: .

marimekkoLabelsIngraphThousand
The character(s) used as the thousand seperator.
Default: ,

marimekkoLabelsIngraphDecimals
The number of decimals that are displayed on labels.
Default: 0

marimekkoLabelsIngraphOffsetx
If you want to adjust the position of the labels slightly in the horizontal direction you can do so with this property.
Default: 0

marimekkoLabelsIngraphOffsety
If you want to adjust the position of the labels slightly in the vertical direction you can do so with this property.
Default: 0

marimekkoLabelsIngraphBackgroundFill
The fill color for the background of the labels.
Default: #fffa

marimekkoLabelsIngraphBackgroundStroke
The stroke color for the background of the labels.
Default: transparent

marimekkoLabelsIngraphSpecific
This property can be used to specify the exact labels that you want to appear on the chart. You can specify text as well as numbers if you wish.
Default: null

Miscellaneous properties

PropertyDescriptionDefault
highlightStyleBy default this is null but you can set it to a function if you wish so that function is called to do the chart highlighting. It's passed the shape object as an argument. 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
boxplotWidthThis stipulates the default width of boxes. For more on boxplots, see here.10
boxplotCappedThis stipulates whether the boxplot will have caps on the end of the whiskers. This could be useful if you're creating a stock chart for example. For more on boxplots, see here.true
cleartoThis is used in animations and effects as the default color to use when clearing the canvas.null
outofboundsIf you've set a yaxisScaleMax but you still want to see marks drawn that go above this maximum then you'll need to set this property to true.false
horizontalLines With this property you can add horizontal lines to your chart. This feature was initially designed with adding an average line indicator in mind but can be used to indicate any value with any label. The value of this property should be an array of objects and each object can consist of the following:
  • value: The value you want the line positioned at or the keyword average (default: average)
  • color: The color of the line (default: #666)
  • dashed: Whether the line is dashed or not (default: true)
  • dotted: Whether the line is dotted or not (default: false)
  • linewidth: The linewidth of the line (default: 1)
  • label: this is The label that appears above (by default) the line. If you don't want a label you can set this to an empty string. default: Average (%{value})
  • labelPosition: This can be a string that consists of the following keywords: left/center/right/left-margin/right-margin top/bottom (default: top right)
  • labelFont: The font that the label is drawn in (default: [the same as the textFont property])
  • labelColor: The color that the label is drawn in (default: #666)
  • labelSize: The size of the label (in points) (default: 4 points less than the textSize setting)
  • labelBold: Whether the label is bold or not (default: null [falls back to the textBold setting])
  • labelItalic: Whether the label is italic or not (default: null [falls back to the textItalic setting])
  • labelValueDecimals: How many decimals are shown on the number. (default: 2)
  • labelValuePoint: The character used as the decimal point. (default: .)
  • labelValueThousand: The character used as the thousand separator charactor.(default: ,)
  • labelValueUnitsPre: This string is prended to the number. (default: [an empty string])
  • labelValueUnitsPost: This string is appended to the number. (default: [an empty string])
  • labelOffsetx: The horizontal offset that's applied to the X coordinate. (default: 0)
  • labelOffsety: The vertical offset that's applied to the Y coordinate. (default: 0)
  • labelValueFormatter: This function handles ALL of the formatting of the number. (default: null)
Here's an example:
obj.set('horizontalLines', [
    {
        value: 'average',
        dashed: true,
        labelPosition:'left bottom'
    },
    {
        value: 10.48,
        label:'Value (%{value})',
        labelValueDecimals: 2,
        labelValueThousand: ',',
        labelValuePoint:'.',
        labelValueUnitsPre:'',
        labelValueUnitsPost:''
        //labelValueFormatter: function (opt)
        //{
        //    return opt.number;
        //}
    }
]);
null
responsiveThis option is new to the July 2023 release (v6.13) and allows you to inline the responsive configuration instead of appending it on to the end of the object it as a function. The documentation and demo pages have been updated to use this new option. You can read more about the responsive feature by reading the responsive configuration page.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

boxplotWidth
This stipulates the default width of boxes. For more on boxplots, see here.
Default: 10

boxplotCapped
This stipulates whether the boxplot will have caps on the end of the whiskers. This could be useful if you're creating a stock chart for example. For more on boxplots, see here.
Default: true

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

outofbounds
If you've set a yaxisScaleMax but you still want to see marks drawn that go above this maximum then you'll need to set this property to true.
Default: false

horizontalLines
With this property you can add horizontal lines to your chart. This feature was initially designed with adding an average line indicator in mind but can be used to indicate any value with any label. The value of this property should be an array of objects and each object can consist of the following: Here's an example:
obj.set('horizontalLines', [
    {
        value: 'average',
        dashed: true,
        labelPosition:'left bottom'
    },
    {
        value: 10.48,
        label:'Value (%{value})',
        labelValueDecimals: 2,
        labelValueThousand: ',',
        labelValuePoint:'.',
        labelValueUnitsPre:'',
        labelValueUnitsPost:''
        //labelValueFormatter: function (opt)
        //{
        //    return opt.number;
        //}
    }
]);

Default: null

responsive
This option is new to the July 2023 release (v6.13) and allows you to inline the responsive configuration instead of appending it on to the end of the object it as a function. The documentation and demo pages have been updated to use this new option. You can read more about the responsive feature by reading the responsive configuration page.
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 function makes it easier to get hold of which point on the Scatter chart has been clicked or hovered over. It returns an object that has the following properties:

object The chart object
x The X coordinate
y The Y coordinate
dataset The zero-indexed dataset (the Scatter chart supports multiple datasets).
index The zero-indexed index of the point.
sequentialIndex The zero-indexed sequential index of the point. For example, on a chart where there are three datasets of three points each - this goes from 0 up to 8.
tooltip If a tooltip is associated with this point this will be it.id: strings are expanded for you (where the tooltip text is retrieved from the html tag with the matching ID).
Example usage is:
<script>
    scatter.canvas.onmousemove = function (e)
    {
        var canvas  = e.target;
        var obj     = canvas.__object__;
        var shape   = obj.getShape(e);

        if (shape) {
            obj.path(
                'b a % % 5 0 6.29 f red',
                shape.x, shape.y
            );
        }
    }
</script>

In boxplots the shape object is slightly different:

object The chart object
x The X coordinate
y The Y coordinate
width The width of the bar
height The height of the bar
dataset The zero-indexed dataset. Scatter charts can have multiple datasets and this indicates the dataset index.
index The zero-indexed index of the box.
sequentialIndex The zero-indexed sequential index of the box.
tooltip If a tooltip is associated with this box this will be it. id: strings are expanded for you (where the tooltip text is retrieved from the html tag with the matching ID).
Example usage is:
<script>
    scatter.canvas.onclick = function (e)
    {
        RGraph.redraw();
    
        var canvas = e.target,
            obj    = canvas.__object__,
            shape  = obj.getShape(e);

        if (shape) {
            obj.path(
                'lc square lj square b r % % % % f red',
                shape.x, shape.y, shape.width, shape.height
            );
        }
    }
</script>

obj.getXValue(mixed)

This method can be used to get the X value at a particular point or at the mouse coordinates, based on the X maximum value that is being used. 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.


obj.getYValue(mixed)

This method can be used to get the Y 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.


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 max/min value if the given number is out of range.


obj.getXCoord(value)

This method can be used to get an appropriate X coordinate for a value when you're doing custom drawing on the chart. It returns null if the given number is out of range. If you're using a Date/Time chart with the min and max set to Date/Time strings you can also pass this function a Date/Time string eg:

obj.getXCoord('2013-06-12T15:14:16');

obj.on(event, function)

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

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

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

<script>
    new RGraph.Scatter({
        id: 'cvs',
        data: [ [12,35],[23,53],[35,35],[45,58],[56,55],[86,86] ],
        options: {
            xaxisScaleMax: 100
        }
    }).on('draw', function (obj)
    {
        // Put your draw event code here

    }).on('click', function (e, shape)
    {
        // Put your click event code here
    }).draw();
</script>
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 have angled labels or show shorter versions of them completely.

Update: There is now the responsive configuration option available to you and this is now the preferred method of configuration.

The responsive function and configuration option are documented on their own page here.

Box/Whisker (candlestick) plots

Instead of a single Y value, you can specify an array of 5, 6, 7 or 8 values, which will be used to make a box plot (also known as a candlestick plot). These values are (in order):

<script>
    new RGraph.Scatter({
        id: 'scatter8',
        data: [
            [10,[1,1,16,24,24, 'red', 'green']],
            [105,[5,10,15,25,25, 'red', 'green']],
            [125,[10,15,25,35,45, 'red', 'green']],
            [325,[10,15,25,35,45, 'red', 'green', 30]]
        ],
        options: {
            title: 'An example of a boxplot',
            xaxisLabels: ['Q1', 'Q2', 'Q3', 'Q4'],
            xaxisScaleMax: 365,
            yaxisScaleMax: 50,
            boxplotWidth: 12 // the default width
        }
    }).draw();
</script>

Capped ends

For better compatibility with stock charts, you can now specify that the horizontal lines at the ends of the box plot are not shown with the boxplotCapped option.

Specific points for labels on the x-axis

Instead of a simple string that's used as the label, each entry of the labels array can be a two-element array consisting of the label and the X value that the label should be placed at. For example:

scatter.set({
    xaxisLabels:[
        ['Quarter 1', 0],
        ['Quarter 2', 90],
        ['Quarter 3', 181],
        ['Quarter 4', 273]
    ]
});

Custom tickmarks

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

<script>
    //
    // The function that is called once per tickmark, to draw it
    // 
    // @param object obj           The chart object
    // @param object data          The chart data
    // @param number x             The X coordinate
    // @param number y             The Y coordinate
    // @param number xValue        The X value
    // @param number yValue        The Y value
    // @param number xMax          The maximum X scale value
    // @param number yMax          The maximum Y scale value
    // @param string color         The color of the tickmark
    // @param number dataset       The index of the data (which starts at zero
    // @param number index         The index of the data in the dataset (which starts at zero)
    //
    // You can set the function in the regular chart configuration:
    //
    tickmarksStyle: function (obj, data, x, y, xValue, yValue, xMax, yMax, color, dataset, index)
    {
        // Draw your custom tick here
    },
    
    //
    // Or you can set it seperately using the obj.set() function:
    //
    line.set('tickmarksStyle', function (obj, data, x, y, xValue, yValue, xMax, yMax, color, dataset, index)
    {
        // Draw your custom tick 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({tickmarks: 'image:foo.png'});     // Starts with image: prefix
obj.set({tickmarks: '/images/foo.png'});   // Starts with a /
obj.set({tickmarks: '../images/foo.png'}); // Starts with ../
obj.set({tickmarks: 'data: ...'});         // Starts with data: (for inline images)
obj.set({tickmarks: 'images/foo.png'});    // Starts with images/

Note about colors and the key

If you're using a key you may need to set lineColors to allow it to use the correct colors. For example:

obj.set('lineColors', ['red','green','blue']);

Note about the crosshairs event

With the Scatter chart you can use the crosshairs custom event to pull out the crosshair coordinates like this (the coordinates are only available if you have them displayed):

function myFunc (obj)
{
    var xCoord = obj.canvas.__crosshairs_x__;
    var yCoord = obj.canvas.__crosshairs_y__;
}
RGraph.addCustomEventListener(obj, 'crosshairs', function ()
{
    // Handle the event here
});

Adding a trend line to your chart

Since version 5.22 RGraph has supported trend lines on the Scatter chart. This is as easy as setting the trendline option to true and RGraph will calculate the best-fit line for your data. The Scatter chart example linked at the top of the page is using the trendline option and there's also an example shown below:

<script>
    new RGraph.Scatter({
        id: 'cvs',
        data: [[1,56],[2,45],[3,48],[4,65],[5,66],[6,70],[7,71],[8,69],[9,75],[8,76]],
        options: {
            yaxisScaleMax:100,
            yaxisScaleMin:40,
            xaxisScaleMax: 10,
            xaxisLabels: ['A','B','C','D','E','F','G'],
            
            trendline: true,
            trendlineColor: 'red',
            trendlineDashed: false
        }
    }).draw();
</script>

There are a few ways to configure the lines which you can see in the trend line section of the api documentation.

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. Remember that with the Scatter chart the data points themselves are arrays/objects of X/Y/color/tooltip etc information.

DateTime based charts

Instead of using a number as the X coordinate, you can use a DateTime value instead. Likewise, you can use the same style Date/Time values as the xaxisScaleMin and xaxisScaleMax values. The underlying Date/Time parsing uses the Date.parse function (via the RGraph.parseDate function) so you can use values such as: 2012-01-01 00:00:00 There's an example of a Date/Time chart in the download archive (scatter-date-time-values.html)

 

Update (version 5.25) - Moment.js added to RGraph
The Date/Time parsing in RGraph is versatile and recognises a lot of formats. The Moment.js library however is a dedicated library for parsing and manipulating dates and times. From version 5.25 the Moment.js library is bundled with RGraph. You can include it in your page by including the file RGraph.common.moment.js in your page. Once you've done that you can use the Moment.js api to manipulate dates as you require. Here's a very simplistic example of using Moment.js to set the minimum and maximum values of a Scatter chart:

new RGraph.Scatter({
    id: 'cvs',
    data: data,
    options: {
        tickmarksSize: 10,
        xaxisTickmarksCount: 7,
        xaxisScaleMin: moment('2020-01-01'),
        xaxisScaleMax: moment('2020-01-01').add(1, 'year'),
        backgroundGridVlines: false,
        marginRight: 100
    }
}).draw();

The html tag to include the Moment.js library in your page is this:

    <script src="RGraph.moment.js"></script>

 

Bubble charts

The RGraph Scatter chart can show Bubble charts natively. From version 5.26 the way you make Bubble charts has changed and been integrated into the Scatter chart.

There's an example of the code that's necessary to show this type of chart shown below. The various properties are:

PropertyDescriptionDefault
bubbleMinThe minimum value that the bubble represents 0
bubbleMaxThe maximum value that the bubble representsnull
bubbleWidthThe maximum width of a bubble on the chartnull
bubbleDataThe bubble values for each of the points on the chartnull
bubbleLinewidthAllows you to set the linewidth of the stroke around the bubbles if you have one.1
bubbleShadowWhether shadows for the bubbles are enabled or not.false
bubbleShadowColorThe color of the bubble shadows.#aaa
bubbleShadowOffsetxThe horizontal offset for the bubble shadows.2
bubbleShadowOffsetyThe vertical offset for the bubble shadows.2
bubbleShadowBlurThe extent of the blurring effect for the bubble shadows.3
bubbleMin
The minimum value that the bubble represents
Default: 0

bubbleMax
The maximum value that the bubble represents
Default: null

bubbleWidth
The maximum width of a bubble on the chart
Default: null

bubbleData
The bubble values for each of the points on the chart
Default: null

bubbleLinewidth
Allows you to set the linewidth of the stroke around the bubbles if you have one.
Default: 1

bubbleShadow
Whether shadows for the bubbles are enabled or not.
Default: false

bubbleShadowColor
The color of the bubble shadows.
Default: #aaa

bubbleShadowOffsetx
The horizontal offset for the bubble shadows.
Default: 2

bubbleShadowOffsety
The vertical offset for the bubble shadows.
Default: 2

bubbleShadowBlur
The extent of the blurring effect for the bubble shadows.
Default: 3

<script>
    // Create and configure the Scatter chart
    scatter = new RGraph.Scatter({
        id: 'cvs',
        data: [
            [30,15,  'red',   'Red bubble tooltip'],
            [60,5,   'blue',  'Blue bubble tooltip'],
            [90,8,   'pink',  'Pink bubble tooltip'],
            [120,19, 'green', 'Green bubble tooltip'],
            [150,14, 'gray',  'Gray bubble tooltip'],
            [50,12,  'red',   'Red bubble tooltip'],
            [180,24, 'gray',  'Gray bubble tooltip'],
            [250,21, 'black', 'Black bubble tooltip']
        ],
        options: {
            xaxisScaleMax: 365,
            xaxisLabels: ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],
            textSize:14,
            backgroundGridVlines: false,
            backgroundGridBorder: false,
            xaxisTickmarks:false,
            yaxisTickmarks:false,
            xaxisLinewidth: 2,
            yaxisLinewidth: 2,
            tooltipsHotspot: 10,
            title: 'A bubble chart',
            titleBold: true,
            titleSize: 16,
            titleY: '-5',
            
            bubbleMin: 0,
            bubbleMax: 100,
            bubbleWidth: 50,
            bubbleData: [60,60,70,80,90,84,86,87]
        }
    }).draw().on('mouseout', function (e)
    {
        RGraph.hideTooltip();
        RGraph.redraw();
    });
</script>

 

The Lasso feature

View example on CodePen

The Lasso feature is new in version 6.13 - it allows you to select points on your Scatter chart and highlight them. There are a number of properties that are available to you that allow you to customise that appearance and how the feature behaves (for example a callback function so that you can integrate it into your existing code along with persistence, custom persistence load/save functions and appearance customisation). You can read the property descriptions here.

Note: There's an obj.clearLassoState() function that you can use if you want to clear the current selections. You'll need to call RGraph.redraw() after using this function. For example:

<button onclick="myScatter.clearLassoState(); RGraph.redraw();">Reset the canvas</button>

Here's a full example:

<script>    
    data = [
        [10,1],[10,2],[10,3],[10,4],[10,5],
        [20,1],[20,2],[20,3],[20,4],[20,5],
        [30,1],[30,2],[30,3],[30,4],[30,5],
        [40,1],[40,2],[40,3, 'red', 'Hello!'],[40,4],[40,5],
        [50,1],[50,2],[50,3],[50,4],[50,5],
        [60,1],[60,2],[60,3],[60,4],[60,5]
    ];
    
    // Create and configure the Scatter chart
    scatter = new RGraph.Scatter({
        id: 'cvs',
        data: data,
        options: {
            lasso: true,
            //lassoStroke: '#006',
            //lassoFill: '#f006',
            //lassoLinewidth: 1,
            //lassoHighlightLinewidth: 2,
            //lassoHighlightStroke: '#0000',
            //lassoHighlightFill: 'red',
            
            //This callback is called what points are cleared
            //
            //lassoClearCallback: function (state)
            //{
            //    $c(state);
            //},
            
            // When points are selected - this callback function
            // is called
            //
            //lassoCallback: function (state)
            //{
            //    //$c(state);
            //},
            
            // Whether to enable persistence or not. If nothing
            // else is specified then the state information is
            // stored in the window.localStorage variable
            lassoPersist: true,
            
            // Store the state information in the browser-based
            // window.localStorage variable
            lassoPersistLocal: true,
    
            //lassoPersistSave: function (state)
            //{
            //    // Store the state information (for example,
            //    // in a database). The state information is
            //    // in the form of a JSON object.
            //
            //    console.log(state);
            //},
            //lassoPersistLoad: function ()
            //{
            //    // Get the data (for example, from a database,
            //    // and return it (it should be a valid JavaScript
            //    // object).
            //    //
            //    // return state;
            //},
    
            xaxisScaleMax: 365,
            backgroundGridVlines: false,
            backgroundGridBorder: false,
            xaxis: false,
            yaxis: false,
            tickmarksStyle: 'circle',
            tickmarksSize: 8,
        }
    }).draw();
</script>

Also, you can double-click on a selection rectangle that you've added to remove it. And you can double click on an empty area of the canvas to get rid of all of the selection rectangles.

Marimekko charts

[No canvas support]

The RGraph Scatter chart now (v6.14+) has the ability to create Marimekko charts. These could be likened to Histogram charts or stacked Bar charts because of the way that they present data. Each stack of segments can take up an arbitrary amount of space depending on the proportion of the X value. The array of Y values that you provide is then organised much like a stacked Bar chart with the values converted to percentages so the total Y value adds up to 100%. The code that creates the chart that's shown here is below.

div style="clear: both">
<script src="RGraph.common.core.js" ></script>
<script src="RGraph.common.dynamic.js" ></script>
<script src="RGraph.common.tooltips.js" ></script>
<script src="RGraph.scatter.js" ></script>

<script>
    // Use the dedicate Marimekko class to create the chart
    new RGraph.Scatter.Marimekko({
        id: 'cvs',
        data: [], // The Marimekko data is given as a property instead of here
        options: {
            
            // The Marimekko data
            marimekkoData:[
                [5,[4,8,6,6]],
                [3,[4,5,1,1]],
                [6,[9,6,3,2]],
                [4,[8,5,2,3]]
            ],
            marimekkoLabels: ['John','Larry','Peter','Barry'],
            marimekkoLabelsIngraph: true,
            marimekkoLabelsIngraphUnitsPost: '%',
            marimekkoTooltips: '%{property:marimekkoLabels[%{dataset}]} on %{property:days[%{index}]}',

            days: ['Monday','Tuesday','Wednesday','Thursday'],
            marginLeft: 80,
            tooltipsCss: {
                fontSize: '20pt'
            },
            xaxisScale: true,
            xaxisScaleUnitsPost: '%'
        }
    }).draw().responsive([
        {maxWidth:null,width:700,height:350,options:{textSize: 20,marimekkoLabelsIngraphSize:14},parentCss:{'float':'right', textAlign: ''}},
        {maxWidth:750,width:400,height:200,options:{textSize: 10, marimekkoLabelsIngraphSize:10},parentCss:{'float':'none', textAlign: 'center'}}
    ]);
</script>

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.Scatter({
    id: 'cvs',
    data: [[5,3],[6,5],[4,8]],
    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)
    {
        // ...
    }

    new RGraph.Scatter({
        id: 'cvs',
        data: [[5,5],[10,10],[15,15],[20,20]],
        options: {
            xaxisScaleMax: 90
        }
    }).trace({frames: 60}, myCallback)
</script>