From a2870b21e2bb67ced1573b8f346aaf368e0d640f Mon Sep 17 00:00:00 2001 From: Erik Bernskiold Date: Fri, 29 Dec 2023 12:19:41 +0100 Subject: [PATCH] wip --- resources/js/chart.js | 19 +++++++------------ resources/views/components/chart.blade.php | 2 +- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/resources/js/chart.js b/resources/js/chart.js index 130ec36..a58d961 100644 --- a/resources/js/chart.js +++ b/resources/js/chart.js @@ -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() { diff --git a/resources/views/components/chart.blade.php b/resources/views/components/chart.blade.php index 5b0af79..f7753bf 100644 --- a/resources/views/components/chart.blade.php +++ b/resources/views/components/chart.blade.php @@ -2,6 +2,6 @@
class('chart')->merge([ 'x-data' => 'highchartsChart', ]) }}> -
+
{{ $slot }}