Php 三维饼图与普通图表类似
我想使用ObHighchartsBundle创建一个3D饼图,但不是3D饼图,而是普通饼图?我不知道为什么!!我添加了选项3D和深度字段 这是它的外观: Contoller.phpPhp 三维饼图与普通图表类似,php,highcharts,pie-chart,Php,Highcharts,Pie Chart,我想使用ObHighchartsBundle创建一个3D饼图,但不是3D饼图,而是普通饼图?我不知道为什么!!我添加了选项3D和深度字段 这是它的外观: Contoller.php public function chartPie(Survey $servey) { $center= $servey ->getCenter(); $form = $servey ->getForm(); $ob = new Highchart(); $ob->
public function chartPie(Survey $servey)
{
$center= $servey ->getCenter();
$form = $servey ->getForm();
$ob = new Highchart();
$ob->chart->renderTo('containerpie');
$ob->chart->type('pie');
$ob->chart->options3d(array('enabled' => true,'alpha'=> '45','beta'=> null));
$ob->plotOptions->pie(array(
'depth' => '25',
'allowPointSelect' => true,
'cursor' => 'pointer',
'dataLabels' => array('enabled' => true , 'format'=> '{point.name}'),
'showInLegend' => true
));
$ob->title->text('Emploee');
$data = array(
array('Engineer', $form->getNbEngineer()),
array('Agents ', $form->getNbAgents ()),
array('Technicien', $form->getNbTechnicien()),
array(‘Laborer’,$form->getNbLaborer ())
);
$ob->series(array(array('type' => 'pie','name' => 'Browser', 'data' => $data)));
return $ob;
}
ChartingClass.php:
$containerpie=$chart->chartPie($servey);
$html = $this->render('AppBundle :Charting:index.html.twig',array(
'survey' =>$survey,
'containerpie' =>$containerpie
));
return $html;
}
<div id="containerpie" ></div>
<script src="http://code.highcharts.com/4.1.8/highcharts.js"></script>
<script src="http://code.highcharts.com/4.1.8/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/data.js"></script>
<script src="https://code.jquery.com/jquery-2.2.3.min.js"></script>
<script src="https://code.highcharts.com/modules/data.js"></script>
<script src="https://code.highcharts.com/highcharts-3d.js"></script>
<script type="text/javascript">
{{ chart(containerpie) }}
</script>
小枝:
$containerpie=$chart->chartPie($servey);
$html = $this->render('AppBundle :Charting:index.html.twig',array(
'survey' =>$survey,
'containerpie' =>$containerpie
));
return $html;
}
<div id="containerpie" ></div>
<script src="http://code.highcharts.com/4.1.8/highcharts.js"></script>
<script src="http://code.highcharts.com/4.1.8/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/data.js"></script>
<script src="https://code.jquery.com/jquery-2.2.3.min.js"></script>
<script src="https://code.highcharts.com/modules/data.js"></script>
<script src="https://code.highcharts.com/highcharts-3d.js"></script>
<script type="text/javascript">
{{ chart(containerpie) }}
</script>
{{chart(containerpie)}
看看你的js,你在highcharts之后有了jquery——jquery应该是第一位。此外,您还有混合的highcharts版本-您正在加载highcharts.js 4.1.8,但highcharts-3d.js很可能是5.0.12。尝试使用所有相同版本的highcharts文件,并首先加载jquery。非常感谢,这确实是一个版本问题