ASP .NET Core MVC Documentation

Getting Started

jqxKnob represents a UI Component with round shape which displays a draggable indicator within a range of values. Knob 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, for example, as a KPI. It supports HTML5, SVG and VML rendering.

Every ASP .NET Core Mvc Tag Helper from jQWidgets toolkit needs its JavaScript files to be included in order to work properly.

jqxKnob requires the following files:

  • CSS

  • jqx.base.css
  • Javascript

  • jqxcore.js
  • jqxdraw.js
  • jqxknob.js
The next step is to create html element within the body of the html document and add the initialization attributes.
<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>
}

Basic Sample