Okay
  Public Ticket #2344648
Publicar un grafico
Closed

Comments

  • andres started the conversation

    Estimados,

    En un grafico usado HighCrarts del tipo Spline Chart, necesito que el valor nulo no lo tome como cero y no se muestre en el gráfico, no encuentro la configuración que lo permite, desde ya, muchas gracias.

  •  2,514
    Aleksandar replied

    Hello andres

    Thank you for your purchase.

    I am sorry to disappoint you, but unfortunately something like this is not possible with the plugin's built-in features.

    Integer and float columns cannot have anything other than numbers in them, the plugin is treating an empty cell as "0"

    I can try to help you out, but you have to make some changes in code in file :

    /wp-content/plugins/wpdatatables/source/class.wpdatachart.php around line 1629:

    case 'int':
        $return_data_row[] = (float)$row[$columnKey];
        break;
    case 'float':
        $return_data_row[] = (float)$row[$columnKey];
        break;

    and replace it with this

    case 'int':
        if (is_null($row[$columnKey])){
            $return_data_row[]=null;
        }else{
           $return_data_row[] = (float)$row[$columnKey];
        }
        break;
    case 'float':
        if (is_null($row[$columnKey])){
             $return_data_row[]=null;
        }else{
             $return_data_row[] = (float)$row[$columnKey];
        }
        break;                            

    With these changes you will get charts like on the first screenshot below.

    If you want to make charts like on screenshot #2 you have to use wpdatachart callbacks and insert that on page where your chart is.

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

    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.

    1539290246.png
    3942732156.png

    I hope this helps.

    If you do need to use wpDataCharts callbacks, I can't help you much with those.

    • Every chart exposes several options that customize its look and feel. Charts usually support custom options appropriate to that visualization. wpDataChart callbacks allow adding options that are available in Google Charts APIHighcharts API and Chart.js API
    • All necessary resources are available in charts engines API (depends on which one you use). Every engine has a different approach to chart settings. In wpDataChart callbacks you have to adopt those settings to the wpDataChart object (you can take a look at examples for each engine in our documentation, and also in Support help center). Huge number of examples for any area of programming can be found on stackoverflow.com (typing your problem in google and at the end add "site: stackoverflow.com" and google will search only that website). Also, a lot of examples of charts, chart settings and customization can be found on jsffidle.net (typing in google for example "line chart highcharts jsffidle")
    • Please note that 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 | 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