@Html.EJS().Chart("container").Series(series =>
{
series.Type(Syncfusion.EJ2.Charts.ChartSeriesType.Line).Width(2).XName("x")
.Marker(mr => mr.Visible(true).Width(10).Height(10)).YName("yValue")
.DataSource(ViewBag.dataSource).Add();
}).PrimaryXAxis(px => px.ValueType(Syncfusion.EJ2.Charts.ValueType.Category)
).Tooltip(tt => tt.Enable(true)).TooltipRender("tooltipRender").Render()
<script>
function tooltipRender(args) {
// You can add your comments in args.text to display in tooltip
args.text += " Stock Increased";
}
</script> |
|
[Index.cshtml]:
@Html.EJS().Chart("container").Series(series =>
{
series.Type(Syncfusion.EJ2.Charts.ChartSeriesType.Line).Width(2).XName("x")
.Marker(mr => mr.Visible(true).Width(10).Height(10)).TooltipMappingName("text").YName("y")
.DataSource(ViewBag.dataSource).Add();
}).PrimaryXAxis(px => px.ValueType(Syncfusion.EJ2.Charts.ValueType.Category)
).Tooltip(tt => tt.Enable(true)).TooltipRender("tooltipRender").Render()
<script>
function tooltipRender(args) {
// You can add your comments in args.text to display in tooltip
args.text += " " + args.point.tooltip;
}
</script>
[HomeContoller.cs]:
public ActionResult Index()
{
List<DoubleData> chartData = new List<DoubleData>
{
new DoubleData { x = "Pen", y = 2, text="Pen count"},
new DoubleData { x = "Pencil", y = 14, text="pencil count" },
new DoubleData { x = "Eraser", y = 7, text="Eraser count" },
new DoubleData { x = "Book", y = 7, text="Book count" },
new DoubleData { x = "Note", y = 10, text="Note count" },
};
ViewBag.dataSource = chartData;
return View();
}
public class DoubleData
{
public string x;
public double y;
public string text;
} |