'
return abox;
}
},
legend: {
show: true,
icon:'bar',
itemWidth:15,
data: names
},
xAxis: {
data:names
},
grid: {
top:'13%',
left: '3%',
right: '2%',
bottom: '5%',
containLabel: true
},
yAxis:[
{
type: 'value',
scale: true,
name: '价格',
max: 100,
min: 0,
axisLabel: {
formatter: '{value} %'
}
},
{
type: 'value',
scale: true,
name: '预购量',
max: 900,
min: 0,
splitLine:{
show:false
}
}
],
series: [
{
type: 'bar',
markLine : marklines,
barWidth: '10%',
data: values,
yAxisIndex: 1,
itemStyle:{
normal:{
color:'#3398DB'
}
}
}, {
type: 'bar',
barWidth: '10%',
barWidth : 5,
data: values2,
yAxisIndex: 1,
itemStyle:{
normal:{
color:'#62c0d0',
borderType:'dashed'
}
}
},{
type: 'scatter',
name: '硝酸'
}, {
type: 'scatter',
name: '硝酸2'
}, {
type: 'scatter',
name: '硝酸3'
}, {
type: 'scatter',
name: '硝酸4'
}, {
type: 'scatter',
name: '硝酸5'
}, {
type: 'scatter',
name: '硝酸6'
}, {
type: 'scatter',
name: '硝酸7'
}, {
type: 'scatter',
name: '硝酸8'
}, {
type: 'scatter',
name: '硝酸9'
}, {
type: 'scatter',
name: '硝酸10'
}]
};
myChart.on('legendselectchanged', function(params) {
var option = {};
var newNames = [];
var newValues = [];
for(var i = 0; i < names.length ;i ++){
if(params.selected[names[i]] == true){
newNames.push(names[i]);
newValues.push(values[i]);
}
}
myChartbudget.setOption({
xAxis: {
data: newNames
},
yAxis: {},
series: [{
type: 'bar',
data: newValues
}]
})
});
myChart.setOption(option);
};