On the Highcharts basic line chart, we have two complete years of data, a line for each year, and for this year we need to be able to display a line for a running total to date. (so the line stops at the current month).
According to Highcharts webpage (https://www.highcharts.com/demo/line-basic, then click Edit in JSFiddle) for the basic line chart, if the value of an entry ot entries is 'null', it will not display the line for that entry or entries (it will just be a partial line).
I've attached a screenshot. So what we need is when we add the data for November (11), that's where we want the line to stop.
However, in wpDataTables, the column data for the line needs to be an integer so it can be a line in wpDataChart, so if we have 'null' for the value in the wpDataTables table, it will be blank or 0 when the column data is set to integer. Is there a way to make the line stop at the current month instead of dropping down to zero?
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.
-
If i understood, you wish the chart to "skip null values" and ignore/not load them?
If that is the case, we have a workaround :
Please 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 == 0){ $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 and "0" values.
If you want to apply it just for NULL values, you can use this code:
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 ); And if you want to apply it just for "0" values, you can use this code:
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 ($value == 0){ $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 );
You don't need to change the code after the plugin updates, but you will need to keep this code in functions.php.
No need for the apology you gave as you were very quick with your response. I apologize though for my late response.
I've tried the code you posted below (and tried several combinations of with/without conditions for chart id and table id) and it's not working.
Before I continue troubleshooting, I wanted to make sure I'm on the right track. I have a Highcharts basic line chart, with Follow table filtering selected, and have both the wpDataChart and wpDataTable on the same page.
The line chart has 2021, 2022 and 2023 integers and a monthly string, so it will display the line going through 12 months. For 2023, there are two months of data (the year starts with Oct 1 and goes through Sept). I want the line to stop at Nov. All months after Nov have a value of 0 (zero). The 2023 line starts at beginning (October) and goes to Nov ok, but then drops down to 0.
It looks like the filters in your workaround are what I need, but maybe I'm missing something. Will the filters work if the wpDataTable data source is an Excel file?
If the filter(s) you sent is what I need, then I will keep troubleshooting and will let you know the progress by early next week.
Thank you for all the patience once again, i got advised by our 2nd level Team.
This workaround to skip NULL for charts would definitely be working for all table types,
so we can take a look and try to see if there is any kind of a small modification that needs to be done for this to work on your site.
Could you please grant us access to the WP-Admin of the site, as well as FTP access, so that we can check how you applied the workaround?
-
Please provide me a temporary WP-admin (administrator) user for your site where this happens, as well as credentials for FTP,
so we could log in and take a look ‘from the inside’ as that’s the most efficient way to see and resolve the issue.
We do not interfere with any data or anything else except for the plugin (in case that’s a production version of the site), and of course, we do not provide login data to third parties.
You can write credentials here just check PRIVATE Reply so nobody can see them except us.
-
And please point me to any chart ID as an example that we can check while we do this.
On the Highcharts basic line chart, we have two complete years of data, a line for each year, and for this year we need to be able to display a line for a running total to date. (so the line stops at the current month).
According to Highcharts webpage (https://www.highcharts.com/demo/line-basic, then click Edit in JSFiddle) for the basic line chart, if the value of an entry ot entries is 'null', it will not display the line for that entry or entries (it will just be a partial line).
I've attached a screenshot. So what we need is when we add the data for November (11), that's where we want the line to stop.
However, in wpDataTables, the column data for the line needs to be an integer so it can be a line in wpDataChart, so if we have 'null' for the value in the wpDataTables table, it will be blank or 0 when the column data is set to integer. Is there a way to make the line stop at the current month instead of dropping down to zero?
Hi, Management Council
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.
-
If i understood, you wish the chart to "skip null values" and ignore/not load them?
If that is the case, we have a workaround :
Please 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 and "0" values.
If you want to apply it just for NULL values, you can use this code:
You don't need to change the code after the plugin updates, but you will need to keep this code in functions.php.
If you want to connect data with NULLs skipped, you can use this callback: https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/series-connectnulls-true/
Just make sure to replace [16] with the ID of your chart.
Let us know if that is what you needed.
If not, please correct me if i misunderstood the goal. Thank you
Kind Regards,
Miloš Jovanović
[email protected]
Rate my support
Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/
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
Hi Miloš,
No need for the apology you gave as you were very quick with your response. I apologize though for my late response.
I've tried the code you posted below (and tried several combinations of with/without conditions for chart id and table id) and it's not working.
Before I continue troubleshooting, I wanted to make sure I'm on the right track. I have a Highcharts basic line chart, with Follow table filtering selected, and have both the wpDataChart and wpDataTable on the same page.
The line chart has 2021, 2022 and 2023 integers and a monthly string, so it will display the line going through 12 months. For 2023, there are two months of data (the year starts with Oct 1 and goes through Sept). I want the line to stop at Nov. All months after Nov have a value of 0 (zero). The 2023 line starts at beginning (October) and goes to Nov ok, but then drops down to 0.
It looks like the filters in your workaround are what I need, but maybe I'm missing something. Will the filters work if the wpDataTable data source is an Excel file?
If the filter(s) you sent is what I need, then I will keep troubleshooting and will let you know the progress by early next week.
Thank you for the help,
Mike
Hi, Mike
In that case, i won't apologise again for the delay, but i will just point out that we don't work weekends,
it added the two extra days to the hold up
-
I will have to double-check that,
as far as i am aware, this code should work for all table types ( besides Simple tables),
but we will check to make sure. If you solve it in the meantime, let us know,
and i will report back as quickly as possible to confirm if this should work with charts that are made from Excel linked tables.
Thank you
Kind Regards,
Miloš Jovanović
[email protected]
Rate my support
Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/
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
Hi, Mike
Thank you for all the patience once again, i got advised by our 2nd level Team.
This workaround to skip NULL for charts would definitely be working for all table types,
so we can take a look and try to see if there is any kind of a small modification that needs to be done for this to work on your site.
Could you please grant us access to the WP-Admin of the site, as well as FTP access, so that we can check how you applied the workaround?
-
Please provide me a temporary WP-admin (administrator) user for your site where this happens, as well as credentials for FTP,
so we could log in and take a look ‘from the inside’ as that’s the most efficient way to see and resolve the issue.
We do not interfere with any data or anything else except for the plugin (in case that’s a production version of the site), and of course, we do not provide login data to third parties.
You can write credentials here just check PRIVATE Reply so nobody can see them except us.
-
And please point me to any chart ID as an example that we can check while we do this.
Thank you
Kind Regards,
Miloš Jovanović
[email protected]
Rate my support
Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/
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