Commit 18c12b71 authored by Guilhem CARRON's avatar Guilhem CARRON
Browse files

feat(conso): Comparison graph now scales on comparison data if no actual data...

feat(conso): Comparison graph now scales on comparison data if no actual data instead of default scale
parent 001d4568
......@@ -49,11 +49,19 @@ const BarChart: React.FC<BarChartProps> = ({
const maxCompare = chartData.comparisonData
? Math.max(...chartData.comparisonData.map(d => d.value))
: 0
let max = chartData.actualData
const max = chartData.actualData
? Math.max(...chartData.actualData.map(d => d.value))
: 0
max = max <= 0 ? 15 : max
return showCompare ? Math.max(max, maxCompare) : max
if (showCompare) {
if (max <= 0 && maxCompare <= 0) return 15
else return Math.max(max, maxCompare)
} else {
if (max <= 0) {
return 15
} else return max
}
}
const xScale: ScaleBand<string> = scaleBand()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment