简体   繁体   中英

How do you synchronize the scale of the y-axis on two charts in Flex

I have two line charts appearing on one page side-by-side in Flex. In each case the x-axis is a date time axis, the y-axis is whatever I get by default.

The maximum value shown on the y-axis of each chart (ie the y-axis scale) automatically adjusts itself according to the data on the chart. This is good, since I don't know what data will appear on each chart beforehand. However I would like the y-axis on both charts to be identical, matching the larger y-axis, so that they are easy to compare side-by-side. So for example:

  • Situation: Chart A has a maximum value of 120, chart B has a maximum value of 100
  • Currently: Chart A y-axis will go to 120, Chart B y-axis will go to 100.
  • Desired: Chart A y-axis goes to 120, chart B y-axis goes to 120.

How can I acheive this?

You can set the minimum and maximum values on your Axis. Just set them both to 120. Would that do it?

            <mx:verticalAxis>
                <mx:LinearAxis id="yAxis" minimum="40" maximum="120"/>
            </mx:verticalAxis>

            <mx:horizontalAxis>
                <mx:CategoryAxis id="xAxis" minimum="40" maximum="120" /> 
            </mx:horizontalAxis>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM