Category Archives: LineChart

Aligning data in a Flex LineChart control to horizontal and vertical tick marks

The following example shows how you can align the tick marks along the vertical and horizontal axis using the horizontalTickAligned and verticalTickAligned styles in the GridLines class, as seen in the following snippet:

<mx:GridLines direction="both"
    horizontalTickAligned="false"
    verticalTickAligned="false">

    ...

</mx:GridLines>

Full code after the jump.

Continue reading Aligning data in a Flex LineChart control to horizontal and vertical tick marks

Alternating background column colors in a Flex LineSeries chart

In a previous example, “Alternating background row colors in a Flex LineSeries chart”, we saw how to alternate row colors in a LineSeries chart using the horizontalFill and horizontalAlternateFill styles.

In the following example, we see a similar technique for setting column background colors using the verticalFill and verticalAlternateFill styles, as seen in the following snippet:

<mx:LineChart showDataTips=true dataProvider={dp}>

    <mx:backgroundElements>
        <mx:GridLines direction=vertical>
            <mx:verticalFill>
                <mx:SolidColor color=haloBlue alpha=0.2 />
            </mx:verticalFill>
            <mx:verticalAlternateFill>
                <mx:SolidColor color=haloSilver alpha=0.2 />
            </mx:verticalAlternateFill>
        </mx:GridLines>
    </mx:backgroundElements>

    ...

</mx:LineChart>

In this example, you also see examples of setting custom label functions for a LinearAxis and CategoryAxis, both of which we’ve seen examples of before (“Creating a custom label function on a Flex LineChart control’s linear axis” and “Creating a custom label function on a Flex LineChart control’s category axis” respectively) but it’s always fun to see a few of these things in a single example.

Full code after the jump.

Continue reading Alternating background column colors in a Flex LineSeries chart

Creating a custom label function on a Flex LineChart control’s category axis

The following example shows how you can create a custom label function on a CategoryAxis in a Flex LineChart control.

For an example of creating a custom label function for the vertical/linear axis, check out “Creating a custom label function on a Flex LineChart control’s linear axis”.

Full code after the jump.

Continue reading Creating a custom label function on a Flex LineChart control’s category axis

Changing the horizontal grid line frequency in a Flex LineChart control using the horizontalChangeCount style

The following example shows how you can adjust the interval of horizontal grid lines in a LineChart by setting the horizontalChangeCount style.

Full code after the jump.

Continue reading Changing the horizontal grid line frequency in a Flex LineChart control using the horizontalChangeCount style

Displaying grid lines in a Flex LineChart control

The following example shows how you can add horizontal or vertical (or both) grid lines to a LineChart contol in Flex by setting the direction style in the GridLines tags, as seen in the following snippet:

<mx:LineChart dataProvider="{dp}">

    <mx:backgroundElements>
        <mx:GridLines direction="vertical" />
    </mx:backgroundElements>

</mx:LineChart>

Full code after the jump.

Continue reading Displaying grid lines in a Flex LineChart control

Alternating background row colors in a Flex LineSeries chart

The following example shows how you can alternate background row colors in a LineSeries chart in Flex by setting the horizontalAlternateFill style in the GridLines object, as seen in the following snippet:

<mx:LineChart showDataTips="true" dataProvider="{dp}">

    <mx:backgroundElements>
        <mx:GridLines>
            <mx:horizontalAlternateFill>
                <mx:SolidColor color="haloSilver" alpha="0.25" />
            </mx:horizontalAlternateFill>
        </mx:GridLines>
    </mx:backgroundElements>

</mx:LineChart>

Full code after the jump.

Continue reading Alternating background row colors in a Flex LineSeries chart

Creating a custom label function on a Flex LineChart control’s linear axis

The following example shows how you can create a custom label function on a LinearAxis in a Flex LineChart control.

For an example of creating a custom label function for the horizontal/category axis, check out “Creating a custom label function on a Flex LineChart control’s category axis”.

Full code after the jump.

Continue reading Creating a custom label function on a Flex LineChart control’s linear axis