From c7997758bdc45e51984807b0551bb666fd5b281e Mon Sep 17 00:00:00 2001 From: asantibanez Date: Wed, 1 Feb 2023 13:10:12 -0500 Subject: [PATCH] Added ability to format value via "extras.formatted" --- resources/js/columnChart.js | 8 ++++++++ resources/js/lineChart.js | 8 ++++++++ resources/js/pieChart.js | 8 ++++++++ 3 files changed, 24 insertions(+) diff --git a/resources/js/columnChart.js b/resources/js/columnChart.js index f69c599..d9d192e 100644 --- a/resources/js/columnChart.js +++ b/resources/js/columnChart.js @@ -91,6 +91,14 @@ const columnChart = () => { fill: { opacity: component.get('columnChartModel.opacity') || 0.5 }, + + tooltip: { + y: { + formatter: function(value, series) { + return data[series.dataPointIndex].extras.formatted || value; + } + } + }, }; const colors = component.get('columnChartModel.colors'); diff --git a/resources/js/lineChart.js b/resources/js/lineChart.js index e8beeb9..6106e8c 100644 --- a/resources/js/lineChart.js +++ b/resources/js/lineChart.js @@ -96,6 +96,14 @@ const lineChart = () => { } ) }, + + tooltip: { + y: { + formatter: function(value, series) { + return data[series.dataPointIndex].extras.formatted || value; + } + } + }, }; this.chart = new ApexCharts(this.$refs.container, options); diff --git a/resources/js/pieChart.js b/resources/js/pieChart.js index 4b2a3cc..89c12e2 100644 --- a/resources/js/pieChart.js +++ b/resources/js/pieChart.js @@ -73,6 +73,14 @@ const pieChart = () => { ], legend: component.get('pieChartModel.legend') || {}, + + tooltip: { + y: { + formatter: function(value, series) { + return data[series.dataPointIndex].extras.formatted || value; + } + } + }, }; const colors = component.get('pieChartModel.colors');