简体   繁体   English

progressbar.js -> 更改我的进度条轨迹的颜色

[英]progressbar.js -> Change the color of the trail of my progress bar

I got a progress bar like this one jsfiddle and I would like to change the color of the trail which is by default white.我有一个像jsfiddle这样的进度条,我想更改路径的颜色,默认情况下为白色。

 // progressbar.js@1.0.0 version is used var bar = new ProgressBar.Circle(container, { color: '#aaa', // This has to be the same size as the maximum width to // prevent clipping strokeWidth: 4, trailWidth: 1, easing: 'easeInOut', duration: 1400, text: { autoStyleContainer: false }, from: { color: '#aaa', width: 1 }, to: { color: '#333', width: 4 }, // Set default step function for all animate calls step: function(state, circle) { circle.path.setAttribute('stroke', state.color); circle.path.setAttribute('stroke-width', state.width); var value = Math.round(circle.value() * 100); if (value === 0) { circle.setText(''); } else { circle.setText(value); } } }); bar.text.style.fontFamily = '"Raleway", Helvetica, sans-serif'; bar.text.style.fontSize = '2rem'; bar.animate(1.0); // Number from 0.0 to 1.0
 #container { margin: 20 px; width: 200 px; height: 200 px; position: relative; }
 <link href="https://fonts.googleapis.com/css?family=Raleway:400,300,600,800,900" rel="stylesheet" type="text/css"> <div id="container"></div>

The "white bar" under the purple bar in this example例中紫色条下的“白色条”

Do you have an idea how can I do that ?你知道我该怎么做吗?

Thanks in advance提前致谢

You can simply add trailColor property and set its value.您可以简单地添加trailColor属性并设置其值。
Example: trailColor: 'silver',示例: trailColor: 'silver',

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM