Merge pull request #2912 from EnesSacid-Buker/master
Vue cannot read length issue
This commit is contained in:
commit
8a0d02d0a0
@ -222,7 +222,9 @@ abstract class Report
|
|||||||
foreach ($tmp_values as $id => $value) {
|
foreach ($tmp_values as $id => $value) {
|
||||||
$labels[$id] = $this->row_names[$table_key][$id];
|
$labels[$id] = $this->row_names[$table_key][$id];
|
||||||
|
|
||||||
$colors[$id] = ($group == 'category') ? Category::withSubCategory()->find($id)?->colorHexCode : '#' . dechex(rand(0x000000, 0xFFFFFF));
|
$colors[$id] = ($group == 'category')
|
||||||
|
? Category::withSubCategory()->find($id)?->colorHexCode
|
||||||
|
: $this->randHexColor();
|
||||||
|
|
||||||
$values[$id] = round(($value * 100 / $total), 0);
|
$values[$id] = round(($value * 100 / $total), 0);
|
||||||
}
|
}
|
||||||
@ -642,4 +644,14 @@ abstract class Report
|
|||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function randHexColorPart(): string
|
||||||
|
{
|
||||||
|
return str_pad( dechex( mt_rand( 0, 255 ) ), 2, '0', STR_PAD_LEFT);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function randHexColor(): string
|
||||||
|
{
|
||||||
|
return '#' . $this->randHexColorPart() . $this->randHexColorPart() . $this->randHexColorPart();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user