I have a Laravel app that uses backpack and I am trying to create a chart with bars that when clicked, will redirect you to a specific CRUD page on the site. I did a little research and figured out that Fusioncharts (one of the charting libraries listed on the Laravel Backpack Chart Widget Documentation) supports adding a "link" property to the data.
I am trying to create a page with an example Fusionchart Chart, but it only renders a box that says "Loading chart. Please wait."
My Chart Controller:
<?php
declare(strict_types=1);
namespace App\Http\Controllers\Charts;
use Backpack\CRUD\app\Http\Controllers\ChartController;
use ConsoleTVs\Charts\Classes\Fusioncharts\Chart;
class ExampleChartController extends ChartController
{
public function setup(): void
{
$this->chart = new Chart();
$this->chart->labels(['Label 1', 'Label 2', 'Label 3']);
$this->chart->load(backpack_url('charts/example'));
}
public function data(): void
{
$this->chart->dataset('Group 1', 'bar', [1, 2, 3]);
}
}
The chart renders correctly when I change the import to use ConsoleTVs\Charts\Classes\Chartjs\Chart; instead of use ConsoleTVs\Charts\Classes\Fusioncharts\Chart;
Can anyone help me get this chart working, or let me know if it's even possible to add links to bars using Backpack Widgets? Thanks.