We want to use a callback with HighCharts to dynamically change the chart height based on the number of series in the bar chart. This number could be anywhere from 1 to maybe 30 so a fixed height bar chart is not working so well. There are plenty of examples of how to do this when you are using HighCharts directly - but not when using HighCharts through wpDataTables. We have this code that we are using and know it is working for setting the height:
I believe there's a way, but I haven't used a callback like this, so I don't know exactly. I too would need to go through trial and error to get this right. I would love to help you out, but unfortunately I cannot do that since using hooks or wpdatatable and wpDataChart callbacks requires certain level of programming skills and included support refers only to advice.
So I was actually able to pull this off without a lot of effort when I realized the data table was on this page and it was possible to get the number of rows in that table (= number of series on the chart +1) by using:
We want to use a callback with HighCharts to dynamically change the chart height based on the number of series in the bar chart. This number could be anywhere from 1 to maybe 30 so a fixed height bar chart is not working so well. There are plenty of examples of how to do this when you are using HighCharts directly - but not when using HighCharts through wpDataTables. We have this code that we are using and know it is working for setting the height:
We just need a way to retrieve the number of series in the chart so we can use something like this to set the height:Is there a way to get the number of series through the callback?
Hello Randall
Honestly, I don't know if this can be achieved.
I believe there's a way, but I haven't used a callback like this, so I don't know exactly. I too would need to go through trial and error to get this right. I would love to help you out, but unfortunately I cannot do that since using hooks or wpdatatable and wpDataChart callbacks requires certain level of programming skills and included support refers only to advice.
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables
So I was actually able to pull this off without a lot of effort when I realized the data table was on this page and it was possible to get the number of rows in that table (= number of series on the chart +1) by using:
Where "table_2" is the Id of the table in HTML. So hopefully someone else can benefit from this too.
Hey, that's great news, Randall
I'm sure others will have a use of this.
I know I will - I already saved this in my personal notes, and when I have the time, I'll add it to the FAQ section as well.
Thanks!
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables