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 show charts on your website.

More »

 

Download
Get the latest version of RGraph (version 6.17) from the download page. There's also older versions available, minified files and links to cdnjs.com hosted libraries.

More »

 

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 »

Are there any plans to make a NodeJS package?


Posted by Tiago Caldeira at 10:48 on Wednesday 17th August 2022 [link]
Hello there,

I'm currently working on a project that requires generating a line graph in NodeJS, saving the graph as a PNG and sending it over to a S3 bucket.

I've seen in your FAQ a way to make server-side graphs using PhantomJS which is now deprecated and not ideal, so I was wondering if there is any plans or even a target market for packaging RGraph as a npm module or not.

Additionally, if nothing's planned for it, would using Puppeteer (https://github.com/puppeteer/puppeteer) work for my use-case?

Thanks and best regards.

Posted by Richard at 11:04 on Wednesday 17th August 2022 [link]
I don't have any plans for a NodeJS npm at the moment. I tried using it once and it struck me as a little strange to say the least.

PhantomJS may be deprecated and (probably) unsupported but it's still usable if you want screenshots.

Looking at the Puppeteer Git Page it claims it can make screenshots for you so it looks like that would be great for what you want. I don't know how easy it is for it to do that though - but I can't imagine it would be difficult.

One thing to remember here is that canvas is initially transparent (not white). Now, when taking a screenshot of a webpage, this shouldn't really be an issue but, just in case, here's some code (again, that may not be necessary) that clears the canvas to white before drawing your chart (instead of leaving it as transparent):



myLine = new RGraph.Line({
    id: 'cvs',
    data: [4,8,6,3,5,4,6],
    options: {
    }
}).on('beforedraw', function (obj)
{
    RGraph.clear(obj.canvas, 'white');
}).draw();

[Replies are now closed]