Open leonardyrj opened 8 months ago
Can you show some sample code?, so I can, easily copy / paste to debug the issue
` class NotaFiscalDash extends Dashboard {
public function name()
{
return 'Painel Nota Fiscal';
}
use MegaFilterTrait;
public function filters(NovaRequest $request)
{
return [
new NotaFiscalDashPeriodoFilter,
new NotaFiscalDashUfFilter,
new NotaFiscalDashTransportadoraFilter,
];
}
/**
* Get the cards for the dashboard.
*
* @return array
*/
public function cards(): array
{
return [
NovaDashboard::make()
->addView('Filtro Personalizado', function (View $view) {
return $view
->icon('window')
->addWidgets([
TotalEntregasDash::make(),
TotalEntregasEmAbertoDash::make(),
EntregasEmAbertoForaPrazoDash::make(),
NotasIncluidasHojeDash::make(),
MediaValorFreteDash::make(),
PrazoEntregaVencendoHojeDash::make(),
PerformanceGeralDash::make(),
EntregasEmAbertoDash::make(),
])
->addFilters([
NotaFiscalDashTransportadoraFilter::make(),
NotaFiscalDashUfFilter::make(),
NotaFiscalDashPeriodoFilter::make()
->dividerLabel(' ') // control the divider label in between the inputs
->inputType('date'), // supports any html input type
]);
}),
];
}
}`
`<?php
namespace App\Nova\Metrics;
use Illuminate\Support\Collection; use DigitalCreative\NovaDashboard\Filters; use Laravel\Nova\Http\Requests\NovaRequest; use DigitalCreative\ChartJsWidget\Charts\PolarAreaChartWidget;
class PerformanceGeralDash extends PolarAreaChartWidget { /**
@return mixed */
public function configure(NovaRequest $request): void { $this->title('Performance Geral'); $this->buttonTitle('PolarAreaChart'); $this->backgroundColor(dark: '#1e293b', light: '#ffffff');
$this->padding(top: 30, bottom: 5);
$this->tooltip([]); // https://www.chartjs.org/docs/latest/configuration/tooltip.html#tooltip
$this->scales([]); // https://www.chartjs.org/docs/latest/axes/#axes
$this->legend([]); // https://www.chartjs.org/docs/latest/configuration/legend.html#legend
$this->elements(); // https://www.chartjs.org/docs/latest/configuration/elements.html#elements
}
public function value(Filters $filters) { return [ 'labels' => Collection::range(0, 5)->map(fn () => fake()->word()), 'datasets' => Collection::range(0, 5)->map(fn () => [ 'data' => Collection::range(0, 5)->map(fn () => fake()->numberBetween(0, 100)), ]), ]; } }`
Same here. Also get cannot convert undefined or null to object
Removing the empty tooptip, scales, legend and elements from configure seemed to make it work.
So remove this if empty
$this->tooltip([]); // https://www.chartjs.org/docs/latest/configuration/tooltip.html#tooltip $this->scales([]); // https://www.chartjs.org/docs/latest/axes/#axes $this->legend([]); // https://www.chartjs.org/docs/latest/configuration/legend.html#legend $this->elements(); // https://www.chartjs.org/docs/latest/configuration/elements.html#elements
It's the same as the example