This is a migrated thread and some comments may be shown as answers.
Fill via controller gauge
4 Answers 24 Views
This is a migrated thread and some comments may be shown as answers.
Chili
Top achievements
Rank 1
Chili asked on 06 Nov 2018, 01:15 PM

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

Sort by
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 / ajax
0
Accepted
Eyup
Telerik team
answered on 07 Nov 2018, 01:29 PM
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
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!.
Asked by
Chili
Top achievements
Rank 1
Answers by
Chili
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or