38Echarts - 柱状图(极坐标系下的堆叠柱状图)

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_20042935/article/details/89711016

效果图

在这里插入图片描述

源代码

<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>ECharts</title>
		<!-- 引入 echarts.js -->
		<script src="js/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 = {
				angleAxis: {
					type: 'category',
					data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
					z: 10
				},
				radiusAxis: {},
				polar: {},
				series: [{
					type: 'bar',
					data: [1, 2, 3, 4, 3, 5, 1],
					coordinateSystem: 'polar',
					name: 'A',
					stack: 'a'
				}, {
					type: 'bar',
					data: [2, 4, 6, 1, 3, 2, 1],
					coordinateSystem: 'polar',
					name: 'B',
					stack: 'a'
				}, {
					type: 'bar',
					data: [1, 2, 3, 4, 1, 2, 5],
					coordinateSystem: 'polar',
					name: 'C',
					stack: 'a'
				}],
				legend: {
					show: true,
					data: ['A', 'B', 'C']
				}
			};

			myChart.setOption(option);
		</script>
	</body>

</html>

猜你喜欢

转载自blog.csdn.net/qq_20042935/article/details/89711016