This project is read-only.

can not render a custom dynamic bar chart, using razor @helper

Apr 28, 2016 at 5:01 PM
I am trying to render a bar chart in a column based on a value passed to a razor helper function. The rendered chart is rendered in it's own page (see the image). Here is the partial source code on my index.cshtml file:

@helper CustomRenderingOfBarChart(int Height, int Width, string name, Message m, int y)
{
var myChart = new Chart(width: Width, height: Height)
     .AddTitle("")
     .AddSeries(
        name: name,
        xValue: new[] { m.voltage * 5 },
        yValues: new[] { y * 20 })
//.SaveToCache(m.voltage.ToString(), 1, true)
.ToWebImage("png")
.Write();
}

@Html.Grid(Model).Columns(columns =>
{
columns.Add()
 .Encoded(false)
 .Sanitized(false)
 .SetWidth(10)
 //.RenderValueAs(model => Html.Raw("<text><img src=\"@Url.Action(\"CustomRenderingOfBarChart(100, 50, \"\", model, 40)\")\" alt=\"SimpleChart\" /></text>"));
 .RenderValueAs(model => CustomRenderingOfBarChart(100, 50, "", model, 40));
...
}

What am I doing wrong??
Thanks.