Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chart turns into a dot if there is more than one chart on a page #114

Open
AditamaWibi opened this issue Nov 18, 2024 · 2 comments
Open

Comments

@AditamaWibi
Copy link

I need to add multiple chart on my dashboard, so I add more dependency on my index controller like this

public function index(
        FcrChart $fcrChart,
        ProduksiChart $produksiChart,
        KandangChart $kandangChart
    ) {
      return view('dashboard.index', [
                    'title' => 'Dashboard',
                    'fcrChart' => $fcrChart->build(),
                    'produksiChart' => $produksiChart->build(),
                    'kandangChart' => $kandangChart->build()
                ]);
}

But when I try to make one of the charts to have two datasets,

return $this->chart->lineChart()
            ->setTitle('Kandang')
            ->setSubtitle('Tahun ' . date("Y"))
            ->addLine('FCR', $dataFcr)
            ->addLine('Produksi', $dataProduksi)
            ->setHeight(430)
            ->setXAxis($dataNamaKandang);

the chart that has two data become like this
Problem

@kunalDHS
Copy link

Did you find a fix for this issue?

@marineusde
Copy link
Contributor

I do a fork of this project in april 2024, cause its not maintained anymore: https://github.com/marineusde/larapex-charts

My fork works with your problem:

    protected function getChart(): LineChart
    {
        $firstData = [
            'First' => 4,
            'Second' => 2,
            'Third' => 1,
            'Fourth' => 2,
            'Fifth' => 5
        ];

        $secondData = [
            'First' => 3,
            'Second' => 4,
            'Third' => 6,
            'Fourth' => 1,
            'Fifth' => 3
        ];

        return (new LineChart())
            ->addData('First Data', array_values($firstData))
            ->addData('Second Data', array_values($secondData));
    }

Bildschirmfoto vom 2024-11-29 12-22-07

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants