ASP .NET Core MVC Documentation
Getting Started
jqxBarGauge displays an indicator within a range of values. Gauges can be used in a table or matrix to show the relative value of a field in a range of values in the data region.Every UI widget from jQWidgets toolkit needs its JavaScript files to be included in order to work properly.
jqxBarGauge widget requires the following files:
jqxbargauge.js
<script src="../jqwidgets/jqxbargauge.js"></script>
@{
ViewData["Title"] = "ASP .NET MVC Bar Gauge Example";
List<string> ranges = new List<string>()
{
'{ start-value: 0, end-value: 200, color: \"#000000\", opacity: 0.5 }',
'{ start-value: 200, end-value: 250, color: \"#000000\", opacity: 0.3 }',
'{ start-value: 250, end-value: 300, color: \"#000000\", opacity: 0.1 }'
};
List<double> barGaugeValues = new List<double>(){102, 115, 130, 137};string labels = '{ connectorColor: 'green', connectorWidth: 1}';string labels = '{ connectorColor: 'green', connectorWidth: 1}';string title = '{text: 'Ranking'}';string tooltip = '{formatFunction: function(value, index) { return value + ' $';}, visible: true, precision: 0 }';string rendered = '{rendered: function() {}}';string formatFunction = '{formatFunction: function(value, index, color) { return "red";}}';}<jqx-bar-gauge animation-duration="500" values="barGaugeValues" width="600" height="600" max="150" ranges="ranges"></jqx-bar-gauge>
To call a function(method), you need to pass the method name and parameters(if any) in the jqxBarGauge’s instance.
<script src="../jqwidgets/jqxbargauge.js"></script>
@{
ViewData["Title"] = "ASP .NET MVC Bar Gauge Example";
List<string> ranges = new List<string>()
{
'{ start-value: 0, end-value: 200, color: \"#000000\", opacity: 0.5 }',
'{ start-value: 200, end-value: 250, color: \"#000000\", opacity: 0.3 }',
'{ start-value: 250, end-value: 300, color: \"#000000\", opacity: 0.1 }'
}; List<double> barGaugeValues = new List<double>() { 102, 115, 130, 137 }; string labels = '{ connectorColor: 'green', connectorWidth: 1}'; string labels = '{ connectorColor: 'green', connectorWidth: 1}'; string title = '{text: 'Ranking'}'; string tooltip = '{formatFunction: function(value, index) { return value + ' $';}, visible: true, precision: 0 }'; string rendered = '{rendered: function() {}}'; string formatFunction = '{formatFunction: function(value, index, color) { return "red";}}';}<jqx-bar-gauge values="barGaugeValues" width="600" height="600" max="150" ranges="ranges" instance="getInstance()"></jqx-bar-gauge> @section scripts { <script type="text/javascript"> function getInstance(instance) { instance["val"]([112, 125, 150, 137]); } </script> }
To bind to an event of a UI widget, you can use on-event-type
syntax. The example
code below demonstrates how to bind to an event.
<script src="../jqwidgets/jqxbargauge.js"></script>
@{
ViewData["Title"] = "ASP .NET MVC Bar Gauge Example";
List<string> ranges = new List<string>()
{
'{ start-value: 0, end-value: 200, color: \"#000000\", opacity: 0.5 }',
'{ start-value: 200, end-value: 250, color: \"#000000\", opacity: 0.3 }',
'{ start-value: 250, end-value: 300, color: \"#000000\", opacity: 0.1 }'
}; List<double> barGaugeValues = new List<double>() { 102, 115, 130, 137 }; string labels = '{ connectorColor: 'green', connectorWidth: 1}'; string labels = '{ connectorColor: 'green', connectorWidth: 1}'; string title = '{text: 'Ranking'}'; string tooltip = '{formatFunction: function(value, index) { return value + ' $';}, visible: true, precision: 0 }'; string rendered = '{rendered: function() {}}'; string formatFunction = '{formatFunction: function(value, index, color) { return "red";}}';}<jqx-bar-gauge on-draw-end="eventHandler()"></jqx-bar-gauge> @section scripts { <script type="text/javascript"> function eventHandler(event) { } </script> }