55 lines
1.4 KiB
PHP
55 lines
1.4 KiB
PHP
<?php $testPackages = db("test_packages")
|
|
->select("tp_general_status AS status")
|
|
->selectRaw("count(*) val")
|
|
->groupBy("tp_general_status")
|
|
->get();
|
|
?>
|
|
<div id="testStatusChart"></div>
|
|
<script>
|
|
|
|
$(() => {
|
|
|
|
const testStatusData = <?php echo json_encode_tr($testPackages) ?>;
|
|
|
|
$('#testStatusChart').dxPieChart({
|
|
type: 'doughnut',
|
|
// palette: 'Soft Pastel',
|
|
dataSource: testStatusData,
|
|
title: '{{e2("Test Status Percents")}}',
|
|
tooltip: {
|
|
enabled: true,
|
|
customizeTooltip(arg) {
|
|
return {
|
|
text: `${arg.valueText} - ${(arg.percent * 100).toFixed(2)}%`,
|
|
};
|
|
},
|
|
},
|
|
legend: {
|
|
horizontalAlignment: 'center',
|
|
verticalAlignment: 'top',
|
|
margin: 0,
|
|
},
|
|
export: {
|
|
enabled: true,
|
|
},
|
|
series: [{
|
|
argumentField: 'status',
|
|
label: {
|
|
visible: true,
|
|
//format: 'percent',
|
|
connector: {
|
|
visible: true,
|
|
|
|
},
|
|
customizeText: function (arg) {
|
|
|
|
return arg.percentText;
|
|
}
|
|
},
|
|
}],
|
|
});
|
|
});
|
|
|
|
</script>
|
|
|