html+js+highcharts绘制圆饼图表的简单实例
2019/6/27 22:13:28
本文主要是介绍html+js+highcharts绘制圆饼图表的简单实例,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
实例如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>html+js+highcharts绘制圆饼图表的简单实例</title> <script type="text/javascript" src="jquery-1.4.2.min.js" ></script> <script type="text/javascript" src="highcharts.js" ></script> </head> <body> <div id="content"> <br><br><br> <!--DEMO start--> <div id="pie_chart" class="chart_combo"></div> <script type="text/javascript"> var chart; $(function () { var totalMoney=999 <span style="white-space:pre"> </span>var zccw=178 <span style="white-space:pre"> </span>var sycw=821 $(document).ready(function() { chart = new Highcharts.Chart({ chart: { renderTo: 'pie_chart', plotBackgroundColor: 'white',//背景颜色 plotBorderWidth: 0, plotShadow: false }, title: { text: '总车位:'+totalMoney +' 剩余车位:'+ sycw , verticalAlign:'bottom', y:-60 }, tooltip: {//鼠标移动到每个饼图显示的内容 pointFormat: '{point.name}: <b>{point.percentage}%</b>', percentageDecimals: 1, formatter: function() { return this.point.name+':'+totalMoney*this.point.percentage/100; } }, plotOptions: { pie: { size:'60%', borderWidth: 0, allowPointSelect: true, cursor: 'pointer', dataLabels: { enabled: true, color: '#000', distance: -50,//通过设置这个属性,将每个小饼图的显示名称和每个饼图重叠 style: { fontSize: '10px', lineHeight: '10px' }, formatter: function(index) { return '<span style="color:#00008B;font-weight:bold">' + this.point.name + '</span>'; } }, padding:20 } }, series: [{//设置每小个饼图的颜色、名称、百分比 type: 'pie', name: null, data: [ {name:'在场车辆',color:'#3DA9FF',y:zccw}, {name:'剩余车位',color:'#008FE0',y:sycw}, ] }] }); }); }); </script> </div> </body> </html>
以上这篇html+js+highcharts绘制圆饼图表的简单实例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持找一找教程网。
这篇关于html+js+highcharts绘制圆饼图表的简单实例的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-05-30React Native常用组件-点击组件
- 2024-05-30uniapp+vue3+uv-ui手机端后台OA管理模板
- 2024-05-29Python网络爬虫的时候json=就是让你少写个json.dumps()
- 2024-05-27React Native常用组件-展示组件
- 2024-05-27React Native常用组件-列表组件
- 2024-05-09vue3开发前端表单缓存自定义指令,移动端h5必备插件
- 2024-05-09React Hooks在class组件中的使用方式
- 2024-03-30[OIDC in Action] 2. 基于OIDC(OpenID Connect)的SSO(纯JS客户端)
- 2024-03-29terraform jsonencode
- 2024-03-13vuex-persist