diff --git a/src/components/Charts/LineChart.jsx b/src/components/Charts/LineChart.jsx index 61efce2c..7b508e3d 100644 --- a/src/components/Charts/LineChart.jsx +++ b/src/components/Charts/LineChart.jsx @@ -5,7 +5,8 @@ import PropTypes from "prop-types"; const LineChart = ({ seriesData = [], categories = [], - colors = ["#1E90FF", "#FF6347"], // default: Dodger Blue & Tomato + colors = ["#1E90FF", "#FF6347"], + loading = false }) => { const hasValidData = Array.isArray(seriesData) && @@ -13,6 +14,15 @@ const LineChart = ({ Array.isArray(categories) && categories.length > 0; + if (loading) { + return ( +
+
+ Loading chart... +
+ ); + } + if (!hasValidData) { return
No data to display
; } @@ -105,7 +115,8 @@ LineChart.propTypes = { ), categories: PropTypes.arrayOf(PropTypes.string), colors: PropTypes.arrayOf(PropTypes.string), - title: PropTypes.string + title: PropTypes.string, + loading: PropTypes.bool }; export default LineChart;