Hello,
Is it possible to fill my gauge through my controller?
In a bar chart you can do for example:
.DataSource(ds => ds.Read(read => read.Action("CNTRLLERFUNC", "CNTRLLERNANE")))How can I perform this for in a gauge? And I don't want this to be done through a model.
4 Answers, 1 is accepted
0
Chili
Top achievements
Rank 1
answered on 07 Nov 2018, 12:56 PM
I have at the moment an ajax thing but I cant fill the value of the gauge....
$.ajax({ type: "GET", url: '/Home/FillG', // 'ControllerName/ActionName' //dataType: "json", success: function (data) { var fill = document.getElementById("gauge"); fill.value = data; }, error: function () { } });.Pointer(pointer => pointer.Value(0).Color("black")) //Get value of controller / ajax0
Accepted
Hello,
Generally, you can configure the Pointer and Scale of the Kendo radial gauge, however, I'm afraid setting it to a data action directly is not provided out-of-the-box:
https://docs.telerik.com/kendo-ui/api/javascript/dataviz/ui/radialgauge
https://docs.telerik.com/kendo-ui/controls/gauges/radialgauge/overview
Here are 3 options you can try:
1. AJAX request - you can slightly modify your sample to apply Kendo syntax:
https://stackoverflow.com/questions/12342590/kendo-gauge-bind-to-xml-json-datasource
2. Use the change event handler of a separate Kendo data source widget on the page:
https://www.telerik.com/forums/how-can-i-set-the-gauge-value-by-datasource
3. Try to pass the value in the ViewData:
https://stackoverflow.com/questions/15882939/binding-a-kendo-gauge-to-local-data?rq=1
I hope this will prove helpful.
Regards,
Eyup
Progress Telerik
Generally, you can configure the Pointer and Scale of the Kendo radial gauge, however, I'm afraid setting it to a data action directly is not provided out-of-the-box:
https://docs.telerik.com/kendo-ui/api/javascript/dataviz/ui/radialgauge
https://docs.telerik.com/kendo-ui/controls/gauges/radialgauge/overview
Here are 3 options you can try:
1. AJAX request - you can slightly modify your sample to apply Kendo syntax:
https://stackoverflow.com/questions/12342590/kendo-gauge-bind-to-xml-json-datasource
2. Use the change event handler of a separate Kendo data source widget on the page:
https://www.telerik.com/forums/how-can-i-set-the-gauge-value-by-datasource
3. Try to pass the value in the ViewData:
https://stackoverflow.com/questions/15882939/binding-a-kendo-gauge-to-local-data?rq=1
I hope this will prove helpful.
Regards,
Eyup
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Chili
Top achievements
Rank 1
answered on 07 Nov 2018, 02:53 PM
Dear Eyup,
Thanks for your well written reply!
To what do i need to change the .value(data.value); ?
My code:
public int FillG() { var x = 5; return x;}$.ajax({ type: "GET", url: '/Home/FillGauge', // 'ControllerName/ActionName' //dataType: "json", success: function (data) { $("#gauge").data("kendoRadialGauge").value(/*what needs this to be*/); }, error: function () { } });0
Chili
Top achievements
Rank 1
answered on 07 Nov 2018, 03:11 PM
Got it!.
