RGraph is a JavaScript charts library based on
HTML5 SVG and canvas. RGraph is mature (over 17 years
old) and has a wealth of features making it an ideal
choice to use for showing charts on your website.
Version 7.01 (released in October 2025) is the
latest version of RGraph and now includes a new tree
structure object. The accompanying Treemenu object can then turn
the object into a fully dynamic tree menu.
You can read the API documentation for the tree on
the main API documentation page
and see an example of the Treemenu
feature by following this link...
In the April 2025 (v6.21) release a new datagrid object
was added.
This makes it easy to add static or dynamic data
tables to your pages. It can be used whether you use the
canvas or SVG libraries or entirely standalone.
Get the latest version of RGraph (version 7.01, 8th October 2025) from
the download page. You can read the changelog here. There's also older versions available,
minified files and links to cdnjs.com hosted libraries.
This is information about the CSS classes
available to you to allow you to customise the appearance
of various things.
The available classes
Name: RGraph_png
Description:
This controls the appearance of the png image which is shown when you use the contextmenu option RGraph.showPNG.
Name: RGraph_palette
Description:
This controls the appearance of the mini-palette that can be used with annotating.
Name: RGraph_contextmenu
Description:
This controls how context menus appear. The default is similar to the look that Windows XP had.
Name: RGraph_contextmenu_item
Description:
This controls how individual items on the context menu will appear. The default has roughly 25px padding-left to accommodate the left bar.
Name: RGraph_contextmenu_background
Description:
This is the Windows XP style left vertical bar. By default, this is light grey.
Name: RGraph_tooltip
Description:
This controls the appearance of tooltips. The default is to be black and white.
Name: RGraph_tooltipsFormattedKeyColor
Description:
This can be used to configure the color square in the tooltips key.
Name: ModalDialog_background
Description:
This class controls the dark semi-opaque background for the ModalDialog.
Name: ModalDialog_dialog
Description:
This class controls the ModalDialog itself.
Name: ModalDialog_topbar
Description:
This class controls the top bar for the ModalDialog. You could for example, use the display CSS property to hide this if you don't want it. If you do that, you'll probably also want to reduce the padding-top value using the ModalDialog_dialog class too.
Example usage
Here is an example of using the CSS classes. At the time of
writing, some of the items here were only implemented in newer
web browsers:
If you're attempting to override default styles, then because of
the ordering (ie the script is setting the style AFTER
your own CSS) you may need to use the !important modifier, for
example:
<style>
.RGraph_tooltip {
background-color: white !important;
}
</style>
CSS classes added to accessible text
As of September 2019, the accessible text that RGraph uses has had various CSS classes added to the
span tags that the text sits in. This makes it far easier for you to manipulate
and select the text that RGraph adds to the chart with your own CSS.
These classes are:
Name: rgraph_accessible_text
Description:
Added to all of RGraphs accessible text.
Name: rgraph_accessible_text_canvas_[canvas ID]
Description:
Added to all of RGraphs accessible text with that canvas id.
Name: rgraph_accessible_text_[tag]
Description:
The tag is the internal RGraph label that's added to the text (eg title, labels, scale etc).
Name: rgraph_accessible_text_[chart type]
Description:
The chart type is the same for all text on the same chart type (eg bar, line, pie).
The tooltips CSS configuration property
Since version 5.22 a new property has been added to both the canvas and SVG charts in RGraph:
tooltipsCSS This property can be used like this:
Notice that the javascript versions of the property names are used - so replace hyphens with
capitals and the float property is called cssFloat.
The CSS that is applied using this method applies only to this chart - no matter how many charts
are on the page. This is different from using the RGraph.tooltips.style variable
because those CSS styles are applied to the tooltips of every chart on the page.