Flex 图表 itemRenderer 大小
你好 我有一个扩展 CircleItemRenderer 的自定义类 BubbleRenderer。我使用此类作为气泡图中的项目渲染器。在气泡图中,我监听 itemRollOver 事件。气泡图的 maxRadius 和 minRadius 是相同的。但我有许多不同尺寸的气泡,因为我有自己的方式将它们绘制到屏幕上。现在棘手的部分是,无论气泡的实际大小如何,它们都会被滚动。例如,气泡半径为 100。气泡图的 maxRadius 和 minRadius 等于 20。现在,如果我将鼠标光标放置在距气泡中心 20 px 的位置,将调度 itemRollOver 事件。我想要的是,如果我将鼠标光标放置在距气泡中心 100px(即气泡的实际半径)处,该事件就会被调度。我尝试覆盖 width 和measuredWidth 属性,但没有成功。我在 Flex 框架中进行了一些挖掘,以找到 itemRollOver 事件基于什么属性。我发现的唯一一件事是 ChartBase.processRollEvents 根据 hitSet 参数创建事件。 hitSet 参数是由 ChartBase.findDataPoints 生成的,但我不明白这个方法是如何工作的。解决该问题的一种方法是每次鼠标移动时检查气泡位置,但我希望有一个更简单的解决方案。
Hi
I have a custom class BubbleRenderer that extends CircleItemRenderer. I use this class as an item renderer in a bubble chart. In the bubble chart I listen to itemRollOver event. The bubble chart's maxRadius and minRadius are the same. But I have bubbles with many different sizes because I have my own way of drawing them onto the screen. Now the tricky part is that bubbles are rolled over regardless of their real size. E.g bubble radius is 100. Bubble chart's maxRadius and minRadius are equal to 20. Now the itemRollOver event will be dispatched if I place mouse cursor 20 px from the bubble center. What I want is that the event will be dispatched if I place mouse cursor 100px (that is actual radius of a bubble) from the center of my bubble. I tried to override width and measuredWidth properties with no luck. I digged in Flex framework a little bit to find what property is the itemRollOver event based on. The only thing I found is that ChartBase.processRollEvents creates the event based on hitSet parameter. The hitSet parameter is produced by ChartBase.findDataPoints but I don't understand how this method works. One way to solve the problem is to check bubble positions with every mouse move, but I hope there is a simplier solution.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
鼠标悬停检测发生在 BubbleSeries.findDataPoints() 中,
如您所见,它强烈依赖于
minRadius
和maxRadius
,因此它不会显示大于 maxRadius 的气泡似乎是个好主意。也许您可以将
z
计算与自定义气泡渲染逻辑同步?The mouse roll over detection takes place in
BubbleSeries.findDataPoints()
As you can see it strongly depends on
minRadius
andmaxRadius
so it doesn't seem to be a good idea to display a bubble bigger thanmaxRadius
.Maybe you could sync
z
calculation with your custom bubble rendering logic?