Charting data in DataTables
Charting data in DataTables
saintpaulie
Posts: 5Questions: 3Answers: 0
Hi
I have a DataTable with multiple columns but I would also like to show this information visually and plot a couple of the columns on a chart (bar/pie/plot etc). Ideally I would also like the chart to update if I search or apply a filter to the data. I would also like to keep the overall totals too if possible. Does anyone know how I would go about doing this? I have used the information in google charts or chartsjs but I don't know how I would combine the two.
Thanks
This discussion has been closed.
Answers
Hi @saintpaulie ,
The easy bit first, if you want it to update dynamically based on the table filtering, you could redraw the chart in either
draw
ordrawCallback
.I don't know anything about charting, but I'm guessing you just need to pass it two columns of data for a graph, or a single column for a pie chart. You can get that data from
rows().data()
orcolumns().data()
. I suspect it wouldn't be too tricky to do!Hope that helps,
Cheers,
Colin
Found this thread regarding Highcharts:
https://datatables.net/forums/discussion/comment/123621/#Comment_123621
You may be able to find other threads discussing charts.
Kevin
Thanks @colin and @kthorngren for your replies. I will look into both of those because they both could work for me.
Thanks again!