So, I tested the chart helpers in the System.Web.Helpers namespace.
according to http://www.asp.net/web-pages/tutorials/data/7-displaying-data-in-a-chart
I am making a diagram in the form of .cshtml, but instead I want to save it in the ViewModel.
No problem, except when I try to display it as a smaller image on a website.
I thought the cleanest solution would be to create one common partial view for rendering graphs from models
_graph.cshtml
@model System.Web.Helpers.Chart @Model.Write()
And then do this partial presentation in some way on the respective websites. I tried several versions, but cannot make it work.
Website.cshtml
<div> <h2>Some header above a graph</h2> <img src="@Html.Partial("_graph", Model.TheChart)" /> </div>
This does not work, and I'm not sure how to do it. I think that now I can think that all models with charts inherit the interface that Chart provides, and let it be the model for _graph.cshtml.
<img src="_graph.cshtml" />
But not sure if this is using a model.
Any opinions?
source share