diff --git a/src/components/Charts/LineChart.jsx b/src/components/Charts/LineChart.jsx index 565e5816..1dc1b1ac 100644 --- a/src/components/Charts/LineChart.jsx +++ b/src/components/Charts/LineChart.jsx @@ -3,10 +3,11 @@ import ReactApexChart from "react-apexcharts"; import PropTypes from "prop-types"; const LineChart = ({ - seriesData = [], - categories = [], - colors = ["#1E90FF", "#FF6347"], - loading = false + seriesData = [], + categories = [], + colors = ["#1E90FF", "#FF6347"], + loading = false, + lineChartCategoriesDates = [], }) => { const hasValidData = Array.isArray(seriesData) && @@ -100,11 +101,21 @@ const LineChart = ({ tooltip: { enabled: true, x: { - formatter: (val, opts) => val + formatter: (value, { dataPointIndex }) => { + if ( + lineChartCategoriesDates && + lineChartCategoriesDates.length > dataPointIndex + ) { + return lineChartCategoriesDates[dataPointIndex]; + } + return value; + } } } + }; + return (