Hello, I am trying to use a chart callback fnc to update a graph's x label dynamically (namely separating the text onto new lines), but it doesn't seem like the callback fnc code even runs as nothing is printed to the console with my debug statement ("test") and the code does not affect the label text at all.
I tried to use "obj.update()" but this didn't seem to work either, it doesn't seem like the function even runs / gets executed at all.
Any idea what's going on? Or if there's another way to update the label text dynamically? I've tried to update it via wpDataCharts[9].render_data.options.data.labels[0] = '....'; wpDataCharts[9].render_data.options.update(); but that didn't work either, I can't seem to be able to access the actual chart object to update() it
Firstly, I would like to sincerely apologize for the delayed response as we have been experiencing an unusually high number of tickets. I am sorry that it has taken longer than usual to respond to your concern and your patience is highly appreciated.
-
Something like this, as you know, can not be done via built-in options/features of our Plugin, so a Custom solution is needed.
Custom work is not provided by our Support, but we do our best to advise.
At this time, we do not have an example similar to your use-case, unfortunately, but we will do our best to add more Chart Callback examples in the future to our Documentation.
For the time being, you can refer to the details i wrote on your other ticket, where we advised the possibilities and places where you can search for similar solutions.
I hope that helps.
Let us know if you try again and if you are still not able to get your callback to trigger on the Page at all;
If that happens, can you please first confirm are you using our Lite or Premium/full version of the Plugin?
If you have an active licence, please open a Premium ticket in the wpDataTables Category which will require you to confirm your licence/Purchase Code, then on that Ticket, you can write more details, such as :
if you can tell us how are you implementing your function, did you try through the Main Plugin settings/Custom JS and CSS/Custom JS, we presume;
If so, a better way is to wrap your JS code inside the HTML <script>...</script> tag, and then add this directly to your WordPress Page as Custom HTML, in order to try to 'force' it to run.
Sometimes, if you just add it via our Custom JS in the Plugin Settings - on some WP installations, depending on other Plugins/If there is some Security configuration, etc, it can be blocked, so directly on the WP Page is the best approach.
You can additionally check this YouTube video where we show another custom Callback example, and see how we added it.
I hope that helps, along with other details from your other ticket.
Hello, I am trying to use a chart callback fnc to update a graph's x label dynamically (namely separating the text onto new lines), but it doesn't seem like the callback fnc code even runs as nothing is printed to the console with my debug statement ("test") and the code does not affect the label text at all.
I tried to use "obj.update()" but this didn't seem to work either, it doesn't seem like the function even runs / gets executed at all.
wpDataChartsCallbacks[9] = function(obj){
console.log('test');
let firstXLabelParts = obj.options.data.labels[0].split(",");
obj.options.data.labels[0] = [firstXLabelParts[0],'','Quarterly enrollment: '+firstXLabelParts[1],'Total enrollment: '+firstXLabelParts[2]];
obj.update();
}
Any idea what's going on? Or if there's another way to update the label text dynamically? I've tried to update it via
wpDataCharts[9].render_data.options.data.labels[0] = '....'; wpDataCharts[9].render_data.options.update();
but that didn't work either, I can't seem to be able to access the actual chart object to update() it
Hi John,
Firstly, I would like to sincerely apologize for the delayed response as we have been experiencing an unusually high number of tickets. I am sorry that it has taken longer than usual to respond to your concern and your patience is highly appreciated.
-
Something like this, as you know, can not be done via built-in options/features of our Plugin, so a Custom solution is needed.
Custom work is not provided by our Support, but we do our best to advise.
At this time, we do not have an example similar to your use-case, unfortunately, but we will do our best to add more Chart Callback examples in the future to our Documentation.
For the time being, you can refer to the details i wrote on your other ticket, where we advised the possibilities and places where you can search for similar solutions.
I hope that helps.
Let us know if you try again and if you are still not able to get your callback to trigger on the Page at all;
If that happens, can you please first confirm are you using our Lite or Premium/full version of the Plugin?
If you have an active licence, please open a Premium ticket in the wpDataTables Category which will require you to confirm your licence/Purchase Code, then on that Ticket, you can write more details, such as :
if you can tell us how are you implementing your function, did you try through the Main Plugin settings/Custom JS and CSS/Custom JS, we presume;
If so, a better way is to wrap your JS code inside the HTML <script>...</script> tag, and then add this directly to your WordPress Page as Custom HTML, in order to try to 'force' it to run.
Sometimes, if you just add it via our Custom JS in the Plugin Settings - on some WP installations, depending on other Plugins/If there is some Security configuration, etc, it can be blocked, so directly on the WP Page is the best approach.
You can additionally check this YouTube video where we show another custom Callback example, and see how we added it.
I hope that helps, along with other details from your other ticket.
Thank you.
Kind Regards,
Miloš Jovanović
[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