Okay
  Public Ticket #1497220
Chart
Closed

Comments

  • web_kings started the conversation

    when I use a table from excel or create one online direct from wpDataTables I cannot give it a NULL value. It always goes back to 0. To solve this I directly edited the DATAbase with a NULL value. But the chart still recognises it a zero.


    I want the line chart to not display when a NULL value is entered.

  •  1,689
    Miloš replied

    Hi web_kings,
    Thank you for your purchase.


    You will need  to make some changes in code in file :

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

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

    and replace 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 this changes you will get charts like on the screenshot (Selection_016.jpg).

    If you want to make charts like on screenshot (Selection_015.jpg) you have to use wpdatachart callbacks and insert that on page where is your chart.

    <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.


    Best regards.


    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