tags:

views:

9

answers:

1

In Flex columnchart, the height depends on the value, when 2 values have much difference. the smaller value is not very clearly shown on the axis. Is it possible to define the minimum height of column to show, so that even a very small value can be seen?

Thanks

A: 

Typically, in any charting library you'll want to do this by controlling the vertical axis. For example, consider the following data

Foo | Bar | Baz
0.7 | 30  | 80

If you were to chart this and let flex automatically calculate the vertical axis and it chooses for the vertical axis to go from 0.7 to 80 then Foo will barely show up.

However, if you were allowed to specify the vertical axis then you could programatically choose good axis values. For example, let maximumValue be the (previously calculated) maximum value of your data and let minimumValue be the (previously calculated) minimum value of your data. Then you can set your axis min and max as follows...

axisMinimum = minimumValue - ((maximumValue - minimumValue) * 0.2)
axisMaximum = maximumValue + ((maximumValue - minimumValue) * 0.2)

This would ensure that the smallest value in your chart appears at the 20% (0.2) position in your chart and the maximum value appears at the 80% (1-0.2) position of your chart. You can play with the multipliers to get a chart that looks good to you.

The only disadvantage you'll find is that when charts are very close in value then this will make them seem even closer.

Pace