export function toEchartsData(list, option) { option.legend['data'] = []; option.yAxis.length = list.length; option.yAxis.series = list.length; list.forEach((item: any, index) => { option.legend['data'].push(`${item['legend']}(${item['unit']})`); const yAxiObj = { type: 'value', position: item['yaxispos'], axisLabel: { formatter: `{value} ${item['unit']}` }, }; const serieObj = { name: `${item['legend']}(${item['unit']})`, type: item['linetype'], yAxisIndex: item['sort'], }; if (!option.yAxis[index]) { option.yAxis[index] = yAxiObj; } else { Object.assign(option.yAxis[index], yAxiObj); } if (!option.series[index]) { option.series[index] = serieObj; } else { Object.assign(option.series[index], serieObj); } }); return option; }