1

I tried below code by adding foreach loop, it looked like it's not allowed to add code inside the Html.ShieldChart, anybody can help? Thanks in advance.

@(Html.ShieldChart()
.Name("chart1")
.Theme("abc")
...
foreach (PercentileRank p in prank)
{
 .DataSeries(d => d.Line().Data(p.Ranks).CollectionAlias(p.Division))
}
...
)
Vladimir Georgiev
  • 1,949
  • 23
  • 26
Mark
  • 11
  • 1

1 Answers1

0

Your code contains a syntax error and hence does not work.

What you can do is in your Razor view, create a Chart helper with code similar to this Grid helper:

@{
    var grid = Html.ShieldGrid()
        .DataSourceExpression(@<text>window.gridSource</text>)
        .Height(400)
        .ScrollingConfiguration(scrolling => scrolling.Virtual(true));

    for (var i=0; i<10; i++) {
        grid.Columns(col => col.Field("col" + i).Width(140));
    }
}

Then in you can render the helper in your view by simply adding:

@grid
Vladimir Georgiev
  • 1,949
  • 23
  • 26