<div id="template">
<div id="left">
<img src="../images/chart/icon_investments.png"/>
</div>
<div id="right">
<div id="point">#point.y#%</div> // How can I add Information from my viewbag for each point, for e.g. Number of Views or ??
</div>
</div>
@(Html.EJ().Chart("chartContainer")
//...
.Series(sr =>
{
.Marker(mr=>mr
.DataLabel(dl=>dl
.Visible(true)
//Set template to data label
.Template("template"))
).Add();
string[] data = { "Number of views", "Miles driven", "Stops" }; |
@{ var results = ViewBag.data; var length = results.Length; } @for (var i = 0; i < length; i++) { var fName = "Template" + i; <div id="@{@fName}" style="display:none"> <div id="right"> <img src="~/icon_investments.png" /> </div> <div id="left"> <div id="point">#point.y# @results[i]</div> </div> </div> |
.Series(sr => sr.EnableSmartLabels(true).Add();) |
var count=0; function seriesrendering(sender) { var array = @Html.Raw(Json.Encode(@ViewBag.data)); var marker = { dataLabel: { shape: "DownArrow", visible: true, fill: "red" } }; for (i = 0; i < sender.data.series.points.length; i++) { value = parseFloat(sender.data.series.points[i].x) if (value < 2006) { sender.data.series.points[i].marker = marker; } sender.data.series.points[i].text=sender.data.series.points[i].y+ " "+array[count];
} count=count+1; |