Demo - Radial Gauges
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>
<script src="https://cdn.grapecity.com/wijmo/5.latest/controls/wijmo.input.min.js"></script>
<div class="container">
<h1>
Radial Gauges</h1>
<p>
Radial gauges display a metric as a percentage of the length
of a circular scale, like a pie or donut chart with a single
slice.</p>
<p>
By default, the radial scale displays a 180-degree arc.
You can change that by adjusting its start and sweep angles.
If the "autoScale" property is set to true, the control
will automatically scale the gauge to fill the host element
taking onto account the "startAngle" and "sweepAngle"
properties.</p>
<p>
Use the controls below to see the effect of the main RadialGauge
properties:</p>
<div class="row">
<div class="col-xs-6">
<label for="value">value</label>
<div id="value"></div><br>
<label for="startAngle">startAngle</label>
<div id="startAngle"></div><br>
<label for="sweepAngle">sweepAngle</label>
<div id="sweepAngle"></div><br>
<label for="autoScale">autoScale</label>
<input id="autoScale" type="checkbox" checked="checked"><br>
</div>
<div class="col-xs-6">
<div class="gauge-holder">
<div id="theGauge"></div>
</div>
</div>
</div>
</div>
CSS
.gauge-holder {
width: 80%;
padding: 12px;
background: rgba(0, 0, 0, .02);
box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
}
.wj-gauge {
width: 100%;
height: 100%;
}
.wj-radialgauge {
height: 200px;
}
.wj-inputnumber {
width: 120px;
}
label {
width: 100px;
text-align: right;
}
body {
margin-bottom: 24pt;
}
JavaScript
onload = function() {
// create the gauge
var theGauge = new wijmo.gauge.RadialGauge('#theGauge', {
isReadOnly: false,
min: 0,
max: 100,
step: 5,
value: 75,
valueChanged: function(s, e) {
value.value = s.value;
},
showRanges: false,
ranges: [
{ min: 0, max: 33, color: 'red' },
{ min: 33, max: 66, color: 'yellow' },
{ min: 66, max: 100, color: 'green' },
]
});
// change properties
var value = new wijmo.input.InputNumber('#value', {
min: theGauge.min,
max: theGauge.max,
step: theGauge.step,
value: theGauge.value,
valueChanged: function(s, e) {
theGauge.value = s.value;
}
});
var startAngle = new wijmo.input.InputNumber('#startAngle', {
step: 10,
min: -360,
max: 360,
value: theGauge.startAngle,
valueChanged: function(s, e) {
theGauge.startAngle = s.value;
}
});
var sweepAngle = new wijmo.input.InputNumber('#sweepAngle', {
step: 10,
min: -360,
max: 360,
value: theGauge.sweepAngle,
valueChanged: function(s, e) {
theGauge.sweepAngle = s.value;
}
});
document.getElementById('autoScale').addEventListener('click', function(e) {
theGauge.autoScale = e.target.checked;
})
}