Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
147498 | Sep 12,2019 08:20 PM UTC | Sep 16,2019 11:36 AM UTC | ASP.NET MVC - EJ 2 | 3 |
![]() |
Tags: Chart |
@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;
} |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.