jqxKnob requires the following files:
jqx.base.cssjqxcore.jsjqxdraw.jsjqxknob.js<script src="~/jqwidgets/jqxknob.js"></script>
@using jQWidgets.AspNetCore.Mvc.TagHelpers;
@{
ViewData["Title"] = "ASP .NET MVC Knob Example";
KnobMarks marks = new KnobMarks()
{
ColorProgress = new KnobColor() { Color = "#00a4e1", Border = "#00a4e1" },
ColorRemaining = new KnobColor() { Color = "#grey", Border = "#grey" },
Type = "line",
Offset = "71%",
Thickness = 3,
Size = "6%",
MajorSize = "9%",
MajorInterval = 10,
MinorInterval = 2
};
KnobStyle style = new KnobStyle()
{
Stroke = "#dfe3e9",
StrokeWidth = 3,
Fill = new KnobGradientFill() { Color = "#fefefe", GradientStops = new List<string>() { "[0, 1]", "[50, 0.9]", "[100, 1]" } }
};
KnobLabels labels = new KnobLabels()
{
Offset = "88%",
Step = 10
};
KnobProgressBar progressBar = new KnobProgressBar()
{
Style = new KnobStyle() { Fill = new KnobGradientFill() { Color = "#00a4e1" }, Stroke = "grey" },
Size = "9%",
Offset = "60%",
Background = new KnobStyle() { Fill = new KnobGradientFill() { Color = "gray" }, Stroke = "gray" }
};
KnobDial dial = new KnobDial()
{
StartAngle = 120,
EndAngle = 420,
InnerRadius = "10%",
OuterRadius = "20%"
};
}
<jqx-knob allow-value-change-on-click="true"></jqx-knob>
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/jqxknob.js"></script>
@using jQWidgets.AspNetCore.Mvc.TagHelpers;
@{
ViewData["Title"] = "ASP .NET MVC Knob Example";
KnobMarks marks = new KnobMarks()
{
ColorProgress = new KnobColor() { Color = "#00a4e1", Border = "#00a4e1" },
ColorRemaining = new KnobColor() { Color = "#grey", Border = "#grey" },
Type = "line",
Offset = "71%",
Thickness = 3,
Size = "6%",
MajorSize = "9%",
MajorInterval = 10,
MinorInterval = 2
};
KnobStyle style = new KnobStyle()
{
Stroke = "#dfe3e9",
StrokeWidth = 3,
Fill = new KnobGradientFill() { Color = "#fefefe", GradientStops = new List<string>() { "[0, 1]", "[50, 0.9]", "[100, 1]" } }
};
KnobLabels labels = new KnobLabels()
{
Offset = "88%",
Step = 10
};
KnobProgressBar progressBar = new KnobProgressBar()
{
Style = new KnobStyle() { Fill = new KnobGradientFill() { Color = "#00a4e1" }, Stroke = "grey" },
Size = "9%",
Offset = "60%",
Background = new KnobStyle() { Fill = new KnobGradientFill() { Color = "gray" }, Stroke = "gray" }
};
KnobDial dial = new KnobDial()
{
StartAngle = 120,
EndAngle = 420,
InnerRadius = "10%",
OuterRadius = "20%"
};
}
<jqx-knob instance="getInstance()"></jqx-knob>
@section scripts {
<script type="text/javascript">
function getInstance(instance) {
var result = instance["val"]();
}
</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/jqxknob.js"></script>
@using jQWidgets.AspNetCore.Mvc.TagHelpers;
@{
ViewData["Title"] = "ASP .NET MVC Knob Example";
KnobMarks marks = new KnobMarks()
{
ColorProgress = new KnobColor() { Color = "#00a4e1", Border = "#00a4e1" },
ColorRemaining = new KnobColor() { Color = "#grey", Border = "#grey" },
Type = "line",
Offset = "71%",
Thickness = 3,
Size = "6%",
MajorSize = "9%",
MajorInterval = 10,
MinorInterval = 2
};
KnobStyle style = new KnobStyle()
{
Stroke = "#dfe3e9",
StrokeWidth = 3,
Fill = new KnobGradientFill() { Color = "#fefefe", GradientStops = new List<string>() { "[0, 1]", "[50, 0.9]", "[100, 1]" } }
};
KnobLabels labels = new KnobLabels()
{
Offset = "88%",
Step = 10
};
KnobProgressBar progressBar = new KnobProgressBar()
{
Style = new KnobStyle() { Fill = new KnobGradientFill() { Color = "#00a4e1" }, Stroke = "grey" },
Size = "9%",
Offset = "60%",
Background = new KnobStyle() { Fill = new KnobGradientFill() { Color = "gray" }, Stroke = "gray" }
};
KnobDial dial = new KnobDial()
{
StartAngle = 120,
EndAngle = 420,
InnerRadius = "10%",
OuterRadius = "20%"
};
}
<jqx-knob min="0" max="100" value="60" start-angle="120" end-angle="420" on-change="eventHandler()"></jqx-knob>
@section scripts {
<script type="text/javascript">
function eventHandler(event) {
}
</script>
}