Using data from Transform in scripts

Hello all!

I am trying to make Sankey graph in Grafana, using Plotly panel. In the Script section of Plotly panel I refer to all my queries by using:
let licznik_1 = data.series[0].fields[1].values.buffer
let licznik_2 = data.series[0].fields[2].values.buffer
But I do not know how to refer to data from Transforms, field from calculation to be more specific. Is it possible?

Best regards
Maciej

Hi @radziq8
What comes to my mind is to switch SQL view and perform some math operations there.

Hi, instead of creating transforms in grafana, derive the required data in the Script section of plotly panel

For example, you can derive the multiplication of two series as shown below in the script section of plotly panel

let data1 = data.series[0].fields[1].values.buffer
let data2 = data.series[1].fields[1].values.buffer

let dataDerived = []
for(let i=0;i<data1.length;i++)
{ dataDerived.push(data1[i]*data2[i]); }

let serie = {
    x : data1,
    y : dataDerived,
    name : "abcd" 
}

return {
    data : [serie], config : {displayModeBar: false}
}