【发布时间】:2019-12-05 10:32:10
【问题描述】:
我正在创建一个饼图,但没有成为我想要的。所以有人可以帮助我。
我想在下面的图像中制作图表。我现在想制作一个饼图作为图像。所以有人可以正确 html css 和 js 代码
<!DOCTYPE html>
<html>
<head>
<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script>
<script src="http://cdn.bootcss.com/easy-pie-chart/2.1.4/jquery.easypiechart.min.js"></script>
</head>
<style>
.epie-chart {
width: 150px;
height: 150px;
position: re;
}
.epie-chart p {
display: inline-block;
position: absolute;
line-height: 24px;
text-align: center;
width: 114px;
font-size: 39px;
color: #ff6500;
}
</style>
<body>
<div class="epie-chart" data-percent="75">
<p>75%</p>
</div>
<div class="epie-chart" data-percent="90">
<p>90%</p>
</div>
<div class="epie-chart" data-percent="69">
<p>69%</p>
</div>
<div class="epie-chart" data-percent="79">
<p>79%</p>
</div>
</body>
<script type="text/javascript">
$(function() {
$('.epie-chart').easyPieChart({
easing: 'easeInOut',
barColor: 'white',
trackColor: 'blue',
scaleColor: false,
scaleLength: 5,
lineCap: 'butt',
lineWidth: 55,
size: 110,
rotate: 360,
animate: {
duration: 1000,
enabled: true
},
onStep: function(from, to, percent) {
$(this.el).find('.percent').text(Math.round(percent) + '%');
}
});
});
</script>
</html>
【问题讨论】:
-
您尝试创建的图表类型称为“甜甜圈”(或甜甜圈)图表。有 很多 库可以非常简单地为您做到这一点。如果您尝试创建自己的学习练习,那么我建议您使用特定问题更新问题,因为现在它读作“为我编写代码”请求。
-
@RoryMcCrossan 如果你知道是一个饼图你可以在这里给代码谢谢你的建议。