Echarts 给pie圆饼图series.data 赋值

1. 如何去掉字符串最外层的双引号,使其变成数组.

var data = ("{id:32,wd:'20.3',jd:'113.3'};{id:321,wd:'20.3',jd:'113.3'}");

var yy = [];
    var mm = [];
    yy = data.split(";");
    for (var i = 0; i < yy.length; i++) {
        eval("var c=" + yy[i]);
        mm.push(c);
}

处理完成的数据:{value:335, name:13},{value:335, name:15}样式 

// option.legend.data = [13,15];
// option.series[0].data=[{value:335, name:13},{value:335, name:15}];

你可能感兴趣的:(Echarts)