Not able to load data from datasource while using apache echarts

while trying some graph from apache echarts I wanted to take the query data to the charts but I wasn’t able to pass that data
I got the error this

even though my code looks correct enough


const pieData = data.series.map((s) => {
const models =
s.fields.find((f) => f.name === “Model”).values.buffer ||
s.fields.find((f) => f.name === “Model”).values;
const values =
s.fields.find((f) => f.name === “Value”).values.buffer ||
s.fields.find((f) => f.name === “Value”).values;

return values.map((d, i) => {
return { name: models[i], value: d };
});
})[0];


and even I try to find in some videos they told that dataframe json will be a json
but mine is an array

please someone help me out with this

Removed the duplicates
Now can you please help with the answer

For starters before using data.series in your code do the following

console.log(data) and check output in your web browser console tab. What do you see there

this is what i got

yes yes ThankYou So much It worked.
Thank You very much.
Although I have one more question this context.editor.dataset.source thing worked on monaco editor within paenel
but it didn’t gave out anything when I did console.log(context) instead shown error

so is there any way that if some point I want to check what data is being passed through it or what type. so I can just console it.

1 Like

we cant see your whole code remotely so not sure where you have it. This is really more basic javascript than grafana

1 Like