Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBernskiold committed Dec 29, 2023
1 parent 12b687e commit a2870b2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
19 changes: 7 additions & 12 deletions resources/js/chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,16 @@ export default () => {
});
},

exportChart: {
['@export-chart.document'](event) {
const chart = getChart(this.$refs.container.id);

if (chart.renderTo.id !== event.detail.chartId) {
return;
}
exportChart({detail: {chartId, type, exportSettings = {}, options = {}}}) {
const chart = getChart(this.$refs.container.id);

const exportSettings = event.detail.exportSettings || {};
exportSettings.type = event.detail.type;
if (chart.renderTo.id !== chartId) {
return;
}

const chartOptions = event.detail.options || {};
exportSettings.type = type;

chart.exportChartLocal(exportSettings, chartOptions);
},
chart.exportChartLocal(exportSettings, options);
},

initChart() {
Expand Down
2 changes: 1 addition & 1 deletion resources/views/components/chart.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<figure {{ $attributes->class('chart')->merge([
'x-data' => 'highchartsChart',
]) }}>
<div class="chart-container" id="{{ $chartKey }}" wire:ignore x-bind="exportData" x-ref="container"></div>
<div class="chart-container" id="{{ $chartKey }}" x-on:export-chart.document="exportChart" x-ref="container"></div>
{{ $slot }}
</figure>

0 comments on commit a2870b2

Please sign in to comment.