dcasia / chartjs-widget

A ChartJs widget for laravel Nova Dashboard.
MIT License
8 stars 5 forks source link

the graphics are not showing #13

Open leonardyrj opened 8 months ago

leonardyrj commented 8 months ago
Captura de Tela 2024-02-26 às 16 30 57

It's the same as the example

milewski commented 8 months ago

Can you show some sample code?, so I can, easily copy / paste to debug the issue

leonardyrj commented 8 months ago

` 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 { /**

matthbon commented 1 week ago

Same here. Also get cannot convert undefined or null to object

matthbon commented 6 days ago

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