console
var myChart = echarts.init(document.getElementById('main'));
var option = {
// title : {
// text: '某楼盘销售情况',
// subtext: '纯属虚构'
// },
tooltip : {
trigger: 'axis'
},
legend: {
icon: 'rect',
// width:10,
// height:10,
itemWidth: 20,
itemHeight: 10,
itemGap: 10,
//top:'5%', //改变上面标题的高度
data:['零售额','同比零售额','环比零售额']
},
toolbox: {
show : true,
feature : {
mark : {show: true},
dataView : {show: true, readOnly: false},
magicType : {show: true, type: ['line', 'bar', 'stack', 'tiled']},
restore : {show: true},
saveAsImage : {show: true}
}
},
calculable : true,
xAxis : [
{
type : 'category',
boundaryGap : false,
data : ['1月','2月','3月','4月','5月','6月']
}
],
yAxis : [
{
type : 'value'
}
],
dataZoom: {
type: 'slider',
show: true, //flase直接隐藏图形
xAxisIndex: [0],
left: '9%', //滚动条靠左侧的百分比
bottom: -5,
start: 0,//滚动条的起始位置
end: 50 //滚动条的截止位置(按比例分割你的柱状图x轴长度)
},
series : [
{
name:'零售额',
type:'line',
showSymbol: true,
symbol:'emptyCircle', //设定为实心点
symbolSize: 20, //设定实心点的大小
animation: false,
itemStyle: { //圆圈样式
borderWidth: 2,
color:'#f60',
},
lineStyle:{//线条样式
width:5,
color:'#f60'
},
data:[10, 12, 21, 54, 260, 830, 710]
},
{
name:'同比零售额',
type:'line',
showSymbol: true,
symbol:'emptyCircle', //设定为实心点
symbolSize: 20, //设定实心点的大小
animation: false,
itemStyle: { //圆圈样式
borderWidth: 2,
color:'#1e93ec',
},
lineStyle:{//线条样式
width:5,
color:'#1e93ec'
},
data:[30, 182, 434, 791, 390, 30, 10]
},
{
name:'环比零售额',
type: 'line',
showSymbol: true,
symbol:'emptyCircle', //设定为实心点
symbolSize: 20, //设定实心点的大小
// borderColor : '#f60',
// borderWidth : '#f60',
// hoverAnimation: false,
animation: false,
itemStyle: { //圆圈样式
borderWidth: 2,
color:'#8fc31f',
},
lineStyle:{//线条样式
width:5,
color:'#8fc31f'
},
// label:{
// normal:{
// show:true,
// position:[0,-20],
// textStyle:{
// color:"#1daffa"
// }
// }
// },
data:[1320, 1132, 601, 234, 120, 90, 20]
}
]
};
// 为echarts对象加载数据
myChart.setOption(option);
<script src="https://cdn.bootcss.com/echarts/4.1.0.rc2/echarts.js"></script>
<div id="main" style="height:400px"></div>