Available in the Full Version
Linear Gauge - Overview
This sample demonstrates the supported scale configurations of the igLinearGauge control.
This sample uses CTP (Community Technical Preview) features. The API and behavior may change when these features are released with full support.
Healthy Eating
Fat
Carbohydrates
Protein
Total calories intake ratio between fat, carbohydrates and protein, where middle ranges are healthy ratios and the target values - ideally set goals.
This sample is designed for a larger screen size.
On mobile, try rotating your screen, view full size, or email to another device.
The igLinearGauge is useful for showing a single measure on a linear range. This control supports various configurations including
vertical orientation,
needle customization, and
animations.
See the complete list of samples in the menu.
Code View
Copy to Clipboard
var $linearGauge = $("#lineargauge1"); $linearGauge.igLinearGauge({ width: '100%', height: '80px', ranges: [ { brush: '#FDB881', name: 'bad', startValue: 0, endValue: 20 }, { brush: '#F18B36', name: 'acceptable', startValue: 20, endValue: 35 }, { brush: '#D2660D', name: 'good', startValue: 35, endValue: 100 } ], value: 40, needleStrokeThickness: 2, formatLabel: function (evt, ui) { ui.label += "%"; } }); var $linearGauge2 = $("#lineargauge2"); $linearGauge2.igLinearGauge({ width: '100%', height: '80px', ranges: [ { brush: '#ABD652', name: 'bad', startValue: 0, endValue: 45 }, { brush: '#739F19', name: 'acceptable', startValue: 45, endValue: 65 }, { brush: '#527211', name: 'good', startValue: 65, endValue: 100 } ], value: 35, labelExtent: 0.76, tickStartExtent: 0.5, minorTickEndExtent: 0.54, minorTickStartExtent: 0.65, needleStrokeThickness: 2, formatLabel: function (evt, ui) { ui.label += "%"; } }); var $linearGauge3 = $("#lineargauge3"); $linearGauge3.igLinearGauge({ width: '100%', height: '80px', ranges: [ { name: 'bad', startValue: 0, endValue: 10 }, { name: 'acceptable', startValue: 10, endValue: 35 }, { name: 'good', startValue: 35, endValue: 100 } ], value: 25, labelExtent: 0.76, tickBrush: '#F79646', minorTickBrush: '#F79646', fontBrush: '#11719A', ticksPreTerminal: 10, ticksPostInitial: 10, labelsPostInitial: 20, labelsPreTerminal: 20, formatLabel: function (evt, ui) { ui.label = ui.value + "%"; } });
<div style="min-height:50px"> <h3>Healthy Eating</h3> </div> <br /> <div> <div style="width:30%"> Fat </div> <div style="width:70%" id="lineargauge1"> </div> </div> <br /> <div> <div style="width:30%"> Carbohydrates </div> <div style="width:70%" id="lineargauge2"> </div> </div> <br /> <div> <div style="width:30%"> Protein </div> <div style="width:70%" id="lineargauge3"> </div> </div> <br /> Total calories intake ratio between fat, carbohydrates and protein, where middle ranges are healthy ratios and the target values - ideally set goals.
<!DOCTYPE html> <html> <head> <title></title> <!-- Ignite UI for jQuery Required Combined CSS Files --> <link href="http://cdn-na.infragistics.com/igniteui/2024.1/latest/css/themes/infragistics/infragistics.theme.css" rel="stylesheet" /> <link href="http://cdn-na.infragistics.com/igniteui/2024.1/latest/css/structure/infragistics.css" rel="stylesheet" /> <!-- Used to style the API Viewer and Explorer UI --> <link href="/css/apiviewer.css" rel="stylesheet" type="text/css" /> <script src="http://ajax.aspnetcdn.com/ajax/modernizr/modernizr-2.8.3.js"></script> <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script> <script src="http://code.jquery.com/ui/1.11.1/jquery-ui.min.js"></script> <!-- Ignite UI for jQuery Required Combined JavaScript Files --> <script src="http://cdn-na.infragistics.com/igniteui/2024.1/latest/js/infragistics.core.js"></script> <script src="http://cdn-na.infragistics.com/igniteui/2024.1/latest/js/infragistics.dv.js"></script> </head> <body> <div style="min-height:50px" > <h3>Healthy Eating</h3> </div> <br /> <div > <div style="width:30%" > Fat </div> <div style="width:70%" id="lineargauge1"> </div> </div> <br /> <div> <div style="width:30%"> Carbohydrates </div> <div style="width:70%" id="lineargauge2"> </div> </div> <br /> <div> <div style="width:30%" > Protein </div> <div style="width:70%" id="lineargauge3"> </div> </div> <br /> Total calories intake ratio between fat, carbohydrates and protein, where middle ranges are healthy ratios and the target values - ideally set goals. <script type="text/javascript"> $(function () { var $linearGauge = $("#lineargauge1"); $linearGauge.igLinearGauge({ width: '100%', height: '80px', ranges: [ { brush: '#FDB881', name: 'bad', startValue: 0, endValue: 20 }, { brush: '#F18B36', name: 'acceptable', startValue: 20, endValue: 35 }, { brush: '#D2660D', name: 'good', startValue: 35, endValue: 100 } ], value: 40, needleStrokeThickness: 2, formatLabel: function (evt, ui) { ui.label += "%"; } }); var $linearGauge2 = $("#lineargauge2"); $linearGauge2.igLinearGauge({ width: '100%', height: '80px', ranges: [ { brush: '#ABD652', name: 'bad', startValue: 0, endValue: 45 }, { brush: '#739F19', name: 'acceptable', startValue: 45, endValue: 65 }, { brush: '#527211', name: 'good', startValue: 65, endValue: 100 } ], value: 35, labelExtent: 0.76, tickStartExtent: 0.5, minorTickEndExtent: 0.54, minorTickStartExtent: 0.65, needleStrokeThickness: 2, formatLabel: function (evt, ui) { ui.label += "%"; } }); var $linearGauge3 = $("#lineargauge3"); $linearGauge3.igLinearGauge({ width: '100%', height: '80px', ranges: [ { name: 'bad', startValue: 0, endValue: 10 }, { name: 'acceptable', startValue: 10, endValue: 35 }, { name: 'good', startValue: 35, endValue: 100 } ], value: 25, labelExtent: 0.76, tickBrush: '#F79646', minorTickBrush: '#F79646', fontBrush: '#11719A', ticksPreTerminal: 10, ticksPostInitial: 10, labelsPostInitial: 20, labelsPreTerminal: 20, formatLabel: function (evt, ui) { ui.label = ui.value + "%"; } }); }); </script> </body> </html>