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.How to produce a vertical line chart
Written by Richard Heyes, RGraph author, on 23rd April 2023Vertical Line chart using either the canvas or svg Horizontal Bar charts instead of the Scatter charts. The example that's linked here is a vertical Line chart produced in this way. The charts can be spline Line charts (ie smooth and curvy) or, as is shown here, regular Line charts.
The source code for the canvas version of the chart, which is easier to understand compared to using the Scatter chart for a Vertical Line chart, is shown below. The chart itself is one of a few demos (demos/svg-hbar-vertical-line.html demos/hbar-vertical-line.html and demos/hbar-vertical-line-multiple.html) that you'll find in the download archive.
There are a number of options for it which are:
lineEnables the linelineColorThe color of the linelineCapDictates the style of the end of the linelineLinewidthDictates the style of line-joinslineShadowEnables a shadow for the linelineShadowColorThe color of the shadowlineShadowBlurThe magnitude of the shadow blurring effectlineShadowOffsetxThe horizontal pixel offset of the shadowlineShadowOffsetyThe vertical pixel offset of the shadowlineSplineThis changes the line to a spline (smooth and curvy)lineTickmarksStyleDetermines the style of the tickmarks on the line (if any)lineTickmarksSizeThe size of the tickmarkslineTickmarksDrawNullWhether or not to draw tickmarks fornullpointslineTickmarksDrawNonNullWhether or not to draw tickmarks for points which have anullpoint on both sides
Here's the source code for the chart that's shown above - the code that's necessary to show the line is highlighted:
<script>
new RGraph.HBar({
id: 'cvs',
data: [4,6,8,3,4,12,9,5,6,18],
options: {
backgroundGridHlines: false,
backgroundGridBorder: false,
xaxis: false,
yaxis: false,
// Set the color of the bars to transparent so that they can't be seen
colors: ['transparent'],
yaxisLabels: [
'John','Fredericko','Bono','Lucy','Charles',
'Peter','Brian','Jilly','Peter','Lucy'
],
textSize: 18,
title: 'A vertical line chart',
marginTop: 50,
// These options enable the line and configure it
line: true,
lineSpline: true,
lineLinejoin: 'round',
lineLinecap: 'round',
lineLinewidth: 5,
lineTickmarksStyle: 'endcircle',
lineTickmarksSize: 6
}
}).trace();
</script>