把字符串转成json对象后怎么取里面的值呀
后台获取的字符串{"result":{"errorField":"","rowIndex":-1,"resultObj":{"data":["@QMSpecialSerializer#List#ISDO#@",["actualvalue","day"],["0.14","2018-04-16 00:00:00"],["0.14","2018-04-16 00:00:00"],["0.14","2018-04-16 00:00:00"]],"targetvalue":"0.22"}},"exMessage":"","resultState":0,"upTime":32338411,"downTime":32338421,"serviceDistribute":"Y"}
把字符串转成json再动态传入图标里面
图表的代码
var worldMapContainer = document.getElementById('chart');
var resizeWorldMapContainer = function() {
worldMapContainer.style.width = window.innerWidth + 'px';
};
//设置容器高宽
resizeWorldMapContainer();
// 基于准备好的dom,初始化echarts实例
var myChart = echarts.init(document.getElementById('chart'));
// 指定图表的配置项和数据
option = {
title: {
text: '整车产品评审',
x: 'left',
y: '20px'
},
tooltip: {
trigger: 'axis'
},
legend: {
data: ['目标3.0级', '实际值'],
x: 'center',
y: '60px'
},
grid: {
top: '100px',
containLabel: true
},
xAxis: {
type: 'category',
boundaryGap: false,
data: ['12月11日', '12月12日', '12月13日', '12月14日', '12月15日']
},
yAxis: {
type: 'value'
},
series: [{
name: '目标3.0级',
type: 'line',
data: [2.5, 2.5, 2.5, 2.5, 2.5]
},
{
name: '实际值',
type: 'line',
data: [3.7, 3.5, 3.4, 3.8, 3.3]
}
]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);