Added proper alignment for process order rejection chart #1466
@@ -5,6 +5,7 @@ namespace App\Filament\Widgets;
|
||||
use App\Models\CharacteristicValue;
|
||||
use Filament\Widgets\ChartWidget;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Filament\Support\RawJs;
|
||||
|
||||
class ProcessOrderChart extends ChartWidget
|
||||
{
|
||||
@@ -218,22 +219,55 @@ class ProcessOrderChart extends ChartWidget
|
||||
return 'bar';
|
||||
}
|
||||
|
||||
// protected function getOptions(): array
|
||||
// {
|
||||
// return [
|
||||
// 'scales' => [
|
||||
// 'x' => [
|
||||
// 'stacked' => true,
|
||||
// ],
|
||||
// 'y' => [
|
||||
// 'stacked' => true,
|
||||
// 'beginAtZero' => true,
|
||||
// ],
|
||||
// ],
|
||||
// 'plugins' => [
|
||||
// 'legend' => [
|
||||
// 'display' => true,
|
||||
// 'position' => 'top',
|
||||
// ],
|
||||
// ],
|
||||
// ];
|
||||
// }
|
||||
|
||||
|
||||
|
||||
protected function getOptions(): array
|
||||
{
|
||||
return [
|
||||
'scales' => [
|
||||
'x' => [
|
||||
'stacked' => true,
|
||||
],
|
||||
'y' => [
|
||||
'stacked' => true,
|
||||
'beginAtZero' => true,
|
||||
// 'plugins' => [
|
||||
// 'datalabels' => false,
|
||||
// ],
|
||||
'plugins' => [
|
||||
'datalabels' => [
|
||||
'anchor' => 'start', // Positions the label relative to the top of the bar
|
||||
'align' => 'start', // Aligns the label above the bar
|
||||
'offset' => -15, // Adjust if needed (positive moves up, negative moves down)
|
||||
'color' => '#000',
|
||||
'font' => [
|
||||
'weight' => 'bold',
|
||||
],
|
||||
'formatter' => RawJs::make('function(value) {
|
||||
return value;
|
||||
}'),
|
||||
],
|
||||
],
|
||||
'plugins' => [
|
||||
'legend' => [
|
||||
'display' => true,
|
||||
'position' => 'top',
|
||||
'scales' => [
|
||||
'y' => [
|
||||
'beginAtZero' => true, //Start Y-axis from 0
|
||||
'ticks' => [
|
||||
'stepSize' => 0.5,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user