jqxGauge requires the following files:
jqx.base.cssjqxcore.jsjqxdraw.jsjqxgauge.js<script src="~/jqwidgets/jqxgauge.js"></script>
@using jQWidgets.AspNetCore.Mvc.TagHelpers;
@{
List<GaugeRange> ranges = new List<GaugeRange>()
{
new GaugeRange() {StartValue = 0, EndValue = 55, StartWidth = 1, EndWidth = 5, Style = new GaugeStyle() {Fill = "#4bb648", Stroke = "#4bb648" }},
new GaugeRange() {StartValue = 55, EndValue = 110, StartWidth = 5, EndWidth = 10, Style = new GaugeStyle() {Fill = "#fbd109", Stroke = "#fbd109" }},
new GaugeRange() {StartValue = 110, EndValue = 165, StartWidth = 10, EndWidth = 13, Style = new GaugeStyle() {Fill = "#ff8000", Stroke = "#ff8000"} },
new GaugeRange() {StartValue = 165, EndValue = 220, StartWidth = 13, EndWidth = 16, Style = new GaugeStyle() {Fill = "#e02629", Stroke = "#e02629" } }
};
GaugeTicks ticksMinor = new GaugeTicks() { Interval = 5, Size = "5%" };
GaugeTicks ticksMajor = new GaugeTicks() { Interval = 10, Size = "9%" };
}
<jqx-gauge animation-duration="400"></jqx-gauge>
To call a function(method), you need to pass the method name and parameters(if any)
in the UI component’s instance.
<script src="~/jqwidgets/jqxgauge.js"></script>
@using jQWidgets.AspNetCore.Mvc.TagHelpers;
@{
List<GaugeRange> ranges = new List<GaugeRange>()
{
new GaugeRange() {StartValue = 0, EndValue = 55, StartWidth = 1, EndWidth = 5, Style = new GaugeStyle() {Fill = "#4bb648", Stroke = "#4bb648" }},
new GaugeRange() {StartValue = 55, EndValue = 110, StartWidth = 5, EndWidth = 10, Style = new GaugeStyle() {Fill = "#fbd109", Stroke = "#fbd109" }},
new GaugeRange() {StartValue = 110, EndValue = 165, StartWidth = 10, EndWidth = 13, Style = new GaugeStyle() {Fill = "#ff8000", Stroke = "#ff8000"} },
new GaugeRange() {StartValue = 165, EndValue = 220, StartWidth = 13, EndWidth = 16, Style = new GaugeStyle() {Fill = "#e02629", Stroke = "#e02629" } }
};
GaugeTicks ticksMinor = new GaugeTicks() { Interval = 5, Size = "5%" };
GaugeTicks ticksMajor = new GaugeTicks() { Interval = 10, Size = "9%" };
}
<jqx-gauge instance="getInstance()"></jqx-gauge>
@section scripts {
<script type="text/javascript">
function getInstance(instance) {
instance["disable"]();
}
</script>
}
To bind to an event of a UI Component, you can use on-event-type syntax. The example
code below demonstrates how to bind to an event.
<script src="~/jqwidgets/jqxgauge.js"></script>
@using jQWidgets.AspNetCore.Mvc.TagHelpers;
@{
List<GaugeRange> ranges = new List<GaugeRange>()
{
new GaugeRange() {StartValue = 0, EndValue = 55, StartWidth = 1, EndWidth = 5, Style = new GaugeStyle() {Fill = "#4bb648", Stroke = "#4bb648" }},
new GaugeRange() {StartValue = 55, EndValue = 110, StartWidth = 5, EndWidth = 10, Style = new GaugeStyle() {Fill = "#fbd109", Stroke = "#fbd109" }},
new GaugeRange() {StartValue = 110, EndValue = 165, StartWidth = 10, EndWidth = 13, Style = new GaugeStyle() {Fill = "#ff8000", Stroke = "#ff8000"} },
new GaugeRange() {StartValue = 165, EndValue = 220, StartWidth = 13, EndWidth = 16, Style = new GaugeStyle() {Fill = "#e02629", Stroke = "#e02629" } }
};
GaugeTicks ticksMinor = new GaugeTicks() { Interval = 5, Size = "5%" };
GaugeTicks ticksMajor = new GaugeTicks() { Interval = 10, Size = "9%" };
}
<jqx-gauge on-value-changing="eventHandler()"></jqx-gauge>
@section scripts {
<script type="text/javascript">
function eventHandler(event) {
}
</script>
}