简体   繁体   中英

Can I pass the Array values (not the array collection values) to the Bar charts or column charts using Flex 3.5?

Is there anyway where I can pass the Array values (not the array collection values) to the Bar charts or column charts using Flex 3.5?

Here what I need: I have array values like this,

 array1 = [23, 49, 40, 239, 20, 80, 39,49,120, 24, 31,41];

and I want to show these values on the Y-axis and months on X-axis.


I have two questions:

  1. How can I pass this array to Bar chart or column chart?

  2. How do I need to show months on X-axis? I have kept a filters that even if we want to see some months or a particular months or particular span of months. On X-axis it need to change the months dynamically depending on the filters. For example on X-axis the values should be [Jan, Apr, Jun, Oct] if I select the 3 months period filter

I have written a logic to collect the values of those particular months into an array, but I don't understand how to pass this array to Bar chart, because there I don't know what X-field and Y-field to be given.

1) how can I pass this array to Bar chart or column chart.

The dataProvider property of the charts is an object. So you can send anything you want in there. I would expect it to handle an array just as well as it would handle an ArrayCollection.

That said, I believe you're going to have to send in objects with data properties that represent the xField and yField values. An array of simple values doesn't give the component enough information to know what to do.

2) how do I need to show months on Xaxis. beacuse I'm asking this regarding, I have kept a filters that even if we want to see some months or a particular months or perticalar span of months... there on Xaxis it need to change the months dynamically depending on the filters..... (for ex, on Xaxis the values should be (Jan, Apr, Jun,Oct) if i select the 3 months period filter....)

I believe if you create objects, as I stated before with the Xfield value being a string representing the month and ay field value representing your data point, the graph should know how to display the values.

If you were using an ArrayCollection you could easily use the collection's filtering abilities to change the dataProvider, which I would expect would change the graph.

More docs on this

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM