Xceed Chart for WinForms v4.4 Documentation
Horizontal Charts

Welcome to Xceed Chart for WinForms v4.4 > User Guide > Series > Horizontal Charts

It is often necessary to display some chart types such as Bar, Float Bar, Line, etc. in a horizontal projection. The easiest way to create horizontal charts is with the help of the predefined chart styles of the Chart object. The following figure displays a horizontal float bar chart with left alignment. 

 

The chart layout is controlled with the help of the PredefinedChartStyle property of the Chart object. This property is actually a helper that affects the chart 3D-view as well as the alignments of the axes' titles and texts. It accepts values from the enumeration type PredefinedChartStyle and accepts the following members (for details, see PredefinedChartStyle Enumeration): 

Vertical: The standard layout of the chart, which is set as default.
HorizontalLeft
: Horizontal layout with left alignment.
HorizontalRight
: Horizontal layout with right alignment. 

The following code creates a left-aligned horizontal bar chart:

VB.NET  

Dim chart As Chart =   chartControl1.Charts.GetAt(0)

chart.PredefinedChartStyle = PredefinedChartStyle.HorizontalLeft

Dim s As BarSeries = CType(chart.Series.Add(SeriesType.Bar), BarSeries)

s.Add(5)

s.Add(3)

s.Add(7)

s.Add(6)

chartControl1.Refresh()

C#  
Chart chart = chartControl1.Charts.GetAt(0);
chart.PredefinedChartStyle = PredefinedChartStyle.HorizontalLeft;
BarSeries s = (BarSeries)chart.Series.Add(SeriesType.Bar);
s.Add(5);
s.Add(3);
s.Add(7);
s.Add(6);
chartControl1.Refresh();

You can achieve similar results by manually modifying the chart 3D-view and axis properties. For example, you can use the SetPredefinedProjection method of the View object with one of the following values to create a left-aligned chart:

PredefinedProjection.OrthogonalHorizontalLeft
PredefinedProjection.OrthogonalHalfHorizontalLeft
PredefinedProjection.PerspectiveHorizontalLeft 

Furthermore, you will have to modify the HorzAlign and VertAlign properties of the axis texts and axis titles for each visible axis. Since this can be a time-consuming task, it is generally recommended to use the PredefinedChartStyle property for overall setup and after that fine-tune the axes and 3D-view if this is required. 

Related Examples

Windows Forms: Series\Bar\Horizontal Bar;   Series\Float Bar\Horizontal Float Bar

See Also

Chart | Axis | View