Vertical Chart in ASP.NET CORE Charts Component
17 Apr 20232 minutes to read
In EJ2 chart, you can draw a chart in vertical manner by changing orientation of the axis. All series types support this feature. You can use IsTransposed
property in chart to render a chart in vertical manner.
<ejs-chart id="container" isTransposed="true" width="60%">
<e-series-collection>
<e-series dataSource="ViewBag.dataSource" xName="x" yName="y"
type="@Syncfusion.EJ2.Charts.ChartSeriesType.Spline"></e-series>
</e-series-collection>
</ejs-chart>
public ActionResult Index()
{
List<VerticalData> chartData = new List<VerticalData>
{
new VerticalData{ x= 2005, y= 28 },
new VerticalData{ x= 2006, y= 25 },
new VerticalData{ x= 2007, y= 26 },
new VerticalData{ x= 2008, y= 27 },
new VerticalData{ x= 2009, y= 32 },
new VerticalData{ x= 2010, y= 35 },
new VerticalData{ x= 2011, y= 30 }
};
ViewBag.dataSource = chartData;
return View();
}
public class VerticalData
{
public double x;
public double y;
}