This is a pretty common problem people run into...
When you do an xml get from a service... if you get back 2 or more elements
it will be created as an array in AS2/AS3.
But when that same service returns one element it will be deserialized as a
single AS2/AS3 OBJECT.
Import mx.utils.ArrayUtil and then run the result through ArrayUtil.toArray()
first... like this:
<mx:ColumnChart
dataProvider="{ArrayUtil.toArray(
httpGetYearlyPatentStats.lastResult.rsp.statistic)}">
On 2/8/07, coderdude2 <[EMAIL PROTECTED]> wrote:
Hi,
I'm using a column chart with my application. Works fine when
displaying two or more columns, but if the dataProvider contains data
for only one column, the column is not displayed.
The only way I found to display it is to use a CategoryAxis, but that
won't work for me because it skips missing years (if the data has
values for 1984 and 1987 let's say, CategoryAxis doesn't know to
display all the years in between on the axis).
Here's the chart setup I'm using:
<mx:ColumnChart itemClick="chartClickHandler(event)"
id="colchartYearlyPatentStats" maxColumnWidth="20" left="5" top="5"
bottom="5" right="5" showDataTips="true"
dataProvider="{httpGetYearlyPatentStats.lastResult.rsp.statistic}"
>
<mx:series>
<mx:ColumnSeries displayName="" xField="year" yField="count" />
</mx:series>
<mx:horizontalAxis>
<mx:LinearAxis maximumLabelPrecision="1" baseAtZero="false"
minorInterval="0" interval="1" alignLabelsToInterval="true"/>
</mx:horizontalAxis>
</mx:ColumnChart>
Thanks for any help!