vue.js与echarts,求个大神帮忙 啊,

怎么取出data里面的值。求助

data里面的值是这样的。

 ringData: [
                     "2015-01": [{name:'民政业务',value:10},{name:'总数据',value:10}],   
                     "2015-02": [{name:'民政业务',value:26},{name:'总数据',value:33}],
                     "2015-03": [{name:'民政业务',value:18},{name:'总数据',value:33}],
                     "2015-04": [{name:'计生业务',value:8},{name:'总数据',value:22}],
                     "2015-05": [{name:'民政业务',value:496},{name:'总数据',value:777}],
                     "2015-06": [{name:'林业业务',value:171},{name:'总数据',value:380}],
                     "2015-07": [{name:'党务业务',value:74},{name:'总数据',value:257}],
                     "2015-08": [{name:'民政业务',value:70},{name:'总数据',value:188}],
                     "2015-09": [{name:'卫计业务',value:217},{name:'总数据',value:581}],
                     "2015-10": [{name:'林业业务',value:78},{name:'总数据',value:215}],
                     "2015-11": [{name:'林业业务',value:124},{name:'总数据',value:290}],
                     "2015-12": [{name:'民政业务',value:46},{name:'总数据',value:126}],
                     "2016-01": [{name:'民政业务',value:56},{name:'总数据',value:113}],
                     "2016-02": [{name:'民政业务',value:115},{name:'总数据',value:178}],
                     "2016-03": [{name:'民政业务',value:991},{name:'总数据',value:1158}],
                     "2016-04": [{name:'民政业务',value:957},{name:'总数据',value:1074}],
                     "2016-05": [{name:'民政业务',value:691},{name:'总数据',value:1089}],
                     "2016-06": [{name:'民政业务',value:429},{name:'总数据',value:857}],

我要画一个环图
options里面data哪里怎么取值

 var option = {
            baseOption: {
                timeline: {
                    data: [
                        '2015-01','2015-02','2015-03','2015-04','2015-05','2015-06','2015-07',
                        '2015-08','2015-09','2015-10','2015-11','2015-12','2016-01','2016-02',
                        '2016-03','2016-04','2016-05','2016-06','2016-07','2016-08','2016-09',
                        '2016-10','2016-11','2016-12','2017-01','2017-02','2017-03','2017-04'
                    ]
                },
                title: {
                    text: '元江县为民办事分类'
                },
                series: [
                    {
                        name:'',
                        type:'pie',
                        radius:['50%','70%'],
                        center:['25%','25%']
                    }
                    {
                        name:'',
                        type:'pie',
                        radius:'28%',
                        center: ['75%','75%']
                    }
                ]
            },
            options: [
                {
                    series:[
                        {data:yuanjiang.ringData('2015-01')}
                        {data: yuanjiang.pieData('2015-01')}
                    ]
                }
            ]
        }

3个回答

点属性啊,然后取data,var一个接收,放入对应的echarts需要的

option.baseOption.timeline.data

我会把ringData格式稍改一下

 var ringData = {
                     "2015-01": [{name:'民政业务',value:10},{name:'总数据',value:10}],   
                     "2015-02": [{name:'民政业务',value:26},{name:'总数据',value:33}],
                     "2015-03": [{name:'民政业务',value:18},{name:'总数据',value:33}],
                     "2015-04": [{name:'计生业务',value:8},{name:'总数据',value:22}],
                     "2015-05": [{name:'民政业务',value:496},{name:'总数据',value:777}],
                     "2015-06": [{name:'林业业务',value:171},{name:'总数据',value:380}],
                     "2015-07": [{name:'党务业务',value:74},{name:'总数据',value:257}],
                     "2015-08": [{name:'民政业务',value:70},{name:'总数据',value:188}],
                     "2015-09": [{name:'卫计业务',value:217},{name:'总数据',value:581}],
                     "2015-10": [{name:'林业业务',value:78},{name:'总数据',value:215}],
                     "2015-11": [{name:'林业业务',value:124},{name:'总数据',value:290}],
                     "2015-12": [{name:'民政业务',value:46},{name:'总数据',value:126}],
                     "2016-01": [{name:'民政业务',value:56},{name:'总数据',value:113}],
                     "2016-02": [{name:'民政业务',value:115},{name:'总数据',value:178}],
                     "2016-03": [{name:'民政业务',value:991},{name:'总数据',value:1158}],
                     "2016-04": [{name:'民政业务',value:957},{name:'总数据',value:1074}],
                     "2016-05": [{name:'民政业务',value:691},{name:'总数据',value:1089}],
                     "2016-06": [{name:'民政业务',value:429},{name:'总数据',value:857}],
};
var dateArray = [],dataArrayA = [],dataArrayB = [];
var length = 0;
for (var x in ringData){
    //日期数组
    dateArray[length] = x;
    //data第一组
    dataArrayA[length] = {"name":ringData[x][0].name,"value":ringData[x][0].value};
    //data第二组
    dataArrayB[length] = {"name":ringData[x][1].name,"value":ringData[x][1].value};
    length ++;
}
github_37125043
CN-cheng 回复qq_38780989: 有帮助就好
2 年多之前 回复
qq_38780989
qq_38780989 回复UIOT: 谢谢
2 年多之前 回复
github_37125043
CN-cheng 然后可以看下几个值 console.info(dateArray);console.info(dataArrayA);console.info(dataArrayB);
2 年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!