About
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
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...
New HTML datagrid
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.
Download
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.
License
RGraph can be used for free under the GPL or if
that doesn't suit your situation there's an
inexpensive (£129) commercial license available.Release notes for 2023
- December 2023 (v6.15)
- September 2023 (v6.14)
- July 2023 (v6.13)
- April 2023 (v6.12)
- February 2023 (v6.11)
- January 2023 (v6.10)
December 2023 (v6.15)
- As a bit of a test, the Activity chart can now accept property names in any case (ie upper-case or lower-case) you choose to use - not just that which is listed on the api documention page. If no problems are reported then this change will be made to all of the chart types.
- The SVG Bar chart now supports the adjustable option. By extension, and since the Vertical Progress bar makes use of the Bar chart library this means that the SVG Vertical Progress bar can also be made to be adjustable. There are new demos in the download archive that show this in action: svg-bar-adjustable.html svg-bar-adjustable-grouped.html and svg-bar-vprogress-adjustable.html
- The Horizontal Bar chart property labelsAboveBackground has been added.
- There are now three new properties for the canvas Funnel chart (which are already part of the SVG Funnel chart). These are: backgroundBars (true or false), backgroundBarsOpacity (a number) and backgroundBarsColors (an array of colors). There's a new demo that's part of the download archive that demonstrates these bars called funnel-key-stages.html
- You can now have rounded corners on the canvas Gantt chart. You can use the corners and cornersRoundRadius properties to control the extent of the rounding.
- RGraph now has a YouTube channel There's not a great deal of content on there at the moment - a few walk-thrus of some of the demos (eg the bar-basic.html and bar-100-pc.html demos (which you can see in the download archive). More videos will be coming!
- The Horizontal Progress bar and the Vertical Progress bar can now be made to be rounded by using the corners and cornersRoundRadius properties.
- The beveled option has been removed from the Vertical Progress bar and the Horizontal Progress bar.
- Added support to both the canvas and SVG Horizontal Bar chart for filled Vertical Line charts.
- Added the backgroundBorder properties to the code that draws the background for the following chart types: bar gantt hbar line scatter waterfall for both the canvas and SVG charts.
- Charts that use a background now have two new events associated with them - beforebackground and background. Charts affected are those that use the common background drawing code, for example Bar charts Line charts Gantt charts Horizontal Bar charts Scatter charts Waterfall charts and the drawing api Background object.
- The canvas Semi-circular Progress bar backgroundBackdrop and backgroundBackdropColor properties have been changed to backgroundFill and backgroundFillColor There's some backwards compatibilty code to accommodate the change so you don't need to rush to immediately update your configuration(s) if you upgrade.
- Added the backgroundBackdropColor property to the canvas Semi-circular progress bar
- The sample code blocks on the RGraph website now have a copy link at the top right corner which copies the contents of the code block to the clipboard. The demo pages in the download archive also have this link on them. Also, the demo pages now create the pre sections dynamically based on the source code in the page. This makes the demo pages smaller and more maintainable.
- The Bar chart HBar chart Line chart and Scatter chart have all had the crosshairsSnapToScale option added.This snaps the relevant crosshair line to the scale values. The crosshairsDashed and crosshairsDotted options have also been added.
- Added the backgroundGridDashArray property to the following canvas charts: Bar chart Horizontal Bar chart Line chart Scatter chart and the Waterfall chart.
September 2023 (v6.14)
- The SVG Line chart had the tooltipsDataset option added. This option allows you to add one tooltip for each dataset instead of for each point on the line(s).
- The Radar chart backgroundCircles* properties have been changed to backgroundGrid*. You don't have to immediately change your charts though as there's some backwards compatiblity code that accommodates this change.
- A drawing api Line object has been added. Simply give this object two or more coordinate pairs and this will draw you a line. Like other drawing api objects it can have tooltips and events.
- A Pie chart bug was fixed which appeared when the labelsIngraph option was being used. Thanks to Joachim Schmidt for the help with this.
- The Scatter chart can now be made adjustable. This means that you can click and drag points around the chart.
- With the Bar chart Line chart and Scatter chart when the axes were drawn there was a chunk missing from the corner where the Y-axis joined the first tickmark. This has now been fixed.
- The canvas Scatter chart now has support for Marimekko charts. Also known as Mosaic charts or Mekko charts, these can be likened to a two-dimensional 100% stacked Bar chart.
- When you're using Pie chart sticks the sticks are no longer drawn when there is no corresponding label.
- The SVG tooltipsOffsetx and tooltipsOffsety weren't fully working with static tooltip positioning. This has been fixed.
- The properties tooltipsPointerOffsetx and tooltipsPointerOffsety have been added to both both canvas and SVG libraries.
July 2023 (v6.13)
- The SVG Scatter chart now has a trace effect just like the Line chart. This may look strange when you're using the Scatter chart to produce a Vertical Line chart as it always animates from left to right. However, when you're producing a Vertical Line chart then you may want to instead look at using the Horizontal Bar chart. You can read the relevant properties on the SVG Horizontal Bar chart API documentation page and there's a blog article (with an example) about producing a Vertical Line chart here.
- Fixed a missing background grid line in the canvas Horizontal Bar chart which became apparent when the X-axis was turned off.
-
A significant change to the way that you specify the
responsive clauses on your chart (though this change
doesn't at all mean that you have to alter all of
your charts). The change is how you specify the
responsive clauses when you define your chart - you
can now put them in the main configuration of the
chart instead of calling the responsive
function after you call the draw
function. The code shown below highlights the new
way that you can put the responsive clauses.
<script> new RGraph.Bar({ id: 'cvs', data: [12,18,10,9,6,20,18], options: { yaxisScaleUnitsPost: 'k', colors: ['red'], title: 'A basic responsive Bar chart', titleBold: true, xaxis: false, yaxis: false, marginLeft: 50, marginBottom: 50, // // The new way of specifying your responsive clauses // responsive: [ {maxWidth: 900, width: 400, height: 150, options: {textSize:10, xaxisLabels: ['Mon\n(yuck!)','Tue','Wed','Thu','Fri\n(woo!)','Sat','Sun'], marginInner: 10}}, {maxWidth: null, width: 750, height: 250, options: {textSize:14, xaxisLabels: ['Monday\n(yuck!)','Tuesday','Wednesday','Thursday','Friday\n(woo!)','Saturday','Sunday'], marginInner: 20}} ] } }).draw(); </script>This change isn't at all mandatory - you can still use the existing method if you prefer - it's your choice! - The SVG Gauge chart now has a simple background grid effect (just some lines that emanate from the center out to the edge.) You can disable it if you want to and also stipulate the color.
- The canvas Line chart trendline now animates as well as the line if you use the trace animation effect.
- The reponsive function had a small bug in it that prevented the setting of new colors in an updated configuration. This has been fixed.
- The Bar chart labelsAbove property, for some time now, has not been showing decimals correctly. This has now been remedied so that what you specify with the property labelsAboveDecimals will be what you see. The positioning of the labels has also been slightly adjusted - so you might need to reduce or remove entirely any labelsAboveOffsety that you may have set.
-
A new color macro has been added to formatted tooltips:
- %{color:red}
- %{color:%{property:myColor}}
- %{color:%{property:colors[%{dataset}]}}
- %{color:%{property:colors [%{index}]}}
- The Horizontal Bar chart has been able to have rounded ends for some time - however, the feature only worked when you had a regular chart with the y-axis on the left-hand-side. Now, however, you can have rounded ends to your bars regardless of where the y-axis is or whether you have a regular, stacked or grouped chart.
- You can currently have rounded corners on your Bar chart by setting the corners property to round - you can now control whether the left and right corners are rounded individually with the cornersRoundLeft and cornersRoundRight properties. You can also set the radius of the corners individually as well with the cornersRoundLeftRadius and cornersRoundRightRadius properties.
- A new feature has come to the canvas Scatter chart - the lasso options. These options, when enabled, allow you to draw rectangles around some (or all) of the points on your chart. A callback function is then called which is passed a list of the selected dataset and index numbers which you can use to integrate into your own code. The feature is mentioned in the documentation page here and the API documentation for the Lasso feature is here. It can also make use of the window.localStorage variable to enable easy persistence across page refreshes.
- Added the highlightDatasetEvent property to the canvas Line chart which defaults to click. You can set this to mousemove to change the event that highlights the relevant dataset.
- Added the missing annotating properties to the canvas Gauge chart documentation
- Added the Semi-circular Progress bar property backgroundBackdrop
- The RGraph.common.core.js library now contains a new function: RGraph.arrayRemoveNull This function does what the name suggests and when you pass it an array the null values in the array will be removed. By default, objects aren't touched however if you give an object as the second argument which has the key objects (for example RGraph.arrayRemoveNull(myArray, {objects: true})) then null values will be removed from objects too. If you give a value parameter to the options array null values will NOT be removed, but substituted with that value instead. You can see the API docs for the RGraph.arrayRemoveNull function here.
- The canvas Pie chart now has a new set of labelsInside properties for use when you're showing a Donut chart. These properties allow you to show labels inside the Donut ring - instead of traditional labels which are placed around the outside of the Donut.
April 2023 (v6.12)
- The SVG Semi-circular Progress bar now has an adjustable option. There's a demo in the download archive called svg-scp-adjustable.html that demonstrates this.
-
There's now a better way to produce Vertical Line charts. Previously these were achieved by using
the Scatter chart and adjusting the data so that
a vertical line was produced. Now, however, you can
use the Horizontal Bar charts to get a vertical line
in a simpler way. There are four demos in
the download archive
that show it - two for canvas and two
for SVG - called:
- hbar-vertical-line.html
- hbar-vertical-line-multiple.html
- svg-hbar-vertical-line.html
- svg-hbar-vertical-line-multiple.html
new RGraph.HBar({ id: 'cvs', data: [4,5,7,4,2,4,6,8,6,5], options: { backgroundGridHlines: false, backgroundGridBorder: false, xaxis: false, yaxis: false, colors: ['transparent'], yaxisLabels: [ 'John','Fredericko','Bono','Lucy','Charles', 'Peter','Brian','Jilly','Peter','Lucy' ], textSize: 18, title: 'A vertical line chart', marginTop: 50, line: true, lineLinewidth: 10, lineTickmarksStyle: 'circle', lineTickmarksSize: 8 } }).trace(); - The Line chart tooltipsDataset option has been updated to make use of the new obj.over and obj.highlightDataset functions. It now works better with filled charts.
- The Line chart has two new methods: obj.over(x, y) and obj.highlightDataset(options). These methods help you to identify the dataset thats being hovered over (if any) and subsequently highlight it. These functions can be used to programmatically highlight a dataset using other controls or processes on the page. There's also a new set of properties - the highlightDataset properties which make doing this a breeze and makes it vey familiar if you're already comfortable with how RGraph charts are configured. There are new demos that show the new dataset highlighting and a few updated ones too (see the API documentation for their names).
-
The Odometer now supports multiple values for each
of the needle properties - corresponding to multiple
needles if you have them. The properties are:
needleWidth needleLength
needleColor needleHead
needleTail needleType and
needleTriangleBorder Because of this
update the needleExtra option has been
removed and now you specify multiple values with the
value: option to the object like this:
new RGraph.Odometer({ id: 'cvs', min: 0, max: 100, // Specify two values to be indicated on the chart value: [13,25], options: { } }).draw(); - When the RScatter chart highlights a point on the chart (for example because of tooltips), the highlighting now covers the whole point instead of just the center.
- The Pie chart labelsIngraph option now has the ability to check to see if a label will fit inside the relevant section. If not, then the label can be omitted or it can be drawn as a regular label that's placed outside of the Pie chart. The undrawn labels are added to the labelsIngraphUndrawn property
-
The tooltipsHotspotIgnore property has
been added to the canvas libraries. This
property can be a variety of things:
- A boolean value (ignore all of the hotspots)
- A number value (the index to ignore)
- An array of number values (the indexes to ignore)
- An array of boolean values (if true, then that index will be ignored)
- The Semi-circular Progress bar has been updated and can now have rounded ends using the new variant: 'rounded' property. There's a demo of this in the download archive called demos/semicircularprogress-rounded.html This demo also shows how you can use the text property that's common to all chart types to add custom text to your chart. In this demo, two pieces of custom text are added and they're centered using the firstdraw RGraph event. You can see an image of this new demo on the RGraph Facebook page.
-
Libraries based on canvas and that use
the key have had formatted keys added. This means
that you can now do this:
key: '%{properties:myLabels[%{index}]}: %{value_formatted}kg'Formatted key labels work in a very similar way to how formatted tooltips work. - The key has been added to the Semi-circular Progress bar. This includes the new formatted tooltips as well as the interactive key.
February 2023 (v6.11)
- There's a new api function: RGraph.runOnce which takes two arguments: a unique ID for the function (which can be any piece of text) and the function to run.
- When drawing ingraph labels on the Pie chart you can now access a new property: labelsIngraphUndrawn which contains the indexes of labels which weren't drawn (because there wasn't sufficient space in the segment). Each entry in this array is an object with two keys: index and text. There's also a new property called labelsIngraphUndrawnAsLabels which will add labels for the elements which aren't drawn.
- The labelsOffsetRadius property is now called labelsRadiusOffset. You don't need to update your code immediately because the name change is accommodated for.
- The canvas Pie chart labelsIngraph labels no longer overlap into other segments (and if they would have they're not drawn). If the labels are too big to fit into the relevant segment the key here is to lower the size of the font (the labelsIngraphSize property). Also, increasing the radius at which the labels are drawn (with the labelsIngraphRadius property - for example setting it to 0.75 can be good in some circumstances) can prove to be beneficial.
- The canvas Pie chart has a new property: labelsIngraphRadiusOffset If you're using the labelsIngraphRadius property to set the position of the labels you can add a pixel offset to them by using this property (it can be positive or negative).
-
The canvas Scatter chart can now accept
objects as well as arrays for the individual points -
just like the SVG Scatter chart.
So currently your Scatter chart data arrays
look like this:
// Single dataset array data: [ [100, 46, 'red', 'Freds result'], [156, 79, 'blue', 'Barneys result'], [123, 56, 'green', 'Wilmas result'], [110, 46, 'black', 'Bettys result'], [123, 23, 'yellow', 'Pebbles result'] ] // Multiple dataset array data: [ [ [100, 46, 'red', 'Freds result'], [156, 79, 'blue', 'Barneys result'], [123, 56, 'green', 'Wilmas result'], [110, 46, 'black', 'Bettys result'], [123, 23, 'yellow','Pebbles result'] ], [ [10, 46, 'red', 'Freds result'], [15, 79, 'blue', 'Barneys result'], [12, 56, 'green', 'Wilmas result'], [11, 46, 'black', 'Bettys result'], [12, 23, 'yellow','Pebbles result'] ] ]
But from this new version you can also define them like this - which is little bit clearer:// Single dataset array data: [ {x: 100, y: 46, color: 'red', tooltip: 'Freds result'}, {x: 156, y: 79, color: 'blue', tooltip: 'Barneys result'}, {x: 123, y: 56, color: 'green', tooltip: 'Wilmas result'}, {x: 110, y: 46, color: 'black', tooltip: 'Bettys result'}, {x: 123, y: 23, color: 'yellow', tooltip: 'Pebbles result'} ] // Multiple dataset array data: [ [ {x: 100, y: 46, color: 'red', tooltip: 'Freds result'}, {x: 156, y: 79, color: 'blue', tooltip: 'Barneys result'}, {x: 123, y: 56, color: 'green', tooltip: 'Wilmas result'}, {x: 110, y: 46, color: 'black', tooltip: 'Bettys result'}, {x: 123, y: 23, color: 'yellow', tooltip: 'Pebbles result'} ], [ {x: 10, y: 46, color: 'red', tooltip: 'Freds result'}, {x: 15, y: 79, color: 'blue', tooltip: 'Barneys result'}, {x: 12, y: 56, color: 'green', tooltip: 'Wilmas result'}, {x: 11, y: 46, color: 'black', tooltip: 'Bettys result'}, {x: 12, y: 23, color: 'yellow', tooltip: 'Pebbles result'} ] ]
- The canvas Pie chart has a new, simple effect - roundRobinSequential It looks similar to the roundRobin effect but is, in effect, a circular cover over the Pie chart that gradually reduces in size revealing the Pie. There's a demo of it in the download archive.
- For this release the title code has been rewritten - so check your charts and ensure that they appear OK if you upgrade. It should be noted that the X/Y positioning now follows the same direction as the canvas coordinate system - so zero is at the top-left and increases as you go down and to the right of the canvas. Offsetting follows a similar coordinate system - so positive offset values move the title to the right and down whilst negative values move the title up and to the left.
- The canvas Scatter chart has new properties: colorsBubbleStroke bubbleLinewidth bubbleShadow bubbleshadowColor bubbleShadowBlur bubbleShadowOffsetx bubbleShadowOffsety. As the names suggest, the colorsBubbleStroke property allows you to give the bubbles on a Bubble chart a stroke color. It defaults to null (ie there is no stroke). The bubbleLinewidth property controls the linewidth of that property. This defaults to 1. And the shadow properties control the shadow that each bubble has.
- This probably won't affect you - but the canvas Line chart has a new internal variable: obj.unmodified_data This variable does what the obj.original_data was supposed to do but this variable has been used in some effects (eg the wave effect. So the obj.unmodified_data is just that - a copy of the original, unmodified data.
January 2023 (v6.10)
- A reminder that, if you want to (hint hint...), you can review RGraph on Google
- The title option has had a little massaging for this release so check that your charts are appearing correctly. Both the title and the subtitle should be strings. For the v6.11 release the code that draws the title and subtitle will likely be rewritten to update it to current standards.
- Prior to this release the SVG Bipolar didn't draw shadows 100% correctly when animating stacked charts. This has now been corrected and the shadows grow along with the bars. This was evident in the wave effect.
-
When using the RGraph.clipTo() function
(read about this function in the API documentation)
with the tophalf bottomhalf
lefthalf and righthalf
options they clip to
exactly half the canvas without taking into account
the margins that you've set. This might not be
what you want so to remedy this there are now new
options available to you when using this function
to clip the canvas:
- tophalf.margins
- bottomhalf.margins
- lefthalf.margins
- righthalf.margins
- SVG chart types that allow the setting of shadows have had the shadowOpacity option removed and the shadowColor property added in its place. This affects the following SVG chart types: Bar, Bipolar, HBar, Line, Pie, Radar and Waterfall.
- The keyPositionMarginHSpace property has been added - it allows you to space out the key items when the key is in margin mode.
-
The horizontalLines property has been
added to the Bar, Line, Scatter, SVG Bar, SVG Line
and SVG Scatter charts. As the name suggests - this
allows you to easily add horizontal lines to your
charts - in particular it's an easy way to add an
average value indicator line. There are demos showing this
feature in the download archive called
- bar-average.html
- line-average.html
- scatter-average.html
- svg-bar-average.html
- svg-line-average.html
- svg-scatter-average.html
- The Line chart backgroundHbars property can now take an RGraph gradient string (eg Gradient(red:white)) as the color.
- Corrected a small bug that prevented the linedash being set with the RGraph.path function.
-
I thought I would share this snippet of CSS with you
that I've recently added to the RGraph website that
adds the little grey icon after external links.
Previously this was done with some non-trivial
javascript but after watching a recent
Youtube
video I found this snippet which does the same but
with a much smaller amount of CSS. Compared to the
javascript it's simpler, smaller and doesn't
require any changes to the HTML.
There's
a blog article that goes into more detail about this
here.
<style> a[rel*="external"]::after { content: url('/images/external-link.png'); padding-left: 5px; } </style> - The canvas charts have all had the titleSubtitle* options added to them. This brings them inline with the SVG charts. In the process of doing this some of the default values for the Gauge chart have been updated - so if you use this chart you should check your gauges if you upgrade.
- A fair amount of changes have been done to the website - practically all of the canvas examples and demo pages have been converted to images. You can still see the canvas demo pages by viewing the bare-bones examples as these are not indexed by search engines. This was for seo purposes and appears to be having a significantly positive effect. The demos/ are still bundled with the download archive.
-
The SVG charts have each had an
obj.create(tag[, parent[, style]])
function added that allows you to now do this:
var rect = obj.create( 'rect,x=10,y=10,width=100,height=100,stroke=black,fill=red', // Tag name and attributes parentNode, // Optional and can also be the style to apply if you wish 'border=1px solid gray' // Optional and can also be the parent node to append to );Compared to the equivalent create function that's currently used:var rect = RGraph.SVG.create({ svg: this.svg, type: 'rect', parent: parentNode, attr: { x: 10, y: 10, width: 100, height: 100, stroke: 'black', fill: 'red' }, style: { border: '1px solid gray' } });Much more concise I think you'll agree - but this change probably won't impact you a deal unless you happen to delve into the internals of RGraph and do your own drawing with the SVG charts. - The "one-touch adjusting" HOWTO document has been updated as a result of the two new Line chart methods (mentioned below). You can see this HOWTO document here.
- The Line chart has a new method: obj.closest which, as the name suggests, returns the indexes (an object with dataset and index indices) of the closest point (based on the event object coordinates). This was originally a function in one of the demos (in the download archive) but has now been moved to be a method on the Line chart object.