I want to make my labels positions in the centre of axis (y axis which is transparent). Only three labels have to be showed. On the same height with the min, max and actual points. How can I achieve this.
- Iliya Mashin asked 2 years ago
- You must login to post comments
Hi Iliya,
You can place axis within chart area by calling setIsCenterAxis(true) on axis instance:
axis.setIsCenterAxis(true)
For more complex layout of axis – please take a look on documentation article about placing axis in the center of chart
As for labels – it looks like you’ll need to create custom TickProvider to override default label placement and instead place them at desired locations ( e.g. provide list of majorTicks where labels should be placed in updateTicks() override ). Is this suitable for your needs?
Hope this will help you!
Best regards,
Yura
- Yura Khariton answered 2 years ago
-
Sorry, I think you don’t understand. Maybe I explained it incorrectly. I want my labels to be on the center of the y axis. They are outside from the chart on the right. I want them to be half on the left (inside chart) half on the right. I already tried updateTicks for rendering only max value and min value. Major and minor ticks always have some extra values (for example I have points with maxValue = 200.0 and minValue = 100.0 and all ticks have value = 0 and value = 6, 8 etc). I passed my values with a setter method and it works. But this values on the y axis was not on the same place with the line on the chart. Look at the picture (on the left is an actual chart. on the right is what I want to get): https://sun9-85.userapi.com/impg/gK-s37XoQUo73HY2_HUVhXylykiZOg35jB11Ow/Y95fOVKIkDM.jpg?size=1430×944&quality=96&sign=aee30e3aac2e168dcd70f5d7fb48aba4&type=album
-
I’m afraid that we don’t support such case of the box, but I believe it’s possible to achieve desired behavior via customization. First of all you can center text within label by setting AxisTickLabelStyle ( https://www.scichart.com/documentation/android/current/webframe.html#SciChart.Charting~com.scichart.charting.visuals.axes.IAxis~setAxisTickLabelStyle.html ). You can center text withing by setting gravity and text alignment. Then to place axis like on screenshot by creating custom placement strategy for axis. We have several articles about this in documentation – https://www.scichart.com/documentation/android/current/webframe.html#Chart%20Layout%20-%20Placing%20Axis%20Central%20in%20the%20Chart.html and https://www.scichart.com/documentation/android/current/webframe.html#Chart%20Layout%20-%20Stack%20Axes%20Vertically%20or%20Horizontally.html . Using this API you can set rect relative to chart where axis should be rendered
- You must login to post comments
Please login first to submit.