function BarChart(elementId){
//初始化echarts实例
var myChart = echarts.init(document.getElementById(elementId));
// 指定图表的配置项和数据
var option = {
title: {
text: ''
},
tooltip: {
axisPointer : { // 坐标轴指示器,坐标轴触发有效
type : 'shadow' // 默认为直线,可选为:'line' | 'shadow'
}
},
legend: {
data:['成绩']
},
xAxis: {
data: ["英语","数学","语文","物理","化学"],
//interval :10
},
yAxis: {
type : 'value',
name:'成绩',
min: 0,
max: 100,
},
series: [{
name: '成绩',
type: 'line',
color: 'blue',
data: [90, 80, 95, 85, 90]
}]
}
myChart.clear();
myChart.setOption(option,true);
}
BarChart("domId")
/*
series: [ //统一设置圈圈与线的颜色
{
name:'销售量',
type:'line',
stack: '销售量',
itemStyle : {
normal : {
color:'#00FF00', //圈圈的颜色
lineStyle:{
color:'#00FF00' //线的颜色
}
}
},
data:[220, 132, 601, 314, 890, 230, 510]
}
]
*/
