mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Fixed [ch945] - Status colors are not displaying correctly in the chart on the dashboard
This commit is contained in:
parent
895a544d4c
commit
044dfe2620
|
@ -171,20 +171,26 @@ class StatuslabelsController extends Controller
|
||||||
|
|
||||||
$labels=[];
|
$labels=[];
|
||||||
$points=[];
|
$points=[];
|
||||||
$colors=[];
|
$default_color = Helper::chartColors();
|
||||||
|
$default_color_count = 0;
|
||||||
|
|
||||||
foreach ($statuslabels as $statuslabel) {
|
foreach ($statuslabels as $statuslabel) {
|
||||||
if ($statuslabel->assets_count > 0) {
|
if ($statuslabel->assets_count > 0) {
|
||||||
|
|
||||||
$labels[]=$statuslabel->name. ' ('.number_format($statuslabel->assets_count).')';
|
$labels[]=$statuslabel->name. ' ('.number_format($statuslabel->assets_count).')';
|
||||||
$points[]=$statuslabel->assets_count;
|
$points[]=$statuslabel->assets_count;
|
||||||
|
|
||||||
if ($statuslabel->color!='') {
|
if ($statuslabel->color!='') {
|
||||||
$colors[]=$statuslabel->color;
|
$colors_array[] = $statuslabel->color;
|
||||||
|
} else {
|
||||||
|
$colors_array[] = $default_color[$default_color_count];
|
||||||
|
$default_color_count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$colors_array = array_merge($colors, Helper::chartColors());
|
$colors_array = array_merge($colors_array, Helper::chartColors());
|
||||||
|
|
||||||
$result= [
|
$result= [
|
||||||
"labels" => $labels,
|
"labels" => $labels,
|
||||||
|
|
Loading…
Reference in a new issue