diff --git a/src/components/ContentComponents/Charts/BarChart.tsx b/src/components/ContentComponents/Charts/BarChart.tsx index 0f108b747ce48bb8de971f937e5d2b121159590d..8fa45f2fb68be6e2cfbf6776b9ca827e1c20cfe3 100644 --- a/src/components/ContentComponents/Charts/BarChart.tsx +++ b/src/components/ContentComponents/Charts/BarChart.tsx @@ -105,17 +105,21 @@ const BarChart: React.FC<BarChartProps> = (props: BarChartProps) => { return ( <svg width={width} height={height}> - <g transform={`translate(${marginLeft},${marginTop})`}> - <Hash - challengePeriod={challengePeriod} - multiFluid={multiFluid} - xScale={xScale} - padding={(xScaleWithoutPadding.bandwidth() - xScale.bandwidth()) / 2} - width={getContentWidth()} - height={getContentHeight()} - chartData={chartData} - /> - </g> + {timeStep === TimeStep.DAY && ( + <g transform={`translate(${marginLeft},${marginTop})`}> + <Hash + challengePeriod={challengePeriod} + multiFluid={multiFluid} + xScale={xScale} + padding={ + (xScaleWithoutPadding.bandwidth() - xScale.bandwidth()) / 2 + } + width={getContentWidth()} + height={getContentHeight()} + chartData={chartData} + /> + </g> + )} <AxisRight fluidTypes={fluidTypes} yScale={yScale} diff --git a/src/components/ContentComponents/Charts/Hash.tsx b/src/components/ContentComponents/Charts/Hash.tsx index d65f5710c74a32e5ac88195a7e8bf1f48e9fd984..457eba1bfed58cc9f64fb49f8e0100e8fd27d846 100644 --- a/src/components/ContentComponents/Charts/Hash.tsx +++ b/src/components/ContentComponents/Charts/Hash.tsx @@ -51,9 +51,19 @@ const Hash = (props: HashProps) => { ) if (!startScale && !endScale) { + const lastGraphDate = + chartData && + chartData.actualData && + chartData.actualData[chartData.actualData.length - 1] && + chartData.actualData[chartData.actualData.length - 1].date + const firstGraphDate = + chartData && + chartData.actualData && + chartData.actualData[0] && + chartData.actualData[0].date if ( - challengePeriod.endDate > chartData.actualData[6].date && - challengePeriod.startDate < chartData.actualData[0].date + challengePeriod.endDate > lastGraphDate && + challengePeriod.startDate < firstGraphDate ) { setScale([0, width - padding]) } else {