Salut les amis ! Je veux utiliser Google charts Bundle pour générer mes graphes ! donc je suis le lien suivant ! Je veux générer une comboChart qui contient 2 bars (Actions déclarés et Actions Non cloturées ) avec une ligne qui montre le taux de retard . On me retourne l'erreur suivante : Cannot read property 'count' of undefined Voilà mon code :
chartdata.php
data.php
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40 public function dataActionsRetardByWeek() { $actionsCreats = $this->em->getRepository('ActionActionBundle:Action')->ActionsCreatByWeek(); $actionsRetards = $this->em->getRepository('ActionActionBundle:Action')->ActionsRetardByWeek(); $arrayToDataTable[] = ['Semaine', 'Actions Ouvertes', ['role' => 'tooltip'], 'Actions en Retard',['role' => 'tooltip'], 'Taux de Retard',['role' => 'tooltip'] ]; //$arrayToDataTable[] = ['Semaine', 'Actions Ouvertes', ['role' => 'tooltip'], 'Taux de Retard',['role' => 'tooltip'] ]; $NombreAction = 0; $NombreActionRetard = 0; foreach ($actionsCreats as $actionsCreat) { if($NombreAction !=0){ foreach ($actionsRetards as $actionsRetard) { //if($NombreActionRetard !=0){ $tauxRetard = round(($actionsRetard['nmbreRetard']*100) / $NombreAction, 2); //}else{ //$tauxRetard = 0; //} //$NombreActionRetard = $actionsRetard['nmbreRetard']; $NombreAction = $actionsCreat['nmbreAction']; $tooltipTaux ="Taux de Retard %"; $tooltipRetard=$this->formatnmbreRetard($actionsRetard['nmbreRetard']) . 'Actions';//"Actions en retard"; $tooltipCreat=$this->formatnmbreAction($actionsCreat['nmbreAction']) . 'Actions';//"Actions ouvertes"; $arrayToDataTable[] = [$actionsCreat['week'], intval($actionsCreat['nmbreAction']), $tooltipCreat, intval($actionsRetard['nmbreRetard']), $tooltipRetard, $tauxRetard, $tooltipTaux]; } }else{ $tauxRetard = 0; } } return $arrayToDataTable; }
Ca fait 2 jrs que je bloque sur cette erreur :'( :'(
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46 public function ActionsRetardByWeek() { $arrayToDataTable = $this->chartData->dataActionsRetardByWeek(); $chart = new ComboChart(); $chart->getData()->setArrayToDataTable($arrayToDataTable); $chart->getOptions()->getAnimation()->setStartup(self::ANIMATION_STARTUP); $chart->getOptions()->getAnimation()->setDuration(self::ANIMATION_DURATION); $chart->getOptions()->getChartArea()->setHeight(self::CHART_AREA_HEIGHT); $chart->getOptions()->getChartArea()->setWidth(self::CHART_AREA_WIDTH); $vAxisAction = new VAxis(); $vAxisAction->setTitle('Actions'); $vAxisTaux = new VAxis(); $vAxisTaux->setTitle('Taux de Retard %'); $chart->getOptions()->setVAxes(json_encode ([$vAxisAction,$vAxisTaux],JSON_NUMERIC_CHECK)); //$chart->getOptions()->setVAxes([$vAxisAction,$vAxisTaux]); /**Actions ouvertes*/ $seriesAction = new \CMEN\GoogleChartsBundle\GoogleCharts\Options\ComboChart\Series(); $seriesAction->setType('bars'); $seriesAction->setTargetAxisIndex(0); $seriesAction->setColor('#5858FA'); /**Actions en retard**/ $seriesRetard = new \CMEN\GoogleChartsBundle\GoogleCharts\Options\ComboChart\Series(); $seriesRetard->setType('bars'); $seriesRetard->setTargetAxisIndex(1); $seriesRetard->setColor('#C64141'); /** Taux de retard**/ $seriesTaux = new \CMEN\GoogleChartsBundle\GoogleCharts\Options\ComboChart\Series(); $seriesTaux->setType('line'); $seriesTaux->setTargetAxisIndex(2); $seriesTaux->setColor('yellow'); $chart->getOptions()->setSeries([$seriesAction,$seriesRetard,$seriesTaux]); $chart->getOptions()->getHAxis()->setTitle('Semaine'); return $chart; }
Partager