Skip to content

Commit

Permalink
Исправления
Browse files Browse the repository at this point in the history
  • Loading branch information
darkeum committed Sep 17, 2022
1 parent 9728b3a commit a02850f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
14 changes: 12 additions & 2 deletions src/Support/Livewire/ChartComponentData.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ class ChartComponentData implements Arrayable
* @param \Illuminate\Support\Collection $labels
* @param \Illuminate\Support\Collection $datasets
*/
public function __construct(Collection $labels, Collection $datasets)
public function __construct(Collection $labels, Collection $datasets, $datasets_name = [])
{
$this->labels = $labels;
$this->datasets = $datasets;
$this->datasets_name = $datasets_name;
}

/**
Expand All @@ -42,7 +43,8 @@ public function toArray(): array
{
return [
'labels' => $this->labels,
'datasets' => $this->datasets
'datasets' => $this->datasets,
'datasets_name' => $this->datasets_name,
];
}

Expand All @@ -60,6 +62,14 @@ public function checksum(): string
public function labels(): Collection
{
return $this->labels;
}

/**
* @return \Illuminate\Support\Collection
*/
public function datasets_name()
{
return $this->datasets_name;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Views/apex/container.blade.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<div id="{{ $chart->id }}" {!! $chart->formatContainerOptions('css') !!}>
<div id="{{ $chart->id }}">
</div>
@include('charts::loader')
9 changes: 6 additions & 3 deletions src/Views/apex/script.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ function {{ $chart->id }}_create(data) {
window.{{ $chart->id }} = new ApexCharts(document.querySelector("#{{ $chart->id }}"), {
{!! $chart->formatOptions(true, true) !!},
series: data,
xaxis: {
categories: {!! $chart->formatLabels() !!}
}
@if (!isset($chart->options['xaxis']))
xaxis: {
categories: {!! $chart->formatLabels() !!}
},
@endif
});
{{ $chart->id }}.render();
Expand Down

0 comments on commit a02850f

Please sign in to comment.