About
RGraph is a JavaScript charts library based on
HTML5 SVG and canvas. RGraph is mature (over 15 years
old) and has a wealth of features making it an ideal
choice to use for showing charts on your website.
Download
Get the latest version of RGraph (version 6.19, 28th September 2024) 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.Version 6.13 of RGraph is now available
Written by Richard Heyes, RGraph author, on 17th July 2023
The latest version of RGraph - version 6.13 - is now available to download from the
download page. What's new in this release?
- The
svg
Scatter chart
now has a trace effect just like theLine chart
. This may look strange when you're using theScatter chart
to produce a vertical Line as it always animates from left to right. However, when you're producing aVertical Line chart
then you may want to instead look at using theHorizontal Bar chart
. You can read the relevant properties on thesvg
HorizontalBar chart
api
documentation page and there's a blog article (with an example) about producing aVertical Line chart
here. - Fixed a missing background grid line in the
canvas
HorizontalBar chart
which became apparent when theX-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 theresponsive
function after you call thedraw
function. The code shown below highlights the new way that you can put theresponsive
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
responsive
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 propertylabelsAboveDecimals
will be what you see. The positioning of the labels has also been slightly adjusted - so you might need to reduce or remove entirely anylabelsAboveOffsety
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 theY-axis
on the left-hand-side. Now, however, you can have rounded ends to your bars regardless of where theY-axis
is or whether you have a regular, stacked or grouped chart.- You can currently have rounded corners on your
Bar chart
by setting thecorners
property to round - you can now control whether the left and right corners are rounded individually with thecornersRoundLeft
andcornersRoundRight
properties. You can also set the radius of the corners individually as well with thecornersRoundLeftRadius
andcornersRoundRightRadius
properties.- A new feature has come to the
canvas
Scatter chart
- thelasso
options. These options, when enabled, allow you to draw rectangles around some (or all) of the points on your chart. Acallback
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 thewindow.localStorage
variable to enable easy persistence across page refreshes.- Added the
highlightDatasetEvent
property to the canvasLine chart
which defaults toclick
. You can set this tomousemove
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 property
ThebackgroundBackdrop
RGraph.common.core.js
library now contains a new function:RGraph.arrayRemoveNull
This function does what the name suggests and when you pass it anarray
thenull
values in thearray
will be removed. By default, objects aren't touched however if you give an object as the second argument which has the keyobjects
(for exampleRGraph.arrayRemoveNull(myArray, {objects: true}))
thennull
values will be removed fromobjects
too. If you give avalue
parameter to the optionsarray
,null
values will NOT be removed, but substituted with that value instead. You can see theapi
docs for theRGraph.arrayRemoveNull
function here. - The
- The
canvas
Pie chart
now has a new set oflabelsInside
properties for use when you're showing aDonut 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.