how use the Generic JavaScript View node to show the echarts

I want to use the Generic JavaScript View node to show the echarts, for example, I paste the following code into the JavaScript View node, then I execute the node, error happened. can you give me some support? thank you.

const echarts = require(‘echarts’);
require(‘echarts/extension/dataTool’);
require(‘echarts/extension/bmap/bmap’);

// Create a new instance of ECharts
const myChart = echarts.init(domNode);

// Create the chart options
const options = {
title: {
text: ‘Sample Bar Chart’
},
tooltip: {},
legend: {
data: [‘Sales’]
},
xAxis: {
data: [‘Product A’, ‘Product B’, ‘Product C’, ‘Product D’, ‘Product E’]
},
yAxis: {},
series: [{
name: ‘Sales’,
type: ‘bar’,
data: [120, 200, 150, 80, 70]
}]
};

// Set the chart options and render the chart
myChart.setOption(options);

Hello @laofang ,
Could you please share the workflow with the dummy data and the log file with us so we can better understand the problem?

Thanks,
Sanket

1 Like