您好,可以通过设置chart的series实现,参考下列代码:
- var spread = GC.Spread.Sheets.findControl("ss");
- var sheet = spread.getActiveSheet();
- var chart = sheet.charts.get("Chart1");
- var seriesCollection = chart.series();
- var series = chart.series().get();
- console.log(series);
- for(var i=0; i<series.length; i++){
- var tmp = series[i];
- // 设置series名称单元格
- tmp.name = "'Common Chart'!$A$"+(i+2);
- // x轴引用
- tmp.xValues = "'Common Chart'!$C$1:$C$1";
- // y轴引用
- tmp.yValues = "'Common Chart'!$C$"+(i+2)+":$C$"+(i+2);
- // 设置series
- chart.series().set(i, tmp);
- }
- console.log(chart.series().get());
复制代码
以上代码运行示例地址0:
https://demo.grapecity.com.cn/Sp ... mos/basicChart.html |