Flex BubbleChart - 使气泡大小相对于图表大小?
我想知道是否有任何方法可以在图表大小调整大小时使气泡大小缩放或调整大小。如果气泡设置为特定的像素大小,则看起来好像大小已设置,仅此而已。因此,如果您的图表较大,则气泡的大小为 X,如果图表较小,则气泡的大小仍为 X。
这是一个示例应用程序,可向您展示我的意思。任何帮助或想法将不胜感激?
谢谢!
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
private var s1:ArrayCollection = new ArrayCollection( [
{"x": 20, "y": 10, "r":10 },
{"x": 40, "y": 5, "r":20 } ,
{"x": 60, "y": 0, "r":30 }]);
]]>
</mx:Script>
<!-- Define custom color and line style for the bubbles. -->
<mx:SolidColor id="sc1" color="red" alpha=".7"/>
<mx:Stroke id="stroke1" color="red" weight="2"/>
<mx:BubbleChart id="myChart" showDataTips="true" height="100%" width="100%">
<mx:series>
<mx:BubbleSeries
dataProvider="{s1}"
displayName="series1"
xField="x"
yField="y"
radiusField="r"
selectable="true"
fill="{sc1}"
stroke="{stroke1}"
/>
</mx:series>
</mx:BubbleChart>
</mx:Application>
I'm wondering if there is any way to make the bubble sizes scale or resize when the size of the chart resizes. If the bubbles are set to a specific pixel size, it seems as though the size is set and that's it. So, if your chart is large, the bubble is size X and if the chart is small the bubble is still size X.
Here's a sample app to show you what I mean. Any help or ideas would be appreciated?
Thanks!
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
private var s1:ArrayCollection = new ArrayCollection( [
{"x": 20, "y": 10, "r":10 },
{"x": 40, "y": 5, "r":20 } ,
{"x": 60, "y": 0, "r":30 }]);
]]>
</mx:Script>
<!-- Define custom color and line style for the bubbles. -->
<mx:SolidColor id="sc1" color="red" alpha=".7"/>
<mx:Stroke id="stroke1" color="red" weight="2"/>
<mx:BubbleChart id="myChart" showDataTips="true" height="100%" width="100%">
<mx:series>
<mx:BubbleSeries
dataProvider="{s1}"
displayName="series1"
xField="x"
yField="y"
radiusField="r"
selectable="true"
fill="{sc1}"
stroke="{stroke1}"
/>
</mx:series>
</mx:BubbleChart>
</mx:Application>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以做的是,向您的应用程序添加一个调整大小事件。
在程序的脚本部分中声明函数,并在该函数中更改 BubbleSeries 的属性:
或者您始终可以使用缩放变换。
但以上是正确的做法。
What you can do is , add a resize event to your application.
In script part of the programme declare the function and in that function change the properties of the BubbleSeries:
Or you can always use scaling transformations.
But the above is the right way to go through it.