Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TSVB] Y-axis has number formatting not considering all series formatters in the group #83438

Merged
merged 4 commits into from
Nov 18, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ export class TimeseriesVisualization extends Component {
const yAxis = [];
let mainDomainAdded = false;

const allSeriesHavePercentFormatter = seriesModel.every(
(seriesGroup) => seriesGroup.formatter === 'percent'
alexwizp marked this conversation as resolved.
Show resolved Hide resolved
);

this.showToastNotification = null;

seriesModel.forEach((seriesGroup) => {
Expand Down Expand Up @@ -197,6 +201,10 @@ export class TimeseriesVisualization extends Component {
seriesDataRow.useDefaultGroupDomain = !isCustomDomain;
});

const tickFormatter = allSeriesHavePercentFormatter
? this.yAxisStackedByPercentFormatter
: (val) => val;

if (isCustomDomain) {
TimeseriesVisualization.addYAxis(yAxis, {
domain,
Expand All @@ -211,7 +219,7 @@ export class TimeseriesVisualization extends Component {
});
} else if (!mainDomainAdded) {
TimeseriesVisualization.addYAxis(yAxis, {
tickFormatter: series.length === 1 ? undefined : (val) => val,
tickFormatter: series.length === 1 ? undefined : tickFormatter,
id: yAxisIdGenerator('main'),
groupId: mainAxisGroupId,
position: model.axis_position,
Expand Down