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

[v10.0.x] XYChart/Trend: Fix min/max and units/decimals X field overrides #70261

Merged
merged 1 commit into from Jun 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/grafana-ui/src/components/TimeSeries/utils.ts
Expand Up @@ -181,6 +181,7 @@ export const preparePlotConfigBuilder: UPlotConfigPrepFn<{
scaleKey: xScaleKey,
orientation: ScaleOrientation.Horizontal,
direction: ScaleDirection.Right,
range: (u, dataMin, dataMax) => [xField.config.min ?? dataMin, xField.config.max ?? dataMax],
});

builder.addAxis({
Expand All @@ -190,6 +191,7 @@ export const preparePlotConfigBuilder: UPlotConfigPrepFn<{
label: xField.config.custom?.axisLabel,
theme,
grid: { show: xField.config.custom?.axisGridShow },
formatValue: (v, decimals) => formattedValueToString(xField.display!(v, decimals)),
});
}

Expand Down
4 changes: 1 addition & 3 deletions public/app/plugins/panel/trend/TrendPanel.tsx
Expand Up @@ -92,9 +92,7 @@ export const TrendPanel = ({
options={options}
>
{(config, alignedDataFrame) => {
if (
alignedDataFrame.fields.filter((f) => f.config.links !== undefined && f.config.links.length > 0).length > 0
) {
if (alignedDataFrame.fields.some((f) => Boolean(f.config.links?.length))) {
alignedDataFrame = regenerateLinksSupplier(alignedDataFrame, info.frames!, replaceVariables, timeZone);
}

Expand Down
3 changes: 1 addition & 2 deletions public/app/plugins/panel/xychart/scatter.ts
Expand Up @@ -604,8 +604,7 @@ const prepConfig = (
isTime: false,
orientation: ScaleOrientation.Horizontal,
direction: ScaleDirection.Right,
min: xField.config.min,
max: xField.config.max,
range: (u, dataMin, dataMax) => [xField.config.min ?? dataMin, xField.config.max ?? dataMax],
});

// why does this fall back to '' instead of null or undef?
Expand Down