开发者

Flex: Using custom LineSeries so that item rendering/data tip still works

Brief description: If I create a customized LineSeries class and add that one to my project, even if it's the same as original, I lose data tip functionality.

Elaborated description: I'm using a LineChart component and I needed to render my lines so that they change color according to some value ranges. So I modified LineRenderer, applied it to my LineSeries and everything was working great. Unfortunately I later realized that I will need to supply ranges and colors dynamically as they're supposed to be customizable. This is where it gets tricky.

This is the code I use to set my lineRenderer:

var cf:ClassFactory = new ClassFactory(myLineRenderer);
lineSeries.setStyle("lineSegmentRenderer",cf);

I did not find a way to dynamically change data on a ClassFactory without making an instance of it. But if I make an instance of it, I can not set it as a style. If anyone knows of a way to do this, it would solve my problem straight out. All I need is to set an array property inside myLineRenderer. But it makes sense to me why this can't be done. Can I dynamically make a new Class that is a clone of myLineRederer yet has one property changed? Can I add an argument to myLineRenderer constructor? If so, how would that work with the code above?

Anyway, since that didn't work, I figured I needed to change the data supplied to myLineRenderer. For this I created my own LineSeries that has a settable Array property that it adds to the data passed to myLineRenderer. And it works great. With one little kink. As soon as I change my LineChart series from LineSeries to myLineSeries, I can't move the mouse cursor along the line and get info on each item in the chart. I removed all the changes I made to original LineSeries, but it makes no difference. What am I missing?

Right now I'm trapped between having customizable color ranges with no data tips and non-customizable color ranges 开发者_如何学Pythonwith data tips. The former is still better, but I would really need both to work or at least know why that's impossible.

Any help would be much appreciated.


Take a look at the properties property of ClassFactory

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/core/ClassFactory.html#properties

I think that does exactly what you need it to.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜