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] Different field format on different series is ignored #78138

Merged
merged 7 commits into from
Sep 29, 2020
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,9 @@ export class TimeseriesVisualization extends Component {
const mainAxisGroupId = yAxisIdGenerator('main_group');

const seriesModel = model.series.filter((s) => !s.hidden).map((s) => cloneDeep(s));
const firstSeries = seriesModel.find((s) => s.formatter && !s.separate_axis);

const mainAxisScaleType = TimeseriesVisualization.getAxisScaleType(model);
const mainAxisDomain = TimeseriesVisualization.getYAxisDomain(model);
const tickFormatter = TimeseriesVisualization.getTickFormatter(
firstSeries,
this.props.getConfig
);
const yAxis = [];
let mainDomainAdded = false;

Expand Down Expand Up @@ -203,7 +198,7 @@ export class TimeseriesVisualization extends Component {
series
.filter((r) => startsWith(r.id, seriesGroup.id))
.forEach((seriesDataRow) => {
seriesDataRow.tickFormatter = seriesGroupTickFormatter;
seriesDataRow.tickFormat = seriesGroupTickFormatter;
seriesDataRow.groupId = groupId;
seriesDataRow.yScaleType = yScaleType;
seriesDataRow.hideInLegend = Boolean(seriesGroup.hide_in_legend);
Expand All @@ -224,7 +219,7 @@ export class TimeseriesVisualization extends Component {
});
} else if (!mainDomainAdded) {
TimeseriesVisualization.addYAxis(yAxis, {
tickFormatter,
tickFormatter: series.length === 1 ? undefined : (val) => val,
id: yAxisIdGenerator('main'),
groupId: mainAxisGroupId,
position: model.axis_position,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export function AreaSeriesDecorator({
sortIndex,
y1AccessorFormat,
y0AccessorFormat,
tickFormat,
}) {
const id = seriesId;
const groupId = seriesGroupId;
Expand All @@ -67,6 +68,7 @@ export function AreaSeriesDecorator({
enableHistogramMode,
useDefaultGroupDomain,
sortIndex,
tickFormat,
...areaSeriesStyle,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export function BarSeriesDecorator({
sortIndex,
y1AccessorFormat,
y0AccessorFormat,
tickFormat,
}) {
const id = seriesId;
const groupId = seriesGroupId;
Expand All @@ -66,6 +67,7 @@ export function BarSeriesDecorator({
enableHistogramMode,
useDefaultGroupDomain,
sortIndex,
tickFormat,
...barSeriesStyle,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ export const TimeSeries = ({
useDefaultGroupDomain,
y1AccessorFormat,
y0AccessorFormat,
tickFormat,
},
sortIndex
) => {
Expand Down Expand Up @@ -207,6 +208,7 @@ export const TimeSeries = ({
sortIndex={sortIndex}
y1AccessorFormat={y1AccessorFormat}
y0AccessorFormat={y0AccessorFormat}
tickFormat={tickFormat}
/>
);
}
Expand All @@ -233,6 +235,7 @@ export const TimeSeries = ({
sortIndex={sortIndex}
y1AccessorFormat={y1AccessorFormat}
y0AccessorFormat={y0AccessorFormat}
tickFormat={tickFormat}
/>
);
}
Expand Down