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