Google Finance with Flex from Silvafug last night

So I gave a presentation at the Silvafug meeting at Adobe in San Jose last night on Flex Charting. I struggled on what to give the talk on up until about a week ago. I finally decided to continue with the basic range selection example I'd done a few months ago, and create a "Google Finance" app in Flex, with all (or almost all) the functionality that the Google app offers.

While the presentation was exciting and fun to do, I think my last minute prep, and the fact I haven't spoken in public for many many many years resulted in a less than stellar walk-through of the functionality involved. However, the experience and feedback gained from last night was HUGE. I realized how I can improve the presentation 1000% percent, and plan on doing so before I give my talk in Seattle at 360Flex on August 13th (at least that's the tentative date.

Today I'm posting the app for everyone to play around, but am holding off on posting the code until Seattle (I don't want to steal my own thunder). However, I fully intend to release both the code-base, and an associated swc file for everyone to use, and integrate their own data into this type of interface. Hopefully this might entice the fence-sitters to attend 360 in August if you're interested in this kind of stuff.

I will say that it's not complicated stuff... and everyone and anyone should be able to insert their own data, or adapt the UI to fit their own project needs.

So here's the app... (click the image to view)

Related Blog Entries

Comments
This looks great. I'm building an open source database for a local non-profit environmental group to handle their field science data. I'm using your basic range selector on a data view webpage so volunteer data monitors (and anyone else interested in it) can see, compare and play(!) with the data at their sites. It'll be great to be able incorporate these new added features in the near future. Thanks!!!
# Posted By Thomas Spellman | 6/15/07 12:35 PM
Hey Brendan,

Great presentation last night. Unfortunately I didn't get a chance to follow up with you before I left, but I would love to give you some feedback. Please shoot me an email and we can chat.

Thanks!

-Jeremy
# Posted By Jeremy Johnstone | 6/15/07 1:21 PM
Hi Brendan,

It looks just awesum! No words to explain it. I was using your google chart navigator for my application. I just wanted the same effect like how it looks.I know that google uses the flash and ajax to bring these effects. Never know we can build these in flex. I am waiting for your code now. ;)
# Posted By Jaga | 6/16/07 5:38 AM
Did you made that in flash and then exported it as a swc file?
# Posted By Jaga | 6/16/07 9:05 AM
No, this is 100% Flex, and almost the entire UI (visible elements) are done in MXML... very simple :-)
# Posted By Brendan Meutzner | 6/16/07 9:30 AM
when are you posting your code? :)
# Posted By Jaga | 6/16/07 12:49 PM
Sounds really interesting!!! We tried to bring that effect in almost all possible ways, but cudnt! :)
# Posted By Jaga | 6/16/07 12:51 PM
Hi Brendan,

i found a small bug in your app! if you take the slider to the extreme right or left and then drag the chart, the entire app gets stuck when both the ends of the slider meets. I think you can avoid this by locking the slider once the user sets it, like the way google does.
# Posted By Jaga | 6/16/07 1:13 PM
Jaga,

Thanks for the bug notification... I'll make sure to get that fixed.

Code release will be August 13th if you're in Seattle at 360Flex... I think I'll hold off on doing a code release on my blog for a week or two after that to entice people to come to 360 (there are many other reasons you should attend anyway).
# Posted By Brendan Meutzner | 6/16/07 3:34 PM
Brendan, Unfortunately i can't attend 360 flex Conference. I am from India! So i guess i have to wait for August end code release on your blog! :(
# Posted By Jaga | 6/16/07 6:44 PM
I can't attend 360 flex Conference :-( is it possible to have the source code before the event.. iof so.. could you please drop me an email. thanks alot!
# Posted By gloubidou | 6/17/07 8:20 AM
Could you please send me the source code through email? Thanks in advance.
my email id is: write2jaga@yahoo.com
# Posted By Jaga | 6/17/07 9:16 AM
It is very cool. Is it possible to provide your presentation slides and the source code?
# Posted By Steven | 6/18/07 10:59 AM
I am starting to use flex for a dashboard application and I could really use some help with the columnchart component.
I am trying to get an overlayed bar with alpha transparency like this example: http://flexapps.macromedia.com/flex/brocade/app.mx...

Do you know if this is a custom component or are there any properties for this type of behavior?

Thank you very much.
# Posted By Adriano | 6/18/07 12:10 PM
Yes, the breeze presentation will be available soon on www.silvafug.org.
# Posted By Brendan Meutzner | 6/18/07 12:23 PM
Here's a link to the PPT presentation from the meeting.

http://meutzner.com/examples/flex_finance/Flex Finance PPT.ppt

Copy and paste to browser to download...
# Posted By Brendan Meutzner | 6/18/07 12:41 PM
Adriano,

The example you're referring to in the brocade demo can be seen here...

http://www.stretchmedia.ca/code_examples/offset_ca...

For the fill, just use a SolidColor value with the alpha value set appropriately.


Brendan
# Posted By Brendan Meutzner | 6/18/07 12:44 PM
The link to the PPT file is not working :-(
# Posted By Lars | 6/19/07 7:01 AM
Yeah, great preso! I'm so glad that Silvafug has such heavy hitters in our local user group. I'll have those playback links soon!
# Posted By Tom Ortega | 6/19/07 11:20 PM
Brendon,

Here's the link for the chart to work correctly...
http://meutzner.com/examples/flex_finance/Flex Finance%20PPT.ppt

You had an extra space in that link...

Great presentation!

Patrick
# Posted By Patrick | 6/20/07 8:47 PM
whoops now i can't type correctly... one more try
http://meutzner.com/examples/flex_finance/Flex%20Finance%20PPT.ppt
# Posted By Patrick | 6/20/07 8:50 PM
Brendon, you just became my new favorite person ;-)

Does anyone know if Google used flex or not for theirs?
# Posted By Brian | 6/22/07 4:50 PM
As far as I know, it's a combination of Flash and Ajax. Jeremy Johnston was kind enough to look up the release date during the Silvafug meeting last week, and found it was released in March of 2006... a bit too early to have been a Flex product (Flex 1.5 wouldn't have had the capabilities to accomplish this).

Brendan
# Posted By Brendan | 6/23/07 11:51 AM
Google uses flash, ajax and JavaScript Integration kit for their finance charts. More info on http://www.mikechambers.com/blog/2006/03/21/google...
# Posted By Jaga | 6/24/07 8:52 AM
Thanks for the info and feedback. Another question if you don't mind. I just learned about Flex like 3 days ago, and I haven't personally used Flash in many years. So it has been said that Google is using the Flash / JavaScript integration kit. Howevever, are the graphing capabilities see in Flex possible without Flex and without a LOT of coding? Am I correct in thinking that for Google to create that graph without Flex probably would have required several weeks of work at least?
# Posted By Brian | 6/25/07 4:13 AM
RangeError: Index '0' specified is out of bounds.
   at mx.collections::ListCollectionView/getItemAt()
   at Flex_Finance_Step5/::chartMouseOut()
   at Flex_Finance_Step5/::updateMainData()
   at Flex_Finance_Step5/::updateBox()
   at Flex_Finance_Step5/__slider_change()
   at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
   at flash.events::EventDispatcher/dispatchEvent()
   at mx.core::UIComponent/dispatchEvent()
   at com.dougmccune.baseClasses::SliderBase/com.dougmccune.baseClasses:SliderBase::setValueAt()
   at com.dougmccune.baseClasses::SliderBase/com.dougmccune.baseClasses:SliderBase::commitProperties()
   at mx.core::UIComponent/validateProperties()
   at mx.managers::LayoutManager/::validateProperties()
   at mx.managers::LayoutManager/::doPhasedInstantiation()
   at Function/http://adobe.com/AS3/2006/builtin::apply()
   at mx.core::UIComponent/::callLaterDispatcher2()
   at mx.core::UIComponent/::callLaterDispatcher()

i got this when i moved the left slider at the beginning, good work Brendan, need the code.. Thanks
# Posted By arthur | 6/25/07 8:40 AM
I can't imagine the amount of effort involved in creating something like this from scratch in Flash... scares me actually. I've done other simple examples using Flex where I've recreated functionality that I'd previously accomplished in Flash and it's pretty great how quickly it gets done. Weeks of effort in Flash equate to days in Flex. The example here took me under a week to code, and in total is less than 1000 lines of code (granted I've used Doug McCune's dual-slider and required effort from him to create, but am not counting it because it was freely available and required no effort on my part). Point is... Flex is awesome at creating very engaging apps, really easily.
# Posted By Brendan | 6/25/07 8:59 PM
FYI, bug mentioned above should be fixed now.
# Posted By Brendan | 6/25/07 9:00 PM
Thanks for all the great responses so far!

As you may have guessed, I'm just getting familiar with Flex and what it can do, but I am very impressed so far.
A developer in my office is now just getting his feet wet for the first time today.
One site that tipped me off to the graphing potential, also had this "chart sampler".
http://demo.quietlyscheming.com/ChartSampler/app.h...

Does this sampler represent graphing ability that is more or less "native" to Flex?
By that I mean they can be created with just a bit of XML?
Or would the graph shows require quite a bit of custom
development to get the effects and capabilities demonstrated?

Thanks!
Brian
# Posted By Brian | 6/26/07 10:44 AM
Brendon, by the way, what might pursuade you to let me have a peek at the code before the conference?

Attending is not an option as I don't live in the USA, and it would also definately be great to have a look see sooner than later.

Thanks,
Brian
# Posted By Brian | 6/26/07 10:51 AM
If you can't wait for the code release, you case look at Brendan's presentation, on the silvafug web site.
You will build the chart by yourself, from his explanations, and it will help you also to improve your Flex skills.

Brendan, you're probably one of the best Flex evangelist around. Your demo really proves the quality of the Flex technology to a broader audience than developers and architects. I showed it to the business, and after that, we're going to put money and resources in Flex technology. Well done!

Thanks for contributing in making Web technologies better.

Cyril Gambis
# Posted By Cyril Gambis | 7/6/07 12:00 AM
It is great, could you please said where download the
source... please.
# Posted By nelson | 7/10/07 3:24 PM
Great job !!!

Do you know if there are other 360Flex events planned in US. I can't go to this one but I would certainly go to it if it did happen in NY.

I am really interested to the source code for my project. Ican't wait that you post source code on your blog!

good luck for your presentation
Pierre
# Posted By Pierre | 7/12/07 10:39 AM
I'm not sure what Tom and John have in the works for future events, but I know that they were trying for Denver (which didn't work out and became Seattle). But yeah, fire them an e-mail and say "Bring 360 to New York already"... I haven't been for a few years now... would be nice to make a trip there, so you've got my support! :-)
# Posted By Brendan Meutzner | 7/12/07 11:32 AM
Hey

I had a closer look to your (awsome) chart and I noticed that the tick and vertical gridline don't match exactly with corresponding points on the graph

I tried to create a simple version of the chart and I have the same bug, Do you have an idea of where this bug come from ?
# Posted By Pierre | 7/20/07 8:41 AM
I also observed the same alignment problem yesterday. The problem is due to the differences of starting & ending pts for line and column chart.
Line chart always starts plotting at the "zero" pt of the x-axis (i.e. the 1st plotting pt will be found along the y-axis line) but column chart does NOT plot on the "zero" pt.
Similar observation found for the ending pt. Thus if you observe closely, the column chart appear squeezed towards the middle of the screen when c.f. the line chart.
# Posted By Ammon | 7/31/07 1:26 AM
To fix the alignment issue, you can add an additional column series into the price chart:

<mx:ColumnSeries visible="false" maxColumnWidth=" -- same value as the volumn graphe --" xField="date" yField="close" />
# Posted By Ammon | 7/31/07 2:02 AM
Brendan,
7 more days to go... :) Waiting for it.
# Posted By Jaga | 8/6/07 4:22 PM
Hi there, the data shown on the main view does not match what is in the small slider view. In your initial app that you did in 45 mins it does but not in this one ? Or am I missing something, which is probably what's going on !
# Posted By mark | 8/10/07 11:01 AM
@Mark

Yeah, it's not going to be exact. The measurement for the divided boxes is based on the ratio of datapoints to width of graph. The boundary values in the top right that get updated on drag are 100% accurate to what is shown in the top view, but it's pretty tough to get those divided boxes to be perfect. A small price to pay... no? But that's a good point to bring up, and maybe in the future (or if somebody else wants to take a crack) I'll look at a better solution for that. Code's getting posted on Monday!
# Posted By Brendan Meutzner | 8/10/07 7:17 PM
Hi Brendan,

Its Monday, Waiting for the code!!! :) When are you posting it?
# Posted By Jaga | 8/13/07 7:37 PM
Hello,

i am looking for the way to render a chart like seen on http://app.lightstreamer.com/DojoDemo/ .
i want to give the horizontal axis a definite timearea, eg. 09.00 to 16.45 and let the real time stockquote tick in realtime. the chartarea should fill up more and more from left to right.

the realtime data is solved also filling up the chart, but for now there is always the complete charting area used by the data. i didn“t found something useful in the documentation how to solve this.

i would be glad, if anybody has an idea or tip for me...

thanks
uwe
# Posted By Uwe | 8/16/07 12:46 PM
awsome!!!

congrat !!!

possible to download the source code ? :)
# Posted By Luciano | 8/28/07 1:21 PM
Source is available here:

http://www.meutzner.com/blog/attachments/360/Flex_...

Just right click to view source...
# Posted By Brendan | 8/30/07 5:32 PM
Wow! I'm very impressed. You really have some serious skills. I just wanted to take the time to say, "thank you" for creating this and sharing the souce codes for free. You rock!
# Posted By Tony | 9/10/07 9:07 PM
"So" I have listed to people begin sentences with "so" but this is the first time I have read someone type a sentence beginning with "So".

"So what?" you ask. So, it wastes time, makes people appear less intelligent than they are and is not something I want your kids to grow up hearing for those reasons.

Oddly enough, I have a blog entry (link above) that speaks to this very (wrong) mostly Northern California phenomena.
# Posted By Sam | 10/1/07 9:58 PM
"listed" > "listened"
# Posted By Sam | 10/1/07 9:59 PM
Amazing Chart... I wonder if you could do a similar implementation
but use plot series for the Large and Low bands (still including volume)...
Make it into a Timeline like http://simile.mit.edu/timeline/... It would work great for all sort of things like Blogs, Financial Data. Quite the challenge but I would love to see
it and know that I would totally use it. And if you really into charting,
I would love to see microcharting done in Flex as well like http://www.bonavistasystems.com/OnlineDemoReports...., but interactive
# Posted By Seth | 10/3/07 6:58 PM
Hi Brendan ,

This is really a great work. I like it. & thanks for opening the source...
I do not know much about the Flex. Just a question - What is requirement on the web server to deploy this kind of Charts?

Your feedback is appreciated. Thanks in advance.

-Deepak
# Posted By Deepak | 10/4/07 9:04 PM
@Deepak

Any web server will do as it just serves up the compiled swf file. The swf file then runs in the browser's flash player.

-Tom
# Posted By Tom Ortega | 10/4/07 9:34 PM
Thanks a lot for the reply!
# Posted By Deepak | 10/5/07 12:28 AM
Brendan,

I found the Charting components you have used in your code is not part of free Flex SDK.
Does it need to be purchase separately?

Thanks,
Deepak
# Posted By Deepak | 10/5/07 6:22 PM
Yes, the Charting components are sold seperately and not part of the SDK.
# Posted By Thijs | 10/18/07 2:26 PM
Hi

Does anyone figure out any solution or workaround on the bug in aligning the Slider thumb and divider box?

Thankd,
Deepak
# Posted By Deepak | 10/27/07 8:15 PM
I salute you for providing this sweet custom chart. It inspired me to create this custom chart http://tomgutz.wordpress.com/2007/12/17/flex-custo...

The only thing I don't want about the flex charting is that when the horizontal Axis minimum range you have is some where in between two points such that one is not within the view, which means the point is dropped as well as the line connecting it with the visible point.
# Posted By tomgutz | 12/16/07 9:38 PM
A gr8 work.
It was strange when I tried using hard coded ArrayCollection instead of populating them with HTTP service request .
It didnt showed nything !!
I m wondering what could be wrong ? Has ny one tried smthng similar ?
I populated an arraycollection as :
////////////////
(A)
var tmpDataArray:Array = new Array();
tmpDataArray.push({date:2006-06-02,
open:38.68,
high:38.85,
low:38.46,
close:38.72,
volume:6657600});
tmpDataArray.push({date:2006-06-03,
open:48.68,
high:48.85,
low:48.46,
close:48.72,
volume:6657600});
var tmpData:ArrayCollection = new ArrayCollection(tmpDataArray) ;
/////////////////
(B)
var tmpData:ArrayCollection = event.result.root.data;
What is the difference between A & B ? B works but not A ,what cud go wrong ?
Ny help please ?
# Posted By Sumit | 3/17/08 5:14 AM
Brendan,

This is great stuff. Thanks for sharing.

Do you have plans to update the code for Flex 3?

Gilbert
# Posted By Gilbert | 4/16/08 2:23 PM
To use it with Flex 3 just edit Flex_Finance_StepX.mxml and change the line 594 to :

if (i != 0)
{
   mainChart.series[0].getChildAt(i + 1).showRenderer(false);
   mainChartVolume.series[0].getChildAt(i).showRenderer(false);
}

And it should work , work for me for Adobe Flex Builder 3
# Posted By Christian Wagner | 5/5/08 4:25 AM
This looks great. I'm building an open source database for a local non-profit environmental group to handle their field science data. I'm using your basic range selector on a data view webpage so volunteer data monitors (and anyone else interested in it) can see, compare and play(!) with the data at their sites. It'll be great to be able incorporate these new added features in the near future.
# Posted By rc helicopter | 5/8/08 7:05 PM
This looks great. I'm building an open source database for a local non-profit environmental group to handle their field science data. I'm using your basic range selector on a data view webpage so volunteer data monitors (and anyone else interested in it) can see, compare and play(!) with the data at their sites. It'll be great to be able incorporate these new added features in the near future.
[url=http://www.flashlightcool.com/]Tactical Flashlight[/url]
[url=http://www.flashlightcool.com/]Flashlight[/url]
[url=http://www.flashlightcool.com/]Led Flashlight[/url]
# Posted By Tactical Flashlight | 5/13/08 7:10 PM
BlogCFC was created by Raymond Camden. This blog is running version 5.005.