我可以使用 Flex 3.5 将数组值(不是数组集合值)传递到条形图或柱形图吗?
无论如何,我可以使用 Flex 3.5 将数组值(不是数组集合值)传递到条形图或柱形图吗?
我需要的是:我有这样的数组值,
array1 = [23, 49, 40, 239, 20, 80, 39,49,120, 24, 31,41];
我想在 Y 轴上显示这些值,在 X 轴上显示月份。
我有两个问题:
如何将此数组传递给条形图或柱形图?
我如何需要在 X 轴上显示月份?我保留了一个过滤器,即使我们想查看某些月份或特定月份或特定月份范围。在 X 轴上,它需要根据过滤器动态更改月份。例如,如果我选择 3 个月期间过滤器,则 X 轴上的值应为
[Jan、Apr、Jun、Oct]
我已编写一个逻辑来将这些特定月份的值收集到数组中,但我不明白如何将此数组传递给条形图,因为我不知道要给出什么 X 字段和 Y 字段。
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:
How can I pass this array to Bar chart or column chart?
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
图表的 dataProvider 属性是一个对象。所以你可以在那里发送任何你想要的东西。我希望它能够像处理 ArrayCollection 一样处理数组。
也就是说,我相信您将必须发送具有表示 xField 和 yField 值的数据属性的对象。简单值数组无法为组件提供足够的信息来了解该做什么。
我相信,如果您创建对象,正如我之前所说,Xfield 值是代表月份的字符串,ay 字段值代表您的数据点,图表应该知道如何显示这些值。
如果您使用的是 ArrayCollection,您可以轻松地使用集合的过滤功能来更改 dataProvider,我希望这会更改图表。
有关此内容的更多文档
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.
I believe if you create objects, as I stated before with the Xfield value being a string representing the month and a y 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