Show Resource page when click on doughnut chart segment

How can I Show Resource page when click on doughnut chart segment?
1 Reply
Mokatchi
MokatchiOP5w ago
Here is my code:
protected function getType(): string
{
return 'doughnut';
}

protected function getOptions(): array
{
return [
'scales' => [
'x' => [
'display' => false,
],
'y' => [
'display' => false,
],
],
'plugins' => [
'legend' => [
'onClick' => 'handleClick',
]
]
];
}

public function handleClick($segmentIndex): void
{
dd( 'i am clicked!!! ');
// $statuses = ['not_launched', 'in_progress', 'finished'];
// $status = $statuses[$segmentIndex];

// $url = ProjProgResource::getUrl('index', [
// 'status' => $status,
// ]);

// redirect($url)->send();
}
protected function getType(): string
{
return 'doughnut';
}

protected function getOptions(): array
{
return [
'scales' => [
'x' => [
'display' => false,
],
'y' => [
'display' => false,
],
],
'plugins' => [
'legend' => [
'onClick' => 'handleClick',
]
]
];
}

public function handleClick($segmentIndex): void
{
dd( 'i am clicked!!! ');
// $statuses = ['not_launched', 'in_progress', 'finished'];
// $status = $statuses[$segmentIndex];

// $url = ProjProgResource::getUrl('index', [
// 'status' => $status,
// ]);

// redirect($url)->send();
}
I couldn't get any reaction when I clicked on the segment.Any help or suggestions !?
Want results from more Discord servers?
Add your server