This is a migrated thread and some comments may be shown as answers.

After adding Arc Gauges in ListView, how can i update their Value property?

4 Answers 248 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Joel
Top achievements
Rank 1
Iron
Joel asked on 25 Jul 2019, 04:36 AM

I am building a dashboard application where the Arc Gauge's value will be updated periodically.

Multiple Arc Gauges are added as item in ListView.

While CenterTemplate can be bound to a model (see OEE property in OEEDataModel), it appears that i can't do the same for Arc Gauge's Value property. 

How can i update each Arc Gauge's Value property in the ListView when the OEE value changes?

index.cshtml

 

@{
    ViewData["Title"] = "Dashboard";
}
@model VelaMfgDashboard.Models.Dashboard.DashboardModel;
 
<div class="dashboard-section k-content wide">
    <h1>Dashboard: @Model.ProductionLine</h1>
    <div class="dashboard-table">
        <h2 class="title">OEE</h2>
        <div class="data">
            @(Html.Kendo().ListView(Model.OEEDatas) 
                .Name("oeeListView")
                .TagName("div")
                .ClientTemplateId("oee-template")
                .DataSource(dataSource => dataSource
                .Ajax()
                .PageSize(5)
                .ServerOperation(false) // all data will be requested at once and data operations will be applied client-side
                .Read(read => read.Action("OEEDatas_Read", "Dashboard")))
                .Pageable(pageable => pageable
                .Refresh(true)
                .ButtonCount(5)
                .PageSizes(new[] { 5, 15, 30 })
                )
            )
        </div>
    </div>
</div>
 
<script type="text/x-kendo-tmpl" id="oee-template">
    <div class="oee-container" k-widget>
        <dl>
            <dt>Machine #:MachineNo#</dt>
            <dd>
                @(Html.Kendo().ArcGauge()
                            .Name("oeeGauge")
                            .Value(80)
                            .Scale(x => x.Min(0).Max(100))
                            .CenterTemplate("#:OEE#%")
                            .ToClientTemplate()
                )
            </dd>
        </dl>
    </div>
</script>
public class DashboardModel
{
    public string ProductionLine { get; set; }
 
    public List<OEEDataModel> OEEDatas { get; set; }
 
    public DashboardModel()
    {
        OEEDatas = new List<OEEDataModel>();
    }
}
 
public class OEEDataModel
{
    public double OEE { get; set; }
    public int MachineNo { get; set; }
}

4 Answers, 1 is accepted

Sort by
0
Georgi
Telerik team
answered on 29 Jul 2019, 12:58 PM
Hi Joel,

A possible solution would be to switch to jQuery initialization for the gauge.

e.g.

<script type="text/x-kendo-tmpl" id="oee-template">
    <div class="oee-container" k-widget>
        <dl>
            <dt>Machine #:MachineNo#</dt>
            <dd>
    <div id="oeeGauge#=MachineNo#"></div><script>
    $(function(){jQuery("\#oeeGauge#=MachineNo#").kendoRadialGauge({"scale":{"max":100, "min":0, centerTemplate:'#=OEE#'},"pointer":{"value":#=OEE#}});});
  <\/script>
            </dd>
        </dl>
    </div>
</script>

Below you will find a small sample which demonstrates the above approach:



Regards,
Georgi
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
Joel
Top achievements
Rank 1
Iron
answered on 01 Aug 2019, 01:45 AM

Hi Georgi,

  I will try to go along with the example given.

  I am using ArcGauge. Does "pointer":{"value":#=OEE#} applicable to ArcGauge?

0
Accepted
Georgi
Telerik team
answered on 01 Aug 2019, 07:51 AM
Hello Joel,

For the ArcGauge you pass the value as a property of the options object.

e.g.

<script type="text/x-kendo-tmpl" id="oee-template">
    <div class="oee-container" k-widget>
        <dl>
            <dt>Machine #:MachineNo#</dt>
            <dd>
    <div id="oeeGauge#=MachineNo#"></div><script>
    $(function(){jQuery("\#oeeGauge#=MachineNo#").kendoArcGauge({"scale":{"max":100, "min":0}, centerTemplate:'#=OEE#', "value":#=OEE#});});
  <\/script>
            </dd>
        </dl>
    </div>
</script>

Below you will find a modified version of the sample:



Regards,
Georgi
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
Joel
Top achievements
Rank 1
Iron
answered on 02 Aug 2019, 10:09 AM

Hi Georgi,

  That will work for now.

   Thanks.

Tags
ListView
Asked by
Joel
Top achievements
Rank 1
Iron
Answers by
Georgi
Telerik team
Joel
Top achievements
Rank 1
Iron
Share this question
or