CsHtml:
@Html.EJS().Chart("container").Series(series =>
{
series.Type(Syncfusion.EJ2.Charts.ChartSeriesType.Column)
.XName("xValue").YName("yValue1").DataSource(ViewBag.dataSource).Add();
series.Type(Syncfusion.EJ2.Charts.ChartSeriesType.Column)
.XName("xValue").YName("yValue2").DataSource(ViewBag.dataSource).Add();
}).PrimaryXAxis(px => px.Interval(1)
.ValueType(Syncfusion.EJ2.Charts.ValueType.Category)).Render()
Controller:
List<ChartData> dataSource = new List<ChartData>
{
new ChartData { xValue= "GER", yValue1= 480, yValue2 = 80 },
new ChartData { xValue= "RUS", yValue1= 300, yValue2 = 200 },
new ChartData { xValue= "BRZ", yValue1= 450, yValue2 = 150 },
new ChartData { xValue= "IND", yValue1= 460, yValue2 = 60 },
new ChartData { xValue= "CHN", yValue1= 720, yValue2 = 260 },
};
ViewBag.dataSource = dataSource; |