这个initChart是在page外的,在page内查询到的结果要怎么赋值给initChart的source呢?
function initChart(canvas, width, height) {
const chart = echarts.init(canvas, null, {
width: width,
height: height
});
canvas.setChart(chart);
var option = {
legend: {},
tooltip: {},
dataset: {
source: [
['轮印', '2015', '2016', '2017'],
['平印', 43.3, 85.8, 93.7],
['骑马', 83.1, 73.4, 55.1],
['胶装', 86.4, 65.2, 82.5],
['折页', 72.4, 53.9, 39.1],
['打包', 72.4, 53.9, 39.1],
['没了', 72.4, 53.9, 39.1]
]
},
xAxis: {
type: 'category'
},
yAxis: {},
// Declare several bar series, each will be mapped
// to a column of dataset.source by default.
series: [{
type: 'bar'
}, {
type: 'bar'
}, {
type: 'bar'
}]
};
console.log(option.dataset.source)
chart.setOption(option);
return chart;
}