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

->setOptions doesn't work #21

Open
lukejames1111 opened this issue May 9, 2024 · 1 comment
Open

->setOptions doesn't work #21

lukejames1111 opened this issue May 9, 2024 · 1 comment

Comments

@lukejames1111
Copy link

Continuing from this thread.

I am trying to add basic options to the chart, but when I try to use the chart I received Call to undefined method marineusde\LarapexCharts\Charts\LineChart::setOptions()

Here's my most basic example

use marineusde\LarapexCharts\Charts\LineChart AS OriginalLineChart;

class AverageTimeOnMarketChart
{
    public function build(): OriginalLineChart
    {
        $options = [
            'yaxis' => [
                'decimalsInFloat' => 0,
            ]
        ];

        return (new OriginalLineChart)
            ->setXAxis(['January'])
            ->addData('Time on Market', ['10'])
            ->setOptions($options)
        ;
    }
}

The only way I can get options to work is if I edit the LarapexChart.php getDefaultOptions() directly.

@marineusde
Copy link
Owner

I fixed it some weeks ago, but didnt publish a release, sorry.

You can do it in 1.3.2 with the method "setAdditionalOptions":

use marineusde\LarapexCharts\Charts\LineChart AS OriginalLineChart;

class AverageTimeOnMarketChart
{
    public function build(): OriginalLineChart
    {
        $options = [
            'yaxis' => [
                'decimalsInFloat' => 0,
            ]
        ];

        return (new OriginalLineChart)
            ->setXAxis(['January'])
            ->addData('Time on Market', ['10'])
            ->setAdditionalOptions($options)
        ;
    }
}

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

2 participants