Add 2nd axis on right with a different scale (min and max values)

TeeChart for Java (NetBeans, Eclipse, Android Studio, etc)
Post Reply
17489583
Newbie
Newbie
Posts: 3
Joined: Thu Oct 01, 2020 12:00 am

Add 2nd axis on right with a different scale (min and max values)

Post by 17489583 » Thu Sep 22, 2022 5:52 pm

Hi, please refer the chart below. I'm trying to create a single chart with a bar graph, points. Since the values of the bars are larger than points (i.e maximum value of the left axis is so big), they look almost 0 value. Is there any solution? I'm thinking of adding a different scale on right for points and so that it can have its own minimum and maximum. Please help if there's a better solution for this problem. If you have any further questions, I would be happy to answer. Thanks in advance.
135E5837-8BAA-4B84-B9D5-9E2793A946CF_4_5005_c.jpeg
135E5837-8BAA-4B84-B9D5-9E2793A946CF_4_5005_c.jpeg (78.08 KiB) Viewed 33578 times

Yeray
Site Admin
Site Admin
Posts: 9622
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Add 2nd axis on right with a different scale (min and max values)

Post by Yeray » Mon Sep 26, 2022 6:30 am

Hello,

One of the the most common solutions to this issue is what you mention: to make the right axis visible and assign a series to it.
An alternative would be to add a custom axis at the left side and assign a zone to each axis, like in the MultiScrollDemo:
javaw_2022-09-26_08-29-36.png
javaw_2022-09-26_08-29-36.png (208.21 KiB) Viewed 33545 times
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

17489583
Newbie
Newbie
Posts: 3
Joined: Thu Oct 01, 2020 12:00 am

Re: Add 2nd axis on right with a different scale (min and max values)

Post by 17489583 » Mon Sep 26, 2022 9:28 pm

Thanks, Yeray. Adding a custom axis is definitely an option, however, I would like first to try 1st option (making right axis). Could you share examples if you have any? A GitHub link would work too. Thanks again!

Yeray
Site Admin
Site Admin
Posts: 9622
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Add 2nd axis on right with a different scale (min and max values)

Post by Yeray » Tue Sep 27, 2022 6:46 am

Hello,
17489583 wrote:
Mon Sep 26, 2022 9:28 pm
I would like first to try 1st option (making right axis).
You only need to set a series to use the right axis. Ie:

Code: Select all

chart.getSeries(1).setVerticalAxis(VerticalAxis.RIGHT);
Here another example about using custom axes:
javaw_2022-09-27_08-46-01.png
javaw_2022-09-27_08-46-01.png (208.77 KiB) Viewed 33515 times
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

17489583
Newbie
Newbie
Posts: 3
Joined: Thu Oct 01, 2020 12:00 am

Re: Add 2nd axis on right with a different scale (min and max values)

Post by 17489583 » Tue Sep 27, 2022 3:41 pm

This is very helpful, Yeray. Thanks for the timely help. Appreciate it! You may close this thread now.

Post Reply