空值会在我的基本列图表上引发错误

时间:2018-02-12 10:29:29

标签: php highcharts

我使用的是基本列Highcharts,它可以正常工作直到

1-我全部值为null然后我有错误:未捕获错误:Highcharts错误#13 (对我来说,我可以引入空值)

更新----整个错误:

enter image description here

2 - 当我某些值为null时,我不想在图表上显示它们: enter image description here

我的代码:

public function myChartBasicColumn($date, $list1, $list2)
{
    $sellsHistory = array(
        $list1,
        $list2,

    );

    $dates = $date;

    $ob = new Highchart();
    // ID de l'élement de DOM que vous utilisez comme conteneur
    $ob->chart->renderTo('myChart');

    $ob->title->text('<span style="color:#0068BA"> myChart </span>');
    $ob->chart->type('column');
    $ob->plotOptions->column(
        array(
            'dataLabels' => array(
                'enabled' => true,

            )



        )
    );
    $ob->yAxis->title(array('text' => " myChart "));

    $ob->xAxis->title(array('text' => ""));
    $ob->xAxis->categories($dates);

    $ob->series($sellsHistory);

    return $ob;
}

$list1= array(
    'name' => 'Global',
    'type'  => 'column',
    'color' => '#4572A7',

    'dataLabels' => array(
        'enabled' => true
    ),
    'data' => $data1
);


$list2 =  array(
    'name' => 'Ressource',
    'type'  => 'column',
    'color' => '#D49EDA',
    'dataLabels' => array(
        'enabled' => true
    ),
    'data' => $data2
);

$column = $chart->myChartBasicColumn($date, $list1, $list2);
$html =  $this->render('AdminBundle:admin:chart.html.twig',array(
    'en' =>$en,
    'myChart' => $column,

))->getContent();

0 个答案:

没有答案