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 (£99) commercial license available.

More »

How can I create a chart from data in an HTML table?


Posted by Erwan at 10:17 on Saturday 11th September 2021 [link]
Hello,
I have a table in html which is created every day, how can I add your library to create graphs from this table?
Do you have an example?

Regards

Posted by Richard at 12:27 on Saturday 11th September 2021 [link]
There isn't any function in RGraph that parse an HTML table and extracts data from it.

Th import tools are:

Google Sheets: https://www.rgraph.net/canvas/sheets.html
     CSV data: https://www.rgraph.net/canvas/csv.html
AJAX functions: https://www.rgraph.net/canvas/ajax.html

These get data and then provide it to you as a JavaScript array which you can then give to your chart object.

If you can get hold of the data before it's turned into HTML that would be best.

But if you can't, a function that parses HTML tables would be a good thing for RGraph to have so let me know and I'll make one. I'm not sure if colspans and rowspans would be feasible so it may just be a basic table parser.

Regardless, let me know and I'll make something that parses a table. Ideally give me a sample of your table too.

Posted by Erwan at 14:10 on Saturday 11th September 2021 [link]
There is an example on the site: https://www.highcharts.com/demo/column-parsed
and I already have a model but I am limited on the type of chart.
I would like to make donut and pie charts
Do you have an email for an attachment?

cordially

Posted by Richard at 22:28 on Wednesday 15th September 2021 [link]
For anyone who's interested - there's now a HTML table import utility that resulted from this that allows you to import data from a table that's on the page.

It will be available from version 6.03 which I'm aiming to release at the start of November.

There's a blog article that shows you some source code here:

https://www.rgraph.net/blog/2021/html-table-import.html

[Replies are now closed]