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>
<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>
}