Demo - Needle Pointers
HTML
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.grapecity.com/wijmo/5.latest/styles/wijmo.min.css">
<script src="https://cdn.grapecity.com/wijmo/5.latest/controls/wijmo.min.js"></script>
<script src="https://cdn.grapecity.com/wijmo/5.latest/controls/wijmo.gauge.min.js"></script>
<div class="container">
<h1>
Radial Gauges with Needle Pointers
</h1>
<p>
By default, Wijmo's radial gauges use a colored sector and
a text element to indicate the gauge's current value.
This results in a clean and easy-to read look:
</p>
<div class="row">
<div class="col-xs-4">
<div id="theGauge1"></div>
</div>
<div class="col-xs-4">
<div id="theGauge2"></div>
</div>
<div class="col-xs-4">
<div id="theGauge3"></div>
</div>
</div>
<p>
If you prefer a more traditional needle-style pointer,
you can add an extra SVG shape to the control and apply
a transform to move the needle.
Here is an example that adds a drop-shaped needle pointer:
</p>
<div class="row">
<div class="col-xs-4">
<div id="theGaugeR1"></div>
</div>
<div class="col-xs-4">
<div id="theGaugeR2"></div>
</div>
<div class="col-xs-4">
<div id="theGaugeR3"></div>
</div>
</div>
<p>
Because the pointer is just an SVG path, you can customize
it very easily by changing the path parameters and/or the
CSS associated with the needle element:
</p>
<div class="row">
<div class="col-xs-4">
<div id="theGaugeP1"></div>
</div>
<div class="col-xs-4">
<div id="theGaugeP2"></div>
</div>
<div class="col-xs-4">
<div id="theGaugeP3"></div>
</div>
</div>
</div>
CSS
.wj-radialgauge {
width: 100%;
padding: 24pt;
margin: auto auto;
}
.wj-radialgauge .needle {
fill: orange;
stroke: black;
stroke-width: 1px;
transition: transform 400ms;
}
body {
margin-bottom: 24pt;
}
JavaScript
onload = function() {
// create the gauge
// regular gauges
new wijmo.gauge.RadialGauge('#theGauge1', {
min: 0, max: 100, value: 25,
isReadOnly: false
});
new wijmo.gauge.RadialGauge('#theGauge2', {
min: 0, max: 100, value: 25,
startAngle: -45,
sweepAngle: 270,
isReadOnly: false
});
new wijmo.gauge.RadialGauge('#theGauge3', {
min: 0, max: 500, value: 100,
startAngle: -45,
sweepAngle: -270,
isReadOnly: false
});
// rounded needle pointer
new wijmo.gauge.RadialGauge('#theGaugeR1', {
min: 0, max: 100, value: 25,
showTicks: true,
tickSpacing: 10,
thickness: 0.1,
showText: 'MinMax',
isReadOnly: false,
refreshed: updateNeedleRounded,
valueChanged: updateNeedleRounded
});
new wijmo.gauge.RadialGauge('#theGaugeR2', {
min: 0, max: 100, value: 25,
startAngle: -45,
sweepAngle: 270,
showTicks: true,
tickSpacing: 10,
thickness: 0.1,
showText: 'MinMax',
isReadOnly: false,
refreshed: updateNeedleRounded,
valueChanged: updateNeedleRounded
});
new wijmo.gauge.RadialGauge('#theGaugeR3', {
min: 0, max: 500, value: 100,
startAngle: -45,
sweepAngle: -270,
showTicks: true,
tickSpacing: 25,
thickness: 0.1,
showText: 'MinMax',
isReadOnly: false,
refreshed: updateNeedleRounded,
valueChanged: updateNeedleRounded
});
// pointed needle pointer
new wijmo.gauge.RadialGauge('#theGaugeP1', {
min: 0, max: 100, value: 25,
showTicks: true,
tickSpacing: 10,
thickness: 0.1,
showText: 'MinMax',
isReadOnly: false,
refreshed: updateNeedlePointed,
valueChanged: updateNeedlePointed
});
new wijmo.gauge.RadialGauge('#theGaugeP2', {
min: 0, max: 100, value: 25,
...