echarts基础雷达图实例
1,新建静态页面demo.html,并引入echarts的js库,在这里我们引入的是网络地址
<!-- V型知识库 www.vxzsk.com 原创--> <script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts/echarts-all-3.js"></script>
2,雷达图容器html代码,只需一行html代码
<div id="container" style="height: 500px"></div>
雷达图容器高度为500px,宽度默认,并且div的id号为container。
3,javascript实现代码
<script type="text/javascript"> var dom = document.getElementById("container"); var myChart = echarts.init(dom); var app = {}; app.title = 'v型知识库原创-www.vxzsk.com'; option = { title: { text: '基础雷达图' }, tooltip: {}, legend: { data: ['预算分配(Allocated Budget)', '实际开销(Actual Spending)'] }, radar: { // shape: 'circle', indicator: [ { name: '销售(sales)', max: 6500}, { name: '管理(Administration)', max: 16000}, { name: '信息技术(Information Techology)', max: 30000}, { name: '客服(Customer Support)', max: 38000}, { name: '研发(Development)', max: 52000}, { name: '市场(Marketing)', max: 25000} ] }, series: [{ name: '预算 vs 开销(Budget vs spending)', type: 'radar', // areaStyle: {normal: {}}, data : [ { value : [4300, 10000, 28000, 35000, 50000, 19000], name : '预算分配(Allocated Budget)' }, { value : [5000, 14000, 28000, 31000, 42000, 21000], name : '实际开销(Actual Spending)' } ] }] }; if (option && typeof option === "object") { myChart.setOption(option, true); } </script>
4,用浏览器打开demo.html,效果如下
如上图所示,雷达图已经显示出来了,基础雷达图比较实用。具体用到哪种雷达图,要看自身业务需求。
5,基础雷达图demo.html完整代码
<!DOCTYPE html> <head> <meta charset="utf-8"> </head> <body > <div id="container" style="height: 500px"></div> <!-- V型知识库 www.vxzsk.com --> <script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts/echarts-all-3.js"></script> <script type="text/javascript"> var dom = document.getElementById("container"); var myChart = echarts.init(dom); var app = {}; app.title = 'v型知识库原创-www.vxzsk.com'; option = { title: { text: '基础雷达图' }, tooltip: {}, legend: { data: ['预算分配(Allocated Budget)', '实际开销(Actual Spending)'] }, radar: { // shape: 'circle', indicator: [ { name: '销售(sales)', max: 6500}, { name: '管理(Administration)', max: 16000}, { name: '信息技术(Information Techology)', max: 30000}, { name: '客服(Customer Support)', max: 38000}, { name: '研发(Development)', max: 52000}, { name: '市场(Marketing)', max: 25000} ] }, series: [{ name: '预算 vs 开销(Budget vs spending)', type: 'radar', // areaStyle: {normal: {}}, data : [ { value : [4300, 10000, 28000, 35000, 50000, 19000], name : '预算分配(Allocated Budget)' }, { value : [5000, 14000, 28000, 31000, 42000, 21000], name : '实际开销(Actual Spending)' } ] }] }; if (option && typeof option === "object") { myChart.setOption(option, true); } </script> </body> </html>
此文章本站原创,地址 https://www.vxzsk.com/1184.html
转载请注明出处!谢谢!
感觉本站内容不错,读后有收获?小额赞助,鼓励网站分享出更好的教程
上一篇:weui input
下一篇:echarts k线图(上证指数)
^