Toggle navigation
在线编辑器
在线代码
文本比较
jQuery下载
前端库
在线手册
登录/注册
下载代码
html
css
js
分享到微信朋友圈
X
html
Progress Status
css
body { background-color: #1B1F2A; width: 100%; font-family: 'Roboto', sans-serif; height: 100%; } .widget { margin: 0 auto; width:350px; margin-top:50px; background-color: #222D3A; border-radius: 5px; box-shadow: 0px 0px 1px 0px #06060d; } .header{ background-color: #29384D; height:40px; color:#929DAF; text-align: center; line-height: 40px; border-top-left-radius: 7px; border-top-right-radius: 7px; font-weight: 400; font-size: 1.5em; text-shadow: 1px 1px #06060d; } .chart-container{ padding:25px; } .shadow { -webkit-filter: drop-shadow( 0px 3px 3px rgba(0,0,0,.1) ); filter: drop-shadow( 0px 3px 3px rgba(0,0,0,.1) ); }
JavaScript
var percent = 55; var pie = d3.layout.pie() .value(function(d) { return d }) .sort(null); var w = 300, h = 320; var outerRadius = (w / 2) - 10; var innerRadius = outerRadius - 8; var color = ['#ec1561', '#2a3a46', '#202b33']; var arc = d3.svg.arc() .innerRadius(innerRadius) .outerRadius(outerRadius) .startAngle(0) .endAngle(2 * Math.PI); //The circle is following this var arcDummy = d3.svg.arc() .innerRadius((outerRadius - innerRadius) / 2 + innerRadius) .outerRadius((outerRadius - innerRadius) / 2 + innerRadius) .startAngle(0); var arcLine = d3.svg.arc() .innerRadius(innerRadius) .outerRadius(outerRadius) .startAngle(0); var svg = d3.select("#chart") .append("svg") .attr({ width: w, height: h, class: 'shadow' }).append('g') .attr({ transform: 'translate(' + w / 2 + ',' + h / 2 + ')' }); //background var path = svg.append('path') .attr({ d: arc }) .style({ fill: color[1] }); var pathForeground = svg.append('path') .datum({ endAngle: 0 }) .attr({ d: arcLine }) .style({ fill: color[0] }); //Dummy Arc for Circle var pathDummy = svg.append('path') .datum({ endAngle: 0 }) .attr({ d: arcDummy }).style({ fill: color[0] }); var endCircle = svg.append('circle') .attr({ r: 12, transform: 'translate(0,' + (-outerRadius + 15) + ')' }) .style({ stroke: color[0], 'stroke-width': 8, fill: color[2] }); var middleTextCount = svg.append('text') .datum(0) .text(function(d) { return d + '%'; }) .attr({ class: 'middleText', 'text-anchor': 'middle', dy: 25, dx: 0 }) .style({ fill: '#ec1561', 'font-size': '80px' }); var arcTweenOld = function(transition, percent, oldValue) { transition.attrTween("d", function(d) { var newAngle = (percent / 100) * (2 * Math.PI); var interpolate = d3.interpolate(d.endAngle, newAngle); var interpolateCount = d3.interpolate(oldValue, percent); return function(t) { d.endAngle = interpolate(t); var pathForegroundCircle = arcLine(d); middleTextCount.text(Math.floor(interpolateCount(t)) + '%'); var pathDummyCircle = arcDummy(d); var coordinate = pathDummyCircle.split("L")[1].split("A")[0]; endCircle.attr('transform', 'translate(' + coordinate + ')'); return pathForegroundCircle; }; }); }; var oldValue = 0; var animate = function() { pathForeground.transition() .duration(750) .ease('cubic') .call(arcTweenOld, percent, oldValue); oldValue = percent; percent = (Math.random() * 60) + 20; setTimeout(animate, 3000); }; setTimeout(animate, 0);
粒子
时间
文字
hover
canvas
3d
游戏
音乐
火焰
水波
轮播图
鼠标跟随
动画
css
加载动画
导航
菜单
按钮
滑块
tab
弹出层
统计图
svg
×
Close
在线代码下载提示
开通在线代码永久免费下载,需支付20jQ币
开通后,在线代码模块中所有代码可终身免费下!
您已开通在线代码永久免费下载,关闭提示框后,点下载代码可直接下载!
您已经开通过在线代码永久免费下载
对不起,您的jQ币不足!可通过发布资源 或
直接充值获取jQ币
取消
开通下载
<!doctype html> <html> <head> <meta charset="utf-8"> <title>d3.js进度表-jq22.com</title> <script src="https://www.jq22.com/jquery/jquery-1.10.2.js"></script> <style>
</style> </head> <body>
<script>
</script>
</body> </html>
2012-2021 jQuery插件库版权所有
jquery插件
|
jq22工具库
|
网页技术
|
广告合作
|
在线反馈
|
版权声明
沪ICP备13043785号-1
浙公网安备 33041102000314号