I am experiencing some odd behavior when databinding the series of a
BarChart and was wondering if anyone could help me figure out what is
going on.

I have -

chart1.mxml

<mx:BarChart id="chart1" series="{model.series}" ...

chart2.mxml

<mx:BarChart id="chart2" series="{model.series}" ...

Note that the series is databound to the same model variable.  In
reality I use the same chart.mxml as a component in 2 different places
in my code but for purposes of debugging I duplicated code to see if
that made a difference.

I call a webservice to get data and when the webservice returns I use
that data to create the series in actionscript and assign it to
model.series.  For purposes of debugging I used Math.random() to
generate random numbers for the x axis. I created a button to call the
the same webservice in chart1.mxml and chart2.mxml.

chart1.mxml works fine.  I click the "get data" button and the chart
is filled with the series data.  I click it again and the series data
changes (due to the random numbers).  All good.

But chart2.mxml behaves oddly.  When chart2.mxml is made visible it
shows chart1.mxml's 'last' series.  Then I click on the "get data"
button on chart2.mxml and the axis changes - to reflect new random
numbers, however, the actual bars do not appear (they disappear in
this case).  I click the button again, the axis changes, but the bars
do not appear.

Any thoughts?

Thanks,

Lynn




Reply via email to