MENU
.net Powerful JavaScript charts
About
RGraph is a JavaScript charts library based on HTML5 SVG and canvas. RGraph is mature (over 18 years old) and has a wealth of features making it an ideal choice to use for showing charts on your website.

More »

 

Version 7.20
Version 7.20 (released in June 2026) is the latest version of RGraph and the major change in this version is an update to the default values of properties making for better looking charts without having to set any properties. Read more about this and other changes in the changelog.

Download »

 

Download
Get the latest version of RGraph (version 7.20, 9th June 2026) 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.

Download »

 

Latest forum posts
These are the latest support forum posts that have been posted or updated.


16th June, Rachel
I have a question about the 3D Bar chart
12th June, Marco
Should I use SVG or canvas for the charts on my website?
9th June, Richard
New version of RGraph: version 7.20
3rd June, Patrick
Question about installing RGraph
1st June, Ouja
How do I add a click event to a bar in my Bar chart?


Support forum »

 

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.

More »

Can I show three (or more) colors on my Line chart?


Posted by giuseppe at 13:29 on Wednesday 23rd March 2022 [link]
hi
I'm using successfully RGraph.line.js and related libraries.
I made a dual-color line graph but now i'd need to add a color, so graph should be a three colors.
Is it possible or exist a new better way ?
many thanks

Posted by Richard at 18:12 on Wednesday 23rd March 2022 [link]
You can. You can do it in two ways that I can think of:

1. Use gradients. There are two demo pages in the download archive that show this:
    i. line-filled-striped.html
ii. line-banded-gradient.html

2. Use clipping. This is a little more involved and involves drawing a path (a rectangle in your case by the sounds of it) to which any further drawing is restricted.

So you set the clipping, draw the first chart, reset the clipping.

Set new clipping (to the second section), change the colors on the chart and then draw it again, then reset the clipping.

And finally set new clipping to the third section, change the colors again and draw the chart. Then reset the clipping.

This, as you can see, is more involved but it is a bit more versatile.

I'm actually in the middle of creating an RGraph.clipTo.start() function which will make this much easier - so if you hold on a few days I'll send you an updated RGraph.common.core.js file so you can use it.

Posted by Richard at 20:58 on Thursday 24th March 2022 [link]
Ok, try having a look at this example:

[LINK REMOVED]

To use this sort of chart on your own website you'll need to use this version of the core library:

[LINK REMOVED]

And you can get the source of the example page by viewing the source in your browser.

UPDATE

This is now part of version 6.07 and you can read about the RGraph.clipTo functions in the API documentation:

https://www.rgraph.net/canvas/api.html#functions.clipping

There are demos of Line chart clipping in the download:

https://www.rgraph.net/download.html#stable

And they're called line-clippingX.html

Posted by giuseppe at 21:03 on Monday 28th March 2022 [link]
well ... i'll try in these days
many many thanks

[Replies are closed]