chart beteligte

cluster
Walter Hupfeld 7 months ago
parent b0de883339
commit 88d8ca75a3

@ -125,6 +125,9 @@
?>
</table>
</div>
<div class="col-7">
<div id="c_unfallbeteiligte"></div>
</div>
</div>
<!-- Unfalltyp -->
@ -161,6 +164,7 @@
</div>
</div>
</div>
<?= get_series_beteiligte($resultBeteiligte,$arrBeteiligte) ?>
</body>
<script>
@ -246,7 +250,7 @@ Highcharts.chart('c_unfalltyp', {
type: 'pie'
},
title: {
text: 'Unfalltyp',
text: 'Unfalltypen',
align: 'center'
},
tooltip: {
@ -273,5 +277,41 @@ Highcharts.chart('c_unfalltyp', {
data: <?= get_series($resultUnfalltyp,$arrUnfalltyp,"UTYP1") ?>
}]
});
Highcharts.chart('c_unfallbeteiligte', {
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
type: 'pie'
},
title: {
text: 'Unfallbeteiligte',
align: 'center'
},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
},
accessibility: {
point: {
valueSuffix: '%'
}
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
format: '<b>{point.name}</b>: {point.percentage:.1f} %'
}
}
},
series: [{
name: 'Unfallarten',
colorByPoint: true,
data: <?= get_series_beteiligte($resultBeteiligte,$arrBeteiligte) ?>
}]
});
</script>
</html>

@ -62,3 +62,13 @@ function get_series($arrData,$arrBezeichnung,$strIndex1,$strIndex2="anz"){
return $result;
}
function get_series_beteiligte($arrData,$arrBezeichnung){
$result="[";
foreach ($arrData as $key => $numCount) {
if ($key!="rad") { // Fahrräder sind immer beteiligt.
$result .= "{name: '".$arrBezeichnung[$key]."', y: ".$numCount."},"; }
}
$result.="]";
return $result;
}

Loading…
Cancel
Save