Added proper alignment for process order rejection chart #1466

Merged
jothi merged 1 commits from ranjith-dev into master 2026-11-18 06:33:46 +00:00

View File

@@ -5,6 +5,7 @@ namespace App\Filament\Widgets;
use App\Models\CharacteristicValue; use App\Models\CharacteristicValue;
use Filament\Widgets\ChartWidget; use Filament\Widgets\ChartWidget;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Filament\Support\RawJs;
class ProcessOrderChart extends ChartWidget class ProcessOrderChart extends ChartWidget
{ {
@@ -218,22 +219,55 @@ class ProcessOrderChart extends ChartWidget
return 'bar'; 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 protected function getOptions(): array
{ {
return [ return [
'scales' => [ // 'plugins' => [
'x' => [ // 'datalabels' => false,
'stacked' => true, // ],
],
'y' => [
'stacked' => true,
'beginAtZero' => true,
],
],
'plugins' => [ 'plugins' => [
'legend' => [ 'datalabels' => [
'display' => true, 'anchor' => 'start', // Positions the label relative to the top of the bar
'position' => 'top', '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;
}'),
],
],
'scales' => [
'y' => [
'beginAtZero' => true, //Start Y-axis from 0
'ticks' => [
'stepSize' => 0.5,
],
], ],
], ],
]; ];