[VB] Option Infer On @ If True Then Dim price = 50 End If (Html.EJ().Chart("container").Series(Sub(sr) sr.Type(SeriesType.Line).EnableAnimation(True) If price > 40 Then sr.Name("Price greater than 40") Else sr.Name("Price less than 40") End If sr.Add() End Sub).Load("chartLoad").Size(sz => sz.Height("450").Width("600"))) [CS] @{var price = 50;} @(Html.EJ().Chart("container") .Series(sr => { sr.Type(SeriesType.Line).EnableAnimation(true); if (price > 40) sr.Name("Price greater than 40"); else sr.Name("Price less than 40"); sr.Add(); }) .Load("chartLoad") .Size(sz => sz.Height("450").Width("600"))) |
[VB] Option Infer On @ If True Then Dim count = DirectCast(ViewBag.datasource, IEnumerable(Of Object)).Count() End If (Html.EJ().Chart("container").Series(Sub(sr) sr.XName("OrderID").YName("Freight").DataSource(DirectCast(ViewBag.datasource, IEnumerable(Of Object))) If count > 0 Then sr.Name("High") Else sr.Name("low") End If sr.Add() End Sub).Size(sz => sz.Height("450").Width("600"))) [CS] @{ Var count = ((IEnumerable<object>)ViewBag.datasource).Count(); } @(Html.EJ().Chart("container") .Series(sr => { sr.XName("OrderID").YName("Freight").DataSource((IEnumerable<object>)ViewBag.datasource); if (count > 0) sr.Name("High"); else sr.Name("low"); sr.Add(); }) .Size(sz => sz.Height("450").Width("600"))) |
ASP.NET MVC: for (int l = 0; l < count; l++) { var dataSrc = (IEnumerable<object>)ViewBag.datasource; var dataEle = dataSrc.ElementAt(l); if (((SyncfusionMvcApplication1.Models.OrdersView)dataEle).Freight > 0) sr.Name("High"); else { sr.Name("low"); break; } } |