views:

12

answers:

1

I have a Flex Column Chart that has a range of 0 - 6 on the y-axis. I have added the following block to change the default colour of the horizontal grid lines to black.

<mx:backgroundElements>
    <mx:GridLines>
        <mx:horizontalStroke>
            <mx:Stroke color="0x000000" />
        </mx:horizontalStroke>
    </mx:GridLine>
</mx:backgroundElements>

This works fine for all but the horizontal grid line at the top of the chart (at y=6). If I change the maximum value for the y-axis to something different then this new max doesn't have the formatting applied (but all the others do).

So my question is how do I get the top line to be black like the rest of the grid lines?

A: 

Well it appears that the solution is simply to offset the maximum value slightly.

Originally I had this:

<mx:verticalAxis>
    <mx:LinearAxis id="count" maximum="6"/>
</mx:verticalAxis>

And the top grid line wouldn't show as black (unless I set the weight of the line to be 2 or higher and even then it doesn't look the same as the other grid lines).

But by changing the maximum value slightly like this:

<mx:verticalAxis>
    <mx:LinearAxis id="count" maximum="6.01"/>
</mx:verticalAxis>

Makes the top grid appear as it should. Not sure if this is the correct or best solution but it does solve the problem.

Adam