首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用Gauge.js添加值

如何使用Gauge.js添加值
EN

Stack Overflow用户
提问于 2015-01-09 13:16:09
回答 2查看 7.3K关注 0票数 0

我实际上是和gauge.js一起工作。它工作正常,但我想增加价值,就像在画布底部的图例一样。在我的例子中,我只想显示41%。你知道怎样才能做到这一点吗?

下面是jsfiddle:http://jsfiddle.net/mopaetxp/

代码语言:javascript
复制
<canvas id="foo"></canvas>

var opts = {
lines: 12, // The number of lines to draw
angle: 0, // The length of each line
lineWidth: 0.1, // The line thickness
pointer: {
length: 0.9, // The radius of the inner circle
strokeWidth: 0.035, // The rotation offset
color: '#000000' // Fill color
},
limitMax: 'false',   // If true, the pointer will not go past the end of the gauge
colorStart: '#006EAB',   // Colors
colorStop: '#006EAB',    // just experiment with them
strokeColor: '#FFFFFF',   // to see which ones work best for you
generateGradient: true
};
var target = document.getElementById('foo'); // your canvas element
var gauge = new Donut(target).setOptions(opts); // create sexy gauge!
gauge.maxValue = 100; // set max gauge value
gauge.animationSpeed = 10; // set animation speed (32 is default value)
gauge.set(41); // set actual value

非常感谢。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2015-01-09 13:36:58

使用HTML LABEL Tag.check演示这里

票数 0
EN

Stack Overflow用户

发布于 2018-05-11 14:17:37

在HTML中使用:

<canvas id="canvas" class="canvas-speedometer"></canvas> <span id="gauge-value"></span>

在你的javascript中:

代码语言:javascript
复制
gauge.setTextField(document.getElementById('gauge-value'));
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27861432

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档