diff --git a/src/components/Charts/AxisBottom.tsx b/src/components/Charts/AxisBottom.tsx index d2e8bffd288bc0219661eb1661812c224865425f..559f144fb839435a6670d5ae136a934fbaa0e419 100644 --- a/src/components/Charts/AxisBottom.tsx +++ b/src/components/Charts/AxisBottom.tsx @@ -15,7 +15,7 @@ interface TextTypeProps { timeStep: TimeStep width: number selectedDate: DateTime - isDuel?: boolean + displayAllDays?: boolean } function TextAxis({ @@ -24,7 +24,7 @@ function TextAxis({ timeStep, width, selectedDate, - isDuel, + displayAllDays, }: TextTypeProps) { const dateChartService = new DateChartService() const isSelectedDate = dateChartService.compareStepDate( @@ -56,7 +56,7 @@ function TextAxis({ case TimeStep.DAY: return ( <text y="10" dy="0.71em" transform={`translate(${width})`}> - {isDuel ? ( + {displayAllDays ? ( <> <tspan className={style} x="0" textAnchor="middle"> {dataload.date.toLocaleString({ weekday: 'narrow' })} @@ -128,11 +128,12 @@ const AxisBottom: React.FC<AxisBottomProps> = ({ height, marginLeft, marginBottom, - isDuel, + isDuel = false, }: AxisBottomProps) => { const { selectedDate } = useSelector((state: AppStore) => state.ecolyo.chart) const dashArray = `${height / 30} ${height / 30}` const dateChartService = new DateChartService() + const displayAllDays: boolean = isDuel && data.length <= 15 return ( <g className="axis x" @@ -153,7 +154,7 @@ const AxisBottom: React.FC<AxisBottomProps> = ({ timeStep={timeStep} width={xScale.bandwidth() / 2} selectedDate={selectedDate} - isDuel={isDuel} + displayAllDays={displayAllDays} /> {dateChartService.compareStepDate( timeStep,