柱状图与极坐标系结合会是什么样的呢?
效果图如下:
polar 极坐标属性配置:
polar: {},
polar内属性值不设置代表polar内的属性使用默认值:如
angleAxis 极坐标系的角度轴配置:
angleAxis: {
max:12,
},
radiusAxis 极坐标系的径向轴配置:
radiusAxis: {
type: 'category',
data: ['周一', '周二', '周三', '周四'],
z: 10
},
series: [{
type: 'bar',
data: [4, 2, 3, 1],
coordinateSystem: 'polar',
name: '早上访问',
stack: 'a'
}, {
type: 'bar',
data: [2, 3, 6, 4],
coordinateSystem: 'polar',
name: '下午访问',
stack: 'a'
}, {
type: 'bar',
data: [3, 2, 1, 4],
coordinateSystem: 'polar',
name: '晚上访问',
stack: 'a'
}],
series-bar. coordinateSystem = ‘cartesian2d‘
完整代码如下:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>ECharts</title>
<!-- 引入 echarts.js -->
<script src="echarts.min.js"></script>
</head>
<body>
<!-- 为ECharts准备一个具备大小(宽高)的Dom -->
<div id="main" style="width: 600px;height:400px;"></div>
<script type="text/javascript">
// 基于准备好的dom,初始化echarts实例
var myChart = echarts.init(document.getElementById('main'));
var option;
option = {
title :{
text:'树懒课堂访问时间分析',
subtext:'单位:千',
},
angleAxis: {
max:12,
},
radiusAxis: {
type: 'category',
data: ['周一', '周二', '周三', '周四'],
z: 10
},
polar: {
},
series: [{
type: 'bar',
data: [4, 2, 3, 1],
coordinateSystem: 'polar',
name: '早上访问',
stack: 'a'
}, {
type: 'bar',
data: [2, 3, 6, 4],
coordinateSystem: 'polar',
name: '下午访问',
stack: 'a'
}, {
type: 'bar',
data: [3, 2, 1, 4],
coordinateSystem: 'polar',
name: '晚上访问',
stack: 'a'
}],
legend: {
show: true,
data: ['早上访问', '下午访问', '晚上访问'],
right:'15%',
}
};
myChart.setOption(option);
</script>
</body>
</html>