Just got the plug in. Trying to create a line chart showing data from 2018 vs. data from 2019. Of course there are several months of 2019 with no values. I left those fields blank but the plugin renders each of those fields as a zero, which shows a line plummeting to the bottom of the chart. Not what I want to show. How can I just get the line for this year to stop when there are no values for the rest of the year? What I want is something like the second attachment. I can't give you a URL to my site because it's still under construction. Thanks.
We simplified this a bit, but it still requires some custom work. With our next update, that custom work will be integrated with the plugin, so you won't have to redo it.
You'll need to modify some files since we somehow forgot to pass the chart ID in there. Please go to wp-content/plugins/wpdatatables/source/class.wpdatachart.php and on line 1634 you will find this:
This adds the chart ID in the parameters. You'll only have to do this one time, as it will be included in our next update.
Then, go to the functions.php file of your theme or child theme, and add this:
function filterNullValues ($value, $origHeader ,$chartID, $tableID){
// You can add conditions for specific org header, chart id or table id
// Here we only check if value is null and provide same value to the chart object
if (is_null($value)){
$value = null;
}
return $value;
}
add_filter( 'wpdatatables_filter_int_cell_data_in_charts', 'filterNullValues', 10, 4 );
add_filter( 'wpdatatables_filter_float_cell_data_in_charts', 'filterNullValues', 10, 4 );
This works for integer and float columns that have NULL values.
Successful on all the changes to class.wpdatachart.php, but when I add:
function filterNullValues ($value, $origHeader ,$chartID, $tableID){
// You can add conditions for specific org header, chart id or table id
// Here we only check if value is null and provide same value to the chart object
if (is_null($value)){
$value = null;
}
return $value;
}
add_filter( 'wpdatatables_filter_int_cell_data_in_charts', 'filterNullValues', 10, 4 );
add_filter( 'wpdatatables_filter_float_cell_data_in_charts', 'filterNullValues', 10, 4 );
to my child theme's functions.php none of my charts plot at all :(
There was an issue for Integer and Float columns that had values that were treated as strings, not as floats (which is a requirement for Highcharts API).
In file wp-content/plugins/wpdatatables/source/class.wpdatachart.php on line 2187 you will find this:
Just got the plug in. Trying to create a line chart showing data from 2018 vs. data from 2019. Of course there are several months of 2019 with no values. I left those fields blank but the plugin renders each of those fields as a zero, which shows a line plummeting to the bottom of the chart. Not what I want to show. How can I just get the line for this year to stop when there are no values for the rest of the year? What I want is something like the second attachment. I can't give you a URL to my site because it's still under construction. Thanks.
Hi Chris.
Thank you for your purchase.
You have to make some changes in code in file :
/wp-content/plugins/wpdatatables/source/class.wpdatachart.php around line 1584
and replace with this
With these changes you will get charts like on the first screenshot.
If you want to make charts like on the second screenshot, you have to use wpdatachart callbacks and insert that on page where your chart is.
One more thing you have to change in this callback number 39 in (wpDataChartsCallbacks[39]) to id of the chart that you use on page.
This will be overwritten on next update so you have to come back here and do it again.
Best regards.
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
Hey Aleksander,
This fix used to work for me, but on the latest update replacing the code in class.wpdatachart.php isn't working.
Looking at "// The data itself" section int & float cases.
Is there something more or different I need to do in the latest version?
Many thanks,
Matt.
Hey Matt
We simplified this a bit, but it still requires some custom work. With our next update, that custom work will be integrated with the plugin, so you won't have to redo it.
You'll need to modify some files since we somehow forgot to pass the chart ID in there. Please go to wp-content/plugins/wpdatatables/source/class.wpdatachart.php and on line 1634 you will find this:
Replace it with this:
In the same file, on line 1642 you will find this:
And you need to replace it with this:
Again, in the same file, on line 1725 you will find this:
Replace it with this:
Then go to line 1733 of the same file, and find this:
Replace it with this:
This adds the chart ID in the parameters. You'll only have to do this one time, as it will be included in our next update.
Then, go to the functions.php file of your theme or child theme, and add this:
This works for integer and float columns that have NULL values.
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
Aleksandar, thank you so much!
I'm thrilled to hear it'll be built into next update, and I'm going to try your custom code now.
Cheers!
Matt.
Hey Aleksander,
Successful on all the changes to class.wpdatachart.php, but when I add:
to my child theme's functions.php none of my charts plot at all :(
Hey Matt, sorry about that.
There was an issue for Integer and Float columns that had values that were treated as strings, not as floats (which is a requirement for Highcharts API).
In file wp-content/plugins/wpdatatables/source/class.wpdatachart.php on line 2187 you will find this:
Replace it with this:
Then, in the same file, on line 2278 you will find this:
Replace it with this:
Along with the previous changes, it will work fine. Please give it a go, and let me know.
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
Success! Thank you very much Aleksandar!
You're welcome, Matt.
Glad I could be of assistance!
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