gpt4 book ai didi

javascript - MeterGuage 4.2 Android 版本中的针问题?

转载 作者:行者123 更新时间:2023-11-28 08:42:57 25 4
gpt4 key购买 nike

在 2.2 版本中,针的计量工作正常,而在 Android 4.2 版本中,我在模拟器/手机(浏览器除外)中执行时看到双针。我无法弄清楚这个问题。

<!DOCTYPE html >
<html>
<head>
<link rel="stylesheet" href="demos.css" type="text/css" media="screen" />
<script src="core.js" ></script>
<script src="dynamic.js" ></script>
<script src="effects.js" ></script>
<script src="meter.js" ></script>
<!--[if lt IE 9]><script src="../excanvas/excanvas.js"></script><![endif]-->

<meta name="description" content="A Meter chart that has been customised to appear circular. It use Meter chart customisations as well as CSS effects" />
<meta name="robots" content="noindex,nofollow" />
</head>
<body>

<!-- <div style="width: 450px; height: 450px; background-color: white; border-radius: 250px; text-align: center; font-family: Arial; box-shadow: 0px 0px 25px gray; border: 10 px solid #ddd"> -->
<canvas id="cvs" width="300" height="300" style="background: url('background.jpg') no-repeat scroll 0 0 transparent; ">
[No canvas support]
</canvas>
<script>
meter = new RGraph.Meter('cvs', 0,100,65)
.Set('border', false)
.Set('tickmarks.small.num', 0)
.Set('tickmarks.big.num', 0)
.Set('angles.start', HALFPI + (HALFPI / 1.0))
.Set('angles.end', TWOPI +HALFPI - (HALFPI / 1.0))
.Set('segment.radius.start', 0)
.Set('text.size', 16)
.Set('colors.ranges', [])

.Set('text.color', 'transparent')

.Set('needle.radius', 110)
.Set('background.color', 'transparent')
.Set('gutter.bottom', 135)
.Draw();

meter.canvas.onclick_rgraph = function (e)
{
var obj = e.target.__object__;
var value = obj.getValue(e);

var str = (value<20.0) ? "1" :
(value<40.0) ? "2" :
(value<60.0) ? "3": (value<80.0)?"4":"5";
//document.getElementById('result').value = str;
if (typeof(value) == 'number') {
obj.value = value;
RGraph.Effects.Meter.Grow(obj);
}
}
</script>
<!-- </div> -->

</body>
</html>

在 2.2 版本中,针的计量工作正常,而在 Android 4.2 版本中,我在模拟器/手机(浏览器除外)中执行时看到双针。我无法弄清楚这个问题。

最佳答案

加载之前您需要清除 Canvas 。请尝试此代码。

<script>
meter = new RGraph.Meter('cvs', 0,100,65)
.Set('border', false)
.Set('tickmarks.small.num', 0)
.Set('tickmarks.big.num', 0)
.Set('angles.start', HALFPI + (HALFPI / 1.0))
.Set('angles.end', TWOPI +HALFPI - (HALFPI / 1.0))
.Set('segment.radius.start', 0)
.Set('text.size', 16)
.Set('colors.ranges', [])
.Set('text.color', 'transparent')
.Set('needle.radius', 110)
.Set('background.color', 'transparent')
.Set('gutter.bottom', 135)
.Draw();

meter.onbeforedraw = function (obj)
{
RGraph.clear(obj.canvas, 'white');
}

meter.canvas.onclick_rgraph = function (e)
{
var obj = e.target.__object__;
var value = obj.getValue(e);

var str = (value<20.0) ? "1" :
(value<40.0) ? "2" :
(value<60.0) ? "3": (value<80.0)?"4":"5";
//document.getElementById('result').value = str;
if (typeof(value) == 'number') {
obj.value = value;
RGraph.Effects.Meter.Grow(obj);
}
}
</script>

关于javascript - MeterGuage 4.2 Android 版本中的针问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20284937/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com