200313
Posts: 9
Joined: Thu Dec 13, 2018 5:11 am

Is it possible to add custom data to viewData table ?

Hi guys.
I've reviewed the case viewtopic.php?t=41688 and would like to know, how to customize the columns to show when the series have more data.

For instance data like:

Code: Select all

series: [{
    name: 'Installation',
    data: [{y:43934,n:2000}, {y:52503, n:3000}, {y57177,n:4000}, 69658, 97031, 119931, 137133, 154175]
  }, {
    name: 'Manufacturing',
    data: [{y:24916,n:5000}, 24064, 29742, 29851,32490, 30282, 38121, 40434]
  }],
can we show a table like this?:

Code: Select all

Categ	Installation	Manufacturing
	qty	spare	qty	spare
0	43934	(2000)	24916	(5000)
1	52503	(3000)	24064
2	57177	(4000)	29742
3	69658		29851
4	97031		32490
or like this:

Code: Select all

Categ	Installation	Manufacturing
0	43934 (2000)	24916(5000)
1	52503(3000)	24064
2	57177(4000)	29742
3	69658		29851
4	97031		32490
Code: https://jsfiddle.net/200313/52xb3vga/

Thank you
rafalS
Posts: 2665
Joined: Thu Jun 14, 2018 11:40 am

Re: Is it possible to add custom data to viewData table ?

Hi,

Yes, you can show the table like in your example, but you need to edit a method that creates the whole table. This method is called getTable and you can find it in H.Chart.prototype. Here you have an example with this method wrapped and ready to editing: https://jsfiddle.net/BlackLabel/pgjhq7uy
But I cannot help you with editing because it requires a lot of work.

Let me know if you have any further questions.

Best regards!
Rafal Sebestjanski,
Highcharts Team Lead
200313
Posts: 9
Joined: Thu Dec 13, 2018 5:11 am

Re: Is it possible to add custom data to viewData table ?

Hi Rafal,
I've reviewed 'getDataRows' as others in H.Chart.prototype, but I couldn't find any function that gives me the custom field values of the series. did you have another suggestion?
Thank you
rafalS
Posts: 2665
Joined: Thu Jun 14, 2018 11:40 am

Re: Is it possible to add custom data to viewData table ?

Hi,

There is no simple method that allows you to add custom fields. As I said, you need to change the core code and the way that getTable() and maybe getDataRows() methods work, but it really requires a lot of work.

These methods are not simple to customize. We are thinking about changing the whole module and improving it in the future. You could create a ticket on our UserVoice channel here: https://highcharts.uservoice.com
The more votes this idea gets, the more important it will be for us and we will implement this faster.

I have never investigated this module really closely, and, to be honest, if I would have to render a custom dataTable to one chart, I would rather do it in HTML and code it on my own rather than changing the Highcharts code, which allows you to simply render only the standard table.

Regards.
Rafal Sebestjanski,
Highcharts Team Lead
Buth_
Posts: 1
Joined: Tue Sep 20, 2022 4:32 am

Re: Is it possible to add custom data to viewData table ?

This is not helpful:(
hubert.k
Posts: 1164
Joined: Mon Apr 11, 2022 11:48 am

Re: Is it possible to add custom data to viewData table ?

Hi Buth_!
Welcome to our forum and thanks for contacting us with your question!

I am sorry, that you didn't find any information, which fits your requirement. Maybe I can help you deeply and find a special solution for you?

Kind regards!
Hubert Kozik
Highcharts Developer
majidmisger
Posts: 1
Joined: Wed Oct 25, 2023 8:41 am

Re: Is it possible to add custom data to viewData table ?

hii, Same question , i want to concatenate a "%" symbol in one of my column in table, On graph i was able to use the valueSuffix in the tooltip but that doesn't reflect on the table in the graph ,
User avatar
dawid.d
Posts: 807
Joined: Thu Oct 06, 2022 11:31 am

Re: Is it possible to add custom data to viewData table ?

Hello majidmisger,

Welcome to our forum and thanks for contacting us with your question!

You can edit the innerHTML of a given cell using js, accessing the table e.g. using the afterViewData event, as in the demo below.

Demo: https://jsfiddle.net/BlackLabel/u1xLyr4m/

​If you have further inquiries, you may reach out to me at any time.
Best regards!
Dawid Draguła
Highcharts Developer

Return to “Highcharts Usage”