-
Notifications
You must be signed in to change notification settings - Fork 86
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
setLabels doesn't work with donut chart #83
Comments
Thanks for adding the issue, I am going to check this as soon as possible. |
The same with PieChart. |
@ArielMejiaDev can you, please, have a look? Pie and Donut charts are completely useless without working labels. |
How are you populating the labels? It works fine for me using a donut chart:
|
Hmm, only difference I have is that I'm calling it slightly differently, but this works for me: public function build(array $data, array $labels): \ArielMejiaDev\LarapexCharts\DonutChart
{
return $this->chart->donutChart()
->setTitle('Valuations Outcome')
->addData($data)
->setLabels($labels);
} |
No, nothing helps. public function build(): \ArielMejiaDev\LarapexCharts\DonutChart
{
return (new LarapexChart)->donutChart()
->setTitle('Valuations Outcome')
->addData([1, 2, 3, 4])
->setLabels(['Label 1', 'Label 2', 'Label 3', 'Label 4']);
} Are you on the latest version of Larapex charts? |
Yes, installed it today. Did you create the chart using |
I'm using Livewire: // app/Livewire/MyComponent.php
<?php
namespace App\Livewire;
use ArielMejiaDev\LarapexCharts\DonutChart;
use ArielMejiaDev\LarapexCharts\LarapexChart;
use Livewire\Component;
class MyComponent extends Component
{
public function build(): DonutChart
{
return app(LarapexChart::class)->donutChart()
->setTitle('Some title')
->addData([1, 2, 3])
->setLabels(['Label 1', 'Label 2', 'Label 3']);
}
public function render()
{
return view('livewire.my-component', ['chart' => $this->build()]);
}
} <!-- resources/views/livewire/my-component.blade.php -->
<div>
{!! $chart->container() !!}
{{ $chart->script() }}
</div> The same approach works well with other types of charts. |
Im having the same issue |
Yes I am having the same issue with pie charts. |
I would check this issue, sorry for the delay, thanks |
Sorry, even after updating to the newest version I am still not seeing the labels update for pie or donut charts.
|
I did notice if you remove the conditional on lines 23 and 25 in larapex-charts/stubs/resources/views/chart/script.blade.php the labels start to work. |
Hello, |
I published a fork of the project some days ago and have done some codestyle, bugfixed ect. I tested your code in a laravel 10 project in my version 1.2.3, maybe you can use it too: https://github.com/marineusde/larapex-charts working code from @blisstechllc :
|
From what I can tell, in
When it renders in the blade view by calling
The simplest fix is just adding an extra line after the initial
Removing the |
sorry the issue still exist |
Did you test my fork, it still works there: https://github.com/marineusde/larapex-charts |
The chart still shows the default legend instead of using the given array of labels
The text was updated successfully, but these errors were encountered: