Non puoi selezionare più di 25 argomenti
Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
92 righe
2.6 KiB
92 righe
2.6 KiB
<? |
|
if (!empty($titolo) && !empty($serie) && !empty($idGraph)) { |
|
$arrangedData = reportManager::arrangeDataForGraph($serie,true); |
|
$dati = $arrangedData["dati"]; |
|
$categorie = $arrangedData["categorie"]; |
|
$subCategorie = $arrangedData["subCategorie"] ?? null; |
|
?> |
|
<div id="graph<?= $idGraph ?>"></div> |
|
<script> |
|
var thisChart<?= $idGraph ?> = Highcharts.chart('graph<?= $idGraph ?>', { |
|
chart: { |
|
type: 'line', |
|
zoomType: 'x', |
|
height: <?= $chartHeight ?>, |
|
}, |
|
title: { |
|
text: "<?= str_replace('"','',$titolo) ?>" |
|
}, |
|
|
|
xAxis: { |
|
categories: [ |
|
"<?= implode("\",\"",($subCategorie ?? $categorie)) ?>" |
|
], |
|
crosshair: true |
|
}, |
|
yAxis: { |
|
min: 0, |
|
}, |
|
plotOptions: { |
|
column: { |
|
pointPadding: 0.2, |
|
borderWidth: 0 |
|
} |
|
}, |
|
series: [ |
|
<? |
|
foreach($dati AS $groupId => $macroData) { |
|
if (empty($subCategorie)) { |
|
?> |
|
{ |
|
name: "<?= str_replace('"',"",$titolo) ?>", |
|
data: [ |
|
<? |
|
ksort($macroData); |
|
foreach($macroData AS $label => $data) { |
|
if (!is_array($data)) { |
|
?> |
|
{ |
|
y: <?= $data ?>, |
|
name: "<?= str_replace('"',"",$label) ?>" |
|
}, |
|
<? |
|
} |
|
} |
|
?> |
|
] |
|
}, |
|
<? |
|
} else { |
|
ksort($macroData); |
|
foreach($macroData AS $macroLabel => $macroGroup) { |
|
?> |
|
{ |
|
name: "<?= str_replace('"',"",$macroLabel) ?>", |
|
data: [ |
|
<? |
|
ksort($macroGroup); |
|
foreach($macroGroup AS $label => $data) { |
|
if (!is_array($data)) { |
|
?> |
|
{ |
|
y: <?= $data ?>, |
|
name: "<?= str_replace('"',"",$label) ?>" |
|
}, |
|
<? |
|
} |
|
} |
|
?> |
|
] |
|
}, |
|
<? |
|
} |
|
} |
|
} |
|
?> |
|
] |
|
}) |
|
charts.push(thisChart<?= $idGraph ?>); |
|
</script> |
|
<? |
|
} |
|
?>
|