php - Not display NULL value in multi-axis chart -


i using multi-axis chart highcharts.

it works fine don't want display variable if it’s null , should put test on null value ?

i have done in pie chart arrays lost

enter image description here

my multi-axis chart function took array composed of years , 4 arrays:

public function multiaxechartdyn($date, $list1, $list2,$list3,$list4) {     $dates = $date;      $ob = new highchart();     $ob->chart->renderto('containermultiaxe'); // #id of div render chart     $ob->chart->type('column');     $ob->title->text('budget');     $ob->xaxis->categories($dates);      $ob->legend->enabled(true);      $dataseries= array(         $list1,         $list2,         $list3,         $list4,      );           $ydata = array(         array(             'labels' => array(                 'formatter' => new expr('function () { return this.value + " %" }'),                 'style'     => array('color' => '#aa4643')             ),              'title' => array(                 'text'  => 'taux',                 'style' => array('color' => '#aa4643')             ),             'opposite' => true,         ),         array(             'labels' => array(                 'formatter' => new expr('function () { return this.value + " mdt" }'),                 'style'     => array('color' => '#4572a7')             ),             'gridlinewidth' => 0,             'title' => array(                 'text'  => 'budget',                 'style' => array('color' => '#4572a7')             ),         ),     );      $ob->yaxis($ydata);     $formatter = new expr('function () {              var unit = {                  "budget": "mdt",                   "ressource": "mdt",                  "taux  global": "%",                  "taux consumption": "%"              }[this.series.name];              return this.x + ": <b>" + this.y + "</b> " + unit;          }');     $ob->tooltip->formatter($formatter);      $ob->series( $dataseries);     return $ob;  } 

my controller :

public function indexaction(survey $survey) {     $chart=new chartcontroller();     $ent = $survey ->getent();       $year= $survey->getyear();     $qb = $this->getdoctrine()->getmanager()->createquerybuilder();     $qb->select('e')         ->from('appbundle:survey, 'e')         ->where('e.year <= :year')         ->andwhere('e.ent = :ent')         ->setparameter('year', $year)         ->setparameter('ent', $ent->getid())         ->orderby('e.year', 'desc')         ->setmaxresults(4);     $survey_year =  $qb->getquery()->getresult();     $date = array();      $data1  = array();     $data2  = array();     $data3  = array();     $data4  = array();  $survey_year= array_reverse($survey_year, true); foreach($survey_year $ea){     $date[] = $ea->getyear();     $data1[] = $ea->getform ()->getbudget()/1000;     $data2[] = $ea->getform ()->getressources()/1000;     $data3[] = $ea->getform ()->gettauxglobal ();     $data4[] = $ea->getform ()->gettauxconsumption (); }  $list1= array(     'name' => 'budget',     'type'  => 'column',     'color' => '#4572a7',     'yaxis' => 1,     'datalabels' => array(         'enabled' => true     ),     'data' => $data1 ); $list2 =  array(     'name' => 'ressource',    'type'  => 'column',     'color' => '#d49eda',     'yaxis' => 1,     'datalabels' => array(         'enabled' => true     ),    'data' => $data2 );  $list3= array(     'name' => 'taux  global',     'type'  => 'spline',     'color' => '#0a0f19',     'datalabels' => array(         'enabled' => true     ),     'data' => $data3 ); $list4 =  array(     'name'=> 'taux consumption',     'type'  => 'spline',     'color' => '#225824',     'datalabels' => array(         'enabled' => true     ),     'data' => $data4 );  $containermultiaxe=$chart->multiaxechartdyn($date, $list1, $list2,$list3,$list4);  $html =  $this->render('appbundle:charting:index.html.twig',array(         'survey' =>$survey,         'containermultiaxe' => $containermultiaxe,      ));       return $html; } 


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -