SciChart Android 2D Charts API > Axis APIs > Axis Alignment - Create a Vertical Chart
Axis Alignment - Create a Vertical Chart

It is possible to create Vertical (Rotated) Charts with SciChart. To achieve this, simply set AxisAlignment to Left or Right for X Axis and Top or Bottom for Y Axis. And that's it - SciChart takes care of the rest:

// Create an axis and position it to the left
IAxis xAxis = new NumericAxis(getActivity());
xAxis.setAxisAlignment(AxisAlignment.Left);

// Create an axis and position it to the top
IAxis yAxis = new NumericAxis(getActivity());
yAxis.setAxisAlignment(AxisAlignment.Top);

 

Multiple axes support

Also, SciChart supports unlimited, multiple X or Y axes which can be aligned to the Right, Left, Top, Bottom sides of a chart. More information about the multi-axis feature can be found in this article. All that applies to Vertical (Rotated) Charts as well, so any reasonable combination of differently aligned axes is allowed. This allows to create mixed horizontal and vertical charts:

// Create an axis, position it to the left,
// set the Id and the Title
IAxis leftXAxis = new NumericAxis(getActivity());
leftXAxis.setAxisAlignment(AxisAlignment.Left);
leftXAxis.setAxisId("LeftXAxis");
leftXAxis.setAxisTitle("Vertical X");

// create an axis, position it to the bottom,
// set the Id and the Title
IAxis bottomXAxis = new NumericAxis(getActivity());
bottomXAxis.setAxisAlignment(AxisAlignment.Bottom);
bottomXAxis.setAxisId("BottomXAxis");
bottomXAxis.setAxisTitle("Horizontal X");

// create an axis, position it to the top,
// set the Id and the Title
IAxis topYAxis = new NumericAxis(getActivity());
topYAxis.setAxisAlignment(AxisAlignment.Top);
topYAxis.setAxisId("TopYAxis");
topYAxis.setAxisTitle("Horizontal Y");

// create an axis, position it to the right,
// set the Id and the Title
IAxis rightYAxis = new NumericAxis(getActivity());
rightYAxis.setAxisAlignment(AxisAlignment.Right);
rightYAxis.setAxisId("RightYAxis");
rightYAxis.setAxisTitle("Vertical Y");

 

NOTE: Every RenderableSeries (chart types e.g. LineCandlestickColumn) and every Annotation (Android Views laid over the chart) and some ChartModifiers (zoompan behaviours) requires to be measured against/attached to a particular axis. You have to specify the ID of the axis for them using the setYAxisId and setXAxisId methods.


However, If you have only a single X and Y Axis you never have to set these ID properties. This is required only in case of multiple axis.

See Also