mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 13:44:06 -08:00
Added counts to Dashboard Pie Chart legends and tooltips
This commit is contained in:
parent
9c6fa18454
commit
420c216973
|
@ -3,14 +3,15 @@
|
||||||
namespace App\Http\Transformers;
|
namespace App\Http\Transformers;
|
||||||
|
|
||||||
|
|
||||||
use App\Helpers\Helper;/**
|
use App\Helpers\Helper;
|
||||||
|
/**
|
||||||
* Class PieChartTransformer
|
* Class PieChartTransformer
|
||||||
*
|
*
|
||||||
* This handles the standardized formatting of the API response we need to provide for
|
* This handles the standardized formatting of the API response we need to provide for
|
||||||
* the pie charts
|
* the pie charts
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\Response
|
* @return \Illuminate\Http\Response
|
||||||
*@since [v6.0.11]
|
* @since [v6.0.11]
|
||||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||||
*/
|
*/
|
||||||
class PieChartTransformer
|
class PieChartTransformer
|
||||||
|
@ -27,7 +28,7 @@ class PieChartTransformer
|
||||||
|
|
||||||
if ($total['count'] > 0) {
|
if ($total['count'] > 0) {
|
||||||
|
|
||||||
$labels[] = $total['label'];
|
$labels[] = $total['label']." (".$total['count'].")";
|
||||||
$counts[] = $total['count'];
|
$counts[] = $total['count'];
|
||||||
|
|
||||||
if (isset($total['color'])) {
|
if (isset($total['color'])) {
|
||||||
|
|
|
@ -427,6 +427,13 @@
|
||||||
position: 'top',
|
position: 'top',
|
||||||
responsive: true,
|
responsive: true,
|
||||||
maintainAspectRatio: true,
|
maintainAspectRatio: true,
|
||||||
|
},
|
||||||
|
tooltips: {
|
||||||
|
callbacks: {
|
||||||
|
label: function(tooltipItem, data) {
|
||||||
|
return data.labels[tooltipItem.datasetIndex] || '';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue