Archive for November, 2008
-
Scrolling Large Data Sets in Flex Charts
Sometimes you just have too much chart data to display it all at once. The problem with this is that if you bind all the data to your chart, the chart axis labels become too small to read.
I came across this blog post by Joel May, which demonstrated a really neat way to deal with large chart data in Flex by using a component Joel dubbed a “ScrollableAxisRenderer”. Basically, Joel made a skin for a ScrollBar component so that it would fit compactly on a chart’s X or Y axis. He then made a special implementation of IList that wraps the base data provider (i.e. the one with too many elements to display), so that only a small portion of the data would be “visible” to the chart through the wrapper at any one time. Then, Joel programmed the scroll bar so that moving it around would result in scrolling of the large data set, allowing the chart to “see” as much or as little of the data as you want it to. The effect is really cool.
Unfortunately, Joel’s code didn’t work with dynamic data providers. I tried to take his original code and tweak it slightly to handle dynamic data, but it wasn’t as simple as I had hoped since all the classes seemed to be collaborating with different parts of the process. So, borrowing heavily from Joel’s original code, I re-implemented his idea, focusing most of my effort on a solid implementation of the class that masks the large data set. Once this was finished, I got a sample app working using a basic MXML component with embedded ActionScript. Finally, I split out the code in to AS classes so that the custom scroll bar, custom axis renderer, and collection mask had clearly defined responsibilities and worked as proper components.
I got it all working nicely, so I sent it to Joel just now to see if he was okay with me submitting our joint work to FlexLib. There was certainly a lot of interest in a dynamic version of his component on his blog post, but (like many of us with non-work projects) it looks like Joel did not have the time to go back and finish it off. It certainly is a really cool way to handle large data sets in Flex charts, so kudos to Joel for coming up with the idea and cooking it up.
UPDATE (11/17): I heard back from Joel, and he’s going to look over my additions this week. I’ll keep you posted as we get the code ready for FlexLib.
UPDATE (11/20): Joel and I have some work to do before this goes to FlexLib, so I have published the preliminary beta code here. This code is unwarranted and should be used at your own risk. Also, note that this code has not been tested with vertical scrollbars yet (although I expect it will work fine).
Tagged Yelling
- Apple
- AppleScript
- Arduinome
- Coding
- Electronics
- Gadgets
- Gagdets
- iPad
- Making
- Objective-C
- Politics
- SQL
- Xcode
Most Popular Yelling
- Scrolling Large Data Sets in Flex Charts (35)
- Fixing "Bluetooth audio failed" Error Message on Mac OS X with Sony DR-BT50 Headphones (16)
- How To Become A Software Engineer/Programmer (15)
- Using Axis's wsdl2java in a Maven Build (12)
- An Objective-C Tutorial for Enterprise Java Programmers (12)
- Configuring Tomcat SSL Client/Server Authentication (11)
- On A Personal Note (10)
- Abandoning ColdFusion? (9)
- Adobe Says: "Thousands of Developers are using CF 8" (9)
- What to do about Healthcare? (8)
Stuff I Like
More Yelling
- October 2011
- August 2011
- April 2011
- March 2011
- January 2011
- December 2010
- August 2010
- July 2010
- June 2010
- May 2010
- April 2010
- March 2010
- February 2010
- January 2010
- December 2009
- November 2009
- October 2009
- September 2009
- August 2009
- July 2009
- June 2009
- May 2009
- April 2009
- March 2009
- February 2009
- January 2009
- December 2008
- November 2008
- October 2008
- September 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- January 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
- January 2007
- December 2006
- August 2006
- July 2006
- June 2006
- April 2006
- February 2006
- December 2005
- November 2005
- October 2005
- August 2005
- July 2005
- June 2005