ECharts - "Execution Error: data is not defined"

Hello, I´m having this error: “ECharts Execution Error: data is not defined” when using “ECharts Basic Radar Chart” panel with grafana echarts plugin.

It seems that the data object is not being found.

let my_map = data.series.map((s) => {
gender_concept_id = s.fields.find((f) => f.name === ‘gender_concept_id’).values;
year_of_birth = s.fields.find((f) => f.name === ‘year_of_birth’).values;
month_of_birth = s.fields.find((f) => f.name === ‘month_of_birth’).values;
day_of_birth = s.fields.find((f) => f.name === ‘day_of_birth’).values;
race_concept_id = s.fields.find((f) => f.name === ‘race_concept_id’).values;
});

Query inspector:

Table view:

Thank´s. I look forward to your reply.

Álvaro

@amconde In the latest version of ECharts panel we introduced Visual editor, which provides access to the parameters using context object.

It also allows automatically parse the data source and create series in a data set format. We will explain it in the upcoming video and release blog post. You can see examples how to use it on Volkov Labs

Alternatively, you can switch to the native Code mode and it will work as expected.

Working now :slight_smile:

Thank you very much.

1 Like

Could you please share the code that worked for you. I am having trouble modifying my code to meet the new requirements.

I have dashboard using Apache EChart plugin and working fine.
When I upgraded the pluging to Business Charts, in same code I have the ERROR message: ReferenceError: data is not defined

let RAW_it = ,
FIN_it = ,
TOTAL_it = ,
WIP_it = ;
Transit_it = ;
Target_it = ;

const datablock = data.series.map((s) => {
const RAW_it = s.fields.find((f) => f.name === ‘RAW’).values.buffer || s.fields.find((f) => f.name === ‘RAW’).values;
const FIN_it = s.fields.find((f) => f.name === ‘FIN’).values.buffer || s.fields.find((f) => f.name === ‘FIN’).values;
const WIP_it = s.fields.find((f) => f.name === ‘WIP’).values.buffer || s.fields.find((f) => f.name === ‘WIP’).values;
const Transit_it = s.fields.find((f) => f.name === ‘transit’).values.buffer || s.fields.find((f) => f.name === ‘transit’).values;
const Target_it = s.fields.find((f) => f.name === ‘target’).values.buffer || s.fields.find((f) => f.name === ‘target’).values;
const PN = s.fields.find((f) => f.name === ‘d’).values.buffer || s.fields.find((f) => f.name === ‘d’).values;
const P2 = s.fields.find((f) => f.name === ‘d’).values.buffer || s.fields.find((f) => f.name === ‘d’).values;
return PN.map((d, i) => [d, RAW_it[i].toFixed(2), FIN_it[i].toFixed(2), WIP_it[i].toFixed(2), Transit_it[i].toFixed(2), ((RAW_it[i] + FIN_it[i] + WIP_it[i]) * 0), (RAW_it[i] + FIN_it[i] + WIP_it[i] + Transit_it[i]).toFixed(2), Target_it[i].toFixed(2), Target_it[i] - (RAW_it[i] + FIN_it[i] + WIP_it[i] + Transit_it[i])]);

})[0];

someone could support me to findout the issue.
I need same working with the pluging to Business Charts.

I found the solution (“context.panel.”)
ADDED
const datablock = context.panel.data.series.map((s)

INSTEAD OF:
const datablock = data.series.map((s)

thanks!

1 Like

We updated documentation to reflect latest features and breaking changes in the Business Charts:

1 Like