r/ASPNET • • Apr 09 '13

Kendo UI Gauge -- Using local data

Hi

I asked this question on Stackoverflow but had no luck, was hoping someone here could help: http://stackoverflow.com/questions/15882939/binding-a-kendo-gauge-to-local-data

EDIT -- What we actually want is to bind a datasource to the gauge and allow the gauge to be refreshed periodically seperate to the rest of the page, do you know how to do this?

<div id="operatorGauge">
    @(Html.Kendo().RadialGauge()
        .Name("gauge")
        .Pointer(pointer =>pointer.Value(VARIABLE_FROM_CONTROLLER) )
        .Scale(scale => scale
        .MinorUnit(5)
        .StartAngle(-30)
        .EndAngle(210)
        .Max(180)
        )
</div>
5 Upvotes

3 comments sorted by

View all comments

Show parent comment

1

u/[deleted] Apr 10 '13

Thanks for this, but I may have worded my post a little wrong after discussing with a colleague.

What we actually want is to bind a datasource to the gauge and allow the gauge to be refreshed periodically seperate to the rest of the page, do you know how to do this?

2

u/YuleTideCamel Apr 10 '13

Ok, well keep in mind a few things. the datasource is server side and executed in the context of the server, the gauge is clientside and runs in the clients browser.

What you need to do is build a web service endpoint that returns the current gauge value (this should be easy with WebAPI or WCF) and in your page write some javascript that pulls that value down and updates the guage accordingly. You can have the js code check at regular intervals or you can use something like Signal-R to push changes to the gauge when needed. this is probably approach I would take, with a long running process server side.