1
votes

I create my bar chart as following: {axisStroke} {axisStroke} {axisStroke}

        <!-- horizontal axis -->
        <mx:horizontalAxis>
            <mx:LinearAxis id="ac" baseAtZero="true"/>
        </mx:horizontalAxis>
        <!-- horizontal axis renderer -->
        <mx:horizontalAxisRenderers>
            <mx:AxisRenderer axis="{ac}" 
                             canDropLabels="true" 
                             styleName="wsViewAxisLabel"
                             minorTickPlacement="none" 
                             tickPlacement="none" 
                             labelGap="0" 
                             showLabels="false" 
                             showLine="false">
                <mx:axisStroke>{axisStroke}</mx:axisStroke>
                <mx:tickStroke>{axisStroke}</mx:tickStroke>
                <mx:minorTickStroke>{axisStroke}</mx:minorTickStroke>
            </mx:AxisRenderer>
        </mx:horizontalAxisRenderers>
        <mx:series>
            <mx:BarSeries id="barSeries" color="#FFFFFF" labelAlign="right"
                          displayName="{seriesName}"
                          filters="{[new DropShadowFilter(2,45,0,.3)]}" fontSize="11"
                          fontWeight="bold" labelField="{valueName}"
                          xField="{seriesName}"
                          showDataEffect="{interpolateIn}"
                          yField="{categoryName}">
                <mx:fill>
                    <mx:LinearGradient id="linearGradient">
                        <mx:entries>
                            <fx:Array>
                                <mx:GradientEntry color="0x99ffcc"
                                                  ratio="0.0"
                                                  alpha="0.1" />
                                <mx:GradientEntry color="0x99ffcc"
                                                  ratio="1.0"
                                                  alpha="1.0"/>
                            </fx:Array>
                        </mx:entries>
                    </mx:LinearGradient>
                </mx:fill>
            </mx:BarSeries>
        </mx:series>
        <mx:annotationElements>
            <mx:CartesianDataCanvas id="mCanvas"/>
        </mx:annotationElements>
    </mx:BarChart>

but when I change the series name and datacollection. the bar chart did not show data.

I try to debug code and find the barseries's items length is 0. it's dataprovider and series name, xfield, yfield is right. do not know why barseries did not create barseriesitems.

many thanks for help.

thanks

1

1 Answers

0
votes

The dataProvider is bound to the original name, so the dataProvider assignment to the ID needs to be updated. The dataProvider is bound the the ArrayCollection, so the ArrayCollection assignment to the dataProvider needs to be updated as well.

References