请问如下js为何直接放在chart里不生效 ,但是放在report里的图表里又生效,移动端版本11.0.28: function a(){ let name = this.name; let value = this.value; let matched = name.match(/\((.*)\)/)[1]; name = name.replace(`(${matched})`, ''); let desc = ` ${name}`; matched.split(',').forEach(text => { desc += ` ${text}` }); desc += ` *人口数:${value}`; return " " + desc + " "; } ------------------------------------ function a() { const chart = FR.Chart.WebUtils.getChart("chart0"); // 替换为实际图表ID const name = chart.getSelectedData().name; // 使用图表API获取数据 const value = chart.getSelectedData().value; let matched = name.match(/\((.*)\)/)[1]; name = name.replace(`(${matched})`, ''); let desc = ` ${name}`; matched.split(',').forEach(text => { desc += ` ${text}` }); desc += ` 人口数:${value}`; return " " + desc + " "; } |