[_layout.cshtml]:
<ejs-scripts></ejs-scripts>
[_ViewImports.cshtml]:
@addTagHelper *, Syncfusion.EJ2
[index.cshtml]:
<div class="col-md-12 row">
<div class="col-md-12 btn btn-light-green" style="padding: 5px">
<div class="row">
<div class="col-md-1">
<span class="fas fa-hourglass-half " style="font-size: 50px; padding: 3px;"></span>
</div>
<div class="col-md-11">
<div>
<ejs-chart id="byagechart" title="AGE - AMOUNT VARIATIONS" width="100%">
<e-chart-primaryxaxis valueType="Category" labelFormat="y" edgeLabelPlacement="Shift"></e-chart-primaryxaxis>
<e-series-collection>
<e-series dataSource="ViewBag.dataSource" name="PatientAge" xName="PatientAge" width="2" opacity="1" yName="Amount" type="@Syncfusion.EJ2.Charts.ChartSeriesType.Line"></e-series>
</e-series-collection>
</ejs-chart>
</div>
</div>
</div>
</div>
</div>
[HomeController.cs]:
public IActionResult Index()
{
List<ColumnChartData> chartData = new List<ColumnChartData>
{
new ColumnChartData { PatientAge= "30-40", Amount= 4600 },
new ColumnChartData {PatientAge= "40-50", Amount= 2700 },
new ColumnChartData { PatientAge= "50-60", Amount= 4500 },
new ColumnChartData { PatientAge= "60-70", Amount= 1000 },
new ColumnChartData { PatientAge= "70-80", Amount= 3700 },
};
ViewBag.dataSource = chartData;
return View();
}
public class ColumnChartData
{
public string PatientAge;
public double Amount;
} |