charts: align two opposite y-axis around zero

asked 2023-03-21 22:09:16 +0800

teresa gravatar image teresa
151 1

Hi all,

I added in my chart two opposite y-axis. They have different ticks, the ticks automatically generated are ok for me, but I need that the zero is aligned for both axis.

Is it possible?

Thanks in advance.

delete flag offensive retag edit

4 Replies

Sort by » oldest newest

answered 2023-03-28 00:07:50 +0800

jeanher gravatar image jeanher
1824 2 6
ZK Team

Hi, are you using ZK Charts or another charting component? What type of chart is it?

We have increased your karma. Please provide more information and a screenshot so that we can understand you better and provide suggestions.

link publish delete flag offensive edit

answered 2023-03-28 01:10:20 +0800

teresa gravatar image teresa
151 1

updated 2023-03-28 01:13:43 +0800

Hi all,

thanks in advance for your support. I attach an image. I need that x-axis (the zero level: y=0) is the same for both y-axes. Is it possible?


image description

link publish delete flag offensive edit

answered 2023-04-06 12:21:22 +0800

hawk gravatar image hawk
3185 1 5
http://hawkphoenix.blogsp... ZK Team

I don't find an option to make the x-axis start from 0 and show negative values at the same time.

But there is an option to make 2 y-axis have the same values like:

image description

public class LinkedYAxisComposer extends SelectorComposer<Component> {
    Charts chart;

    public void doAfterCompose(Component comp) throws Exception {

        // Create a predefined implementation category model
        CategoryModel model = new DefaultCategoryModel();

        // Set value to the model
        model.setValue("Tokyo", "Spring", new Integer(11));
        model.setValue("Tokyo", "Summer", new Integer(8));
        model.setValue("Tokyo", "Fall", new Integer(-2));
        model.setValue("Tokyo", "Winter", new Integer(-10));

        model.setValue("New York", "Spring", new Integer(30));
        model.setValue("New York", "Summer", new Integer(18));
        model.setValue("New York", "Fall", new Integer(20));
        model.setValue("New York", "Winter", new Integer(22));

        // Set model to the chart

        //right y-axis
        YAxis yAxisRight = chart.getYAxis(1);
        //When an axis is linked to a master axis, it will take the same extremes as the master, but as assigned by min or max or by setExtremes. It can be used to show additional info, or to ease reading the chart by duplicating the scales.
        yAxisRight.setTitle("Different Values");
link publish delete flag offensive edit

answered 2023-05-02 23:14:25 +0800

teresa gravatar image teresa
151 1

Thanks for your help.

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools




Asked: 2023-03-21 22:09:16 +0800

Seen: 9 times

Last updated: May 02

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More