more precision in chart data minmax
This commit is contained in:
parent
bc85db22b5
commit
52a84a7268
|
@ -363,12 +363,14 @@ const DetailedAreaChart: FunctionComponent<DetailedAreaChartProps> = ({
|
|||
domain
|
||||
? domain
|
||||
: ([dataMin, dataMax]) => {
|
||||
const difference =
|
||||
Math.abs(dataMax) - Math.abs(dataMin)
|
||||
if (difference < 0.1) {
|
||||
const difference = dataMax - dataMin
|
||||
|
||||
if (difference < 0.01) {
|
||||
return [dataMin - 0.001, dataMax + 0.001]
|
||||
} else if (difference < 0.1) {
|
||||
return [dataMin - 0.01, dataMax + 0.01]
|
||||
} else if (difference < 1) {
|
||||
return [dataMin - 0.1, dataMax + 0.1]
|
||||
return [dataMin - 0.1, dataMax + 0.11]
|
||||
} else if (difference < 10) {
|
||||
return [dataMin - 1, dataMax + 1]
|
||||
} else {
|
||||
|
|
|
@ -43,8 +43,11 @@ const SimpleAreaChart = ({
|
|||
<XAxis dataKey={xKey} hide />
|
||||
<YAxis
|
||||
domain={([dataMin, dataMax]) => {
|
||||
const difference = Math.abs(dataMax) - Math.abs(dataMin)
|
||||
if (difference < 0.1) {
|
||||
const difference = dataMax - dataMin
|
||||
|
||||
if (difference < 0.01) {
|
||||
return [dataMin - 0.001, dataMax + 0.001]
|
||||
} else if (difference < 0.1) {
|
||||
return [dataMin - 0.01, dataMax + 0.01]
|
||||
} else if (difference < 1) {
|
||||
return [dataMin - 0.1, dataMax + 0.11]
|
||||
|
|
Loading…
Reference in New Issue