<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<!--引入ECharts脚本-->
<script src="./js/echarts.min.js"></script>
</head>
<body>
<!---为ECharts准备一个具备大小(宽高)的DOM-->
<div id="main" style="width: 1000px; height: 800px"></div>
<script type="text/javascript">
//基于准备好的DOM,初始化ECharts图表
var chartDom = document.getElementById('main');
var myChart = echarts.init(chartDom);
var option;
option = {
title: [{
text: '极坐标上级练习',
subtext: '案例代码2-6的极坐标转换'
}],
polar: {
radius: [30, '80%']
},
angleAxis: {
max: 4,
startAngle: 60
},
radiusAxis: {
type: 'category',
data: ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"]
},
tooltip: {},
series: {
type: 'bar',
data: [2, 1.2, 2.4, 3.6],
coordinateSystem: 'polar',
label: {
show: true,
position: 'middle',
formatter: '{羊毛衫}: {雪纺衫}'
}
}
};
//使用刚指定的配置项和数据显示图表
myChart.setOption(option);
</script>
</body>
</html>