feat: Adds a control to set the Secondary Y-axis bounds in Mixed charts (#23917)

Co-authored-by: Evan Rusackas <evan@preset.io>
This commit is contained in:
Michael S. Molina
2023-05-05 10:11:54 -03:00
committed by GitHub
parent f3f5d926c1
commit b4371f68b7
2 changed files with 28 additions and 5 deletions

View File

@@ -139,6 +139,7 @@ export default function transformProps(
yAxisFormatSecondary,
xAxisTimeFormat,
yAxisBounds,
yAxisBoundsSecondary,
yAxisIndex,
yAxisIndexB,
yAxisTitleSecondary,
@@ -285,10 +286,13 @@ export default function transformProps(
// yAxisBounds need to be parsed to replace incompatible values with undefined
let [min, max] = (yAxisBounds || []).map(parseYAxisBound);
let [minSecondary, maxSecondary] = (yAxisBoundsSecondary || []).map(
parseYAxisBound,
);
const maxLabelFormatter = getOverMaxHiddenFormatter({ max, formatter });
const maxLabelFormatterSecondary = getOverMaxHiddenFormatter({
max,
max: maxSecondary,
formatter: formatterSecondary,
});
@@ -348,6 +352,8 @@ export default function transformProps(
if (contributionMode === 'row' && stack) {
if (min === undefined) min = 0;
if (max === undefined) max = 1;
if (minSecondary === undefined) minSecondary = 0;
if (maxSecondary === undefined) maxSecondary = 1;
}
const tooltipFormatter =
@@ -415,8 +421,8 @@ export default function transformProps(
{
...defaultYAxis,
type: logAxisSecondary ? 'log' : 'value',
min,
max,
min: minSecondary,
max: maxSecondary,
minorTick: { show: true },
splitLine: { show: false },
minorSplitLine: { show: minorSplitLine },