Fix y-axis tick labels show floating point numbers
This commit is contained in:
@@ -274,7 +274,7 @@ const SimulationChart = React.memo(({
|
|||||||
// User set yAxisMax explicitly
|
// User set yAxisMax explicitly
|
||||||
// Add padding to dataMax and use the higher of manual or (dataMax + padding)
|
// Add padding to dataMax and use the higher of manual or (dataMax + padding)
|
||||||
const range = dataMax - dataMin;
|
const range = dataMax - dataMin;
|
||||||
const padding = range * 0.1;
|
const padding = range * 0.05;
|
||||||
const dataMaxWithPadding = dataMax + padding;
|
const dataMaxWithPadding = dataMax + padding;
|
||||||
// Use manual max only if it's higher than dataMax + padding
|
// Use manual max only if it's higher than dataMax + padding
|
||||||
domainMax = Math.max(numMax, dataMaxWithPadding);
|
domainMax = Math.max(numMax, dataMaxWithPadding);
|
||||||
@@ -283,9 +283,9 @@ const SimulationChart = React.memo(({
|
|||||||
domainMax = numMax;
|
domainMax = numMax;
|
||||||
}
|
}
|
||||||
} else if (dataMax !== -Infinity) { // data exists
|
} else if (dataMax !== -Infinity) { // data exists
|
||||||
// Auto mode: add 10% padding above
|
// Auto mode: add 5% padding above
|
||||||
const range = dataMax - dataMin;
|
const range = dataMax - dataMin;
|
||||||
const padding = range * 0.1;
|
const padding = range * 0.05;
|
||||||
domainMax = dataMax + padding;
|
domainMax = dataMax + padding;
|
||||||
} else { // no data
|
} else { // no data
|
||||||
domainMax = 100;
|
domainMax = 100;
|
||||||
@@ -544,7 +544,7 @@ const SimulationChart = React.memo(({
|
|||||||
domain={yAxisDomain as any}
|
domain={yAxisDomain as any}
|
||||||
axisLine={{ stroke: isDarkTheme ? '#ccc' : '#666' }}
|
axisLine={{ stroke: isDarkTheme ? '#ccc' : '#666' }}
|
||||||
tick={<YAxisTick />}
|
tick={<YAxisTick />}
|
||||||
allowDecimals={true}
|
allowDecimals={false}
|
||||||
allowDataOverflow={false}
|
allowDataOverflow={false}
|
||||||
/>
|
/>
|
||||||
<RechartsTooltip
|
<RechartsTooltip
|
||||||
|
|||||||
Reference in New Issue
Block a user