后台数据转化为echarts的二维数组
Posted qtx-
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了后台数据转化为echarts的二维数组相关的知识,希望对你有一定的参考价值。
{ let originData={ "code": "000000", "message": "成功", "data": { "list": { "白宇飞区": [ { "companyCode": "0679", "companyName": "重庆分", "purPrice": 110.25, "regionName": "白宇飞区", "regionCode": "R004" }, { "companyCode": "0678", "companyName": "四川分", "purPrice": 100, "regionName": "白宇飞区", "regionCode": "R004" }, { "companyCode": "0680", "companyName": "贵州分", "purPrice": 125.25, "regionName": "白宇飞区", "regionCode": "R004" }, { "companyCode": "0676", "companyName": "云南分", "purPrice": 140.25, "regionName": "白宇飞区", "regionCode": "R004" } ], "于建平区": [ { "companyCode": "0136", "companyName": "北京分", "purPrice": 120.55, "regionName": "于建平区", "regionCode": "R001" }, { "companyCode": "0162", "companyName": "天津分", "purPrice": 110.25, "regionName": "于建平区", "regionCode": "R001" }, { "companyCode": "0164", "companyName": "石家庄分", "purPrice": 110.25, "regionName": "于建平区", "regionCode": "R001" }, { "companyCode": "0338", "companyName": "山西分", "purPrice": 78.5, "regionName": "于建平区", "regionCode": "R001" }, { "companyCode": "0267", "companyName": "辽宁分", "purPrice": 135.25, "regionName": "于建平区", "regionCode": "R001" }, { "companyCode": "0266", "companyName": "吉林分", "purPrice": 85.25, "regionName": "于建平区", "regionCode": "R001" }, { "companyCode": "0265", "companyName": "黑龙江分", "purPrice": 90.25, "regionName": "于建平区", "regionCode": "R001" }, { "companyCode": "0730", "companyName": "第二分", "purPrice": 110.25, "regionName": "于建平区", "regionCode": "R001" }, { "companyCode": "0731", "companyName": "南京分", "purPrice": 65.25, "regionName": "于建平区", "regionCode": "R001" }, { "companyCode": "0741", "companyName": "浙江分", "purPrice": 150.25, "regionName": "于建平区", "regionCode": "R001" }, { "companyCode": "0470", "companyName": "山东分", "purPrice": 178.55, "regionName": "于建平区", "regionCode": "R001" }, { "companyCode": "0852", "companyName": "广州分", "purPrice": 95.25, "regionName": "于建平区", "regionCode": "R001" } ], "周永顺区": [ { "companyCode": "0851", "companyName": "江西分", "purPrice": 70, "regionName": "周永顺区", "regionCode": "R003" }, { "companyCode": "0574", "companyName": "湖北分", "purPrice": 95.25, "regionName": "周永顺区", "regionCode": "R003" }, { "companyCode": "0575", "companyName": "湖南分", "purPrice": 142.25, "regionName": "周永顺区", "regionCode": "R003" }, { "companyCode": "0677", "companyName": "南宁分", "purPrice": 88.25, "regionName": "周永顺区", "regionCode": "R003" } ], "白善霖区": [ { "companyCode": "0327", "companyName": "内蒙古分", "purPrice": 99.25, "regionName": "白善霖区", "regionCode": "R005" }, { "companyCode": "0328", "companyName": "陕西分", "purPrice": 100, "regionName": "白善霖区", "regionCode": "R005" }, { "companyCode": "0325", "companyName": "甘肃分", "purPrice": 120.25, "regionName": "白善霖区", "regionCode": "R005" }, { "companyCode": "0326", "companyName": "新疆分", "purPrice": 88.25, "regionName": "白善霖区", "regionCode": "R005" } ], "霍尔峰区": [ { "companyCode": "0471", "companyName": "安徽分", "purPrice": 135.25, "regionName": "霍尔峰区", "regionCode": "R002" }, { "companyCode": "0849", "companyName": "福建分", "purPrice": 120.25, "regionName": "霍尔峰区", "regionCode": "R002" }, { "companyCode": "0573", "companyName": "河南分", "purPrice": 80.25, "regionName": "霍尔峰区", "regionCode": "R002" }, { "companyCode": "0850", "companyName": "海南分", "purPrice": 100, "regionName": "霍尔峰区", "regionCode": "R002" } ] }, "purPrice": 100 } }; }
以上是关于后台数据转化为echarts的二维数组的主要内容,如果未能解决你的问题,请参考以下文章
echarts中key-value形式的dataset source值转换为二维数组形式的dataset source值