tags:

views:

34

answers:

1

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 (i.e. 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?

A: 

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>
Devtron
No. "The maximum value shown on the y-axis of each chart (i.e. 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." What I meant by this is that in one case the maximum might be 120, in another case it might be 250. You are right in that I will need to specify the maximum on one of the graphs, but I need to do that dynamically by listening for an event fired whenever the maximum is increased on the other graph... or something like that.
Fletch
^ Yeah I would dynamically set the values, based on your events. Set them for both AXIS so that they match. I dont think it would be hard.
Devtron