Okay
  Public Ticket #3651875
Graph
Closed

Comments

  • Benjamin started the conversation

    Hi

    I've two questions and problem can be seen on the same graph : http://zero-bullshitfr.fjub3542.odns.fr/preprod/credit


    1. When I don't have a data, i don't want O to be seen, I want no point.

    I know HighCharts can manage that (connectNulls: true). How can I activate this ? Because it's ugly on the charts


    2. How to manage date ?

    I'd like to show Dec 2001, ou 12/2001 instead of 01/12/2001


    Thx

  •  1,729
    Miloš replied

    Hi Benjamin,

    I am unable to load the Chart from your Page. Maybe it needs a logged user, but that is OK, based on your questions, we will advise :


    1. Skipping NULL and/or zeroes on Charts :

    Please note that this workaround only works for HighCharts Engine.

    For other Chart Engines we don't currently have a workaround to skip NULL and/or zero values.

    If you wish to try it, 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 || intval($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.

    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/

    <script type="text/javascript">
    jQuery(window).on('load',function(){
        if( typeof wpDataChartsCallbacks == 'undefined' ){ wpDataChartsCallbacks = {}; }
        wpDataChartsCallbacks[16] = function(obj){
            obj.options.plotOptions = {
                series: {
                    connectNulls: true
                }
            }
        };
    });
    </script>
    

    Just make sure to replace [16] with the ID of your chart.

    And as mentioned earlier, this only works for the HighCharts Engine, 

    I hope it helps.

    2. Changing the Date Format rendered in the Chart :

    Only the Google charts Engine have their own logic for date format, but the other chart engines should get the date format passed from our plugin.

    You can find this in main plugin setting / Date format, so the Date format you set there should be followed by your Chart ( unless if it's GoogleChart engine).

    Let us know how it goes.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia 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

  • Benjamin replied

    Hi Milos and thanks for the answer.

    When I try the NULL or 0 version it doesn't work at all, nothing change.

    But I try NULL + 0 version, the line is no drawed, even if the data are found.

    I'd like to keep 0 but avoid NULL. My data comes from a Google Sheets, and it seems that an empty case is not taken as NULL.



    Here's a test with JS and shortcode (http://zero-bullshitfr.fjub3542.odns.fr/preprod/uncategorized-tet-js-10128)

    The function.php includes the NULL version

    Attached files:  Capture d’écran 2024-05-22 à 15.59.57.png
      Capture d’écran 2024-05-22 à 15.59.44.png

  •  1,729
    Miloš replied

    Hi Benjamin,

    I see what you mean, on that example Chart from your Page, it does nothing as it is still showing that piece of the line where the 0 is, for example on the last series.

    6419381978.png

    As well as your example screenshot, it does not look as expected :

    3329059942.png
    4678625503.png

    Can you show us which method you used to add this custom JS, is it through our Plugin settings/Custom JS and CSS/Custom JS or perhaps added directly to the WP Page as a custom script?


    If we can also remote in to check the setup from our end.


    Please provide me a temporary WP-admin (administrator) user for your site where this happens, 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.


    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia 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

  • Benjamin replied

    Hi

    On the first chart (pink) it has to show 0, because the data is 0. So that's normal.

    The second one (gray) has a value every 3 months. But when there's no value it shows it as a 0.

    I've added the line in function.php 

    I've try to put the JS directly in the page and it didnt work.

    What's the best way to do it ?

  •  1,729
    Miloš replied


    Hi Benjamin,

    My sincere apologies for all the waiting time.

    It seems we are unable to reproduce this issue, on our charts we tried the intended solution to hide/skip the data which is NULL is working.

    So if I understood, in your case, you wish to basically make the chart completely skip any values which are NULL/blank, while it currently shows them as zeroes in your chart?

    This one, from the Page http://zero-bullshitfr.fjub3542.odns.fr/preprod/uncategorized-tet-js-10128 , chart ID 410 for series Credit Logement, for example the start of the line?

    6578893338.png

    Can we check the back end of your setup and the source Table, please?

    Please provide me a temporary WP-admin (administrator) user for your website where this happens, as well as FTP credentials 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. 

    If you can send me the path to the WordPress Folder on the server's FTP to make it easier to find our Plugin files.

    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.


    2. That is the best way, to place the JS directly on the WP Page.

    Could you show us some screenshots or a Video just to see in which way are you adding it to the Page?

    If it shows any sensitive data, just ensure the reply is PRIVATE for security.

    Thank you.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia 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