折线图与柱状图多Y轴
调试运行
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>图形展示</title>
</head>
<body>
<div class="detail-section">
<div id="canvas">
</div>
</div>
<script src="http://g.tbcdn.cn/bui/acharts/1.0.32/acharts-min.js"></script>
<!-- https://g.alicdn.com/bui/acharts/1.0.29/acharts-min.js -->
<script type="text/javascript">
var chart = new AChart({
theme : AChart.Theme.SmoothBase,
id : 'canvas',
width : 950,
height : 500,
plotCfg : {
margin : [50,50,80] //画板的边距
},
xAxis : {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
yAxis : [{
position : 'left',
},{
type : 'number',
position : 'right',
line : null,
tickLine : null,
labels : {
label : {
x : 12
}
},
title : {
text : '右边',
x : 40,
rotate : 90
}
}],
seriesOptions : { //设置多个序列共同的属性
lineCfg : { //不同类型的图对应不同的共用属性,lineCfg,areaCfg,columnCfg等,type + Cfg 标示
smooth : true
}
},
series : [{
name: 'Rainfall',
color: '#4572A7',
type: 'column',
yAxis: 1,
data: [49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
suffix: ' mm'
}, {
name: 'Temperature',
color: '#89A54E',
type: 'line',
data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6],
suffix: '°C'
}]
});
chart.render();
</script>
</body>
</html>