TimeSeries: Use original frames for creating data links (#91598)

pull/91604/head
Leon Sorokin 10 months ago committed by GitHub
parent d93f5bab83
commit 1b6362a807
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 45
      public/app/core/components/GraphNG/GraphNG.tsx

@ -132,25 +132,36 @@ export class GraphNG extends Component<GraphNGProps, GraphNGState> {
if (withLinks) {
const timeZone = Array.isArray(this.props.timeZone) ? this.props.timeZone[0] : this.props.timeZone;
alignedFrame.fields.forEach((field) => {
field.getLinks = getLinksSupplier(
alignedFrame,
field,
{
...field.state?.scopedVars,
__dataContext: {
value: {
data: [alignedFrame],
field: field,
frame: alignedFrame,
frameIndex: 0,
// for links gen we need to use original frames but with the aligned/joined data values
let linkFrames = frames.map((frame, frameIdx) => ({
...frame,
fields: alignedFrame.fields.filter(
(field, fieldIdx) => fieldIdx === 0 || field.state?.origin?.frameIndex === frameIdx
),
length: alignedFrame.length,
}));
linkFrames.forEach((linkFrame, frameIndex) => {
linkFrame.fields.forEach((field) => {
field.getLinks = getLinksSupplier(
linkFrame,
field,
{
...field.state?.scopedVars,
__dataContext: {
value: {
data: linkFrames,
field: field,
frame: linkFrame,
frameIndex,
},
},
},
},
replaceVariables,
timeZone,
dataLinkPostProcessor
);
replaceVariables,
timeZone,
dataLinkPostProcessor
);
});
});
// filter join field and fields.y

Loading…
Cancel
Save