I just updated FlexChart with a 'click' callback. You can now specify the name of a JavaScript function to be invoked when a data point on the chart is clicked. The function is passed the ID of the chart, the series label, and the x and y values for the point, in that order. Check the demo (which just pops an alert) to see it in action.
What is this good for, you ask? Everything that CFCHART's 'url' attribute was theoretically good for, except it's actually useful. If you wan CFCHART's behaviour, just have your callback do a window.location. For those of us that don't, you can use the parameters to AJAX in some related content to another section of the page, compute and inject a new descriptor do do "drill-down" within the same chart instance, or any number of other things. Lots of possibilities.
Hi Barney,
This project is almost ready for a home on riaforge. whaddya think?
DW
RIAForge doesn't have Trac. I've requested that feature, but was told that RIAForge already had the equivalent with the existing tools. So I host stuff myself. I could create shadow projects on RIAForge, but haven't gotten around to it. Maybe one of these days. ;)
Great!!
how can i use it with ajax
تØميل,
The demo is all JS-based. It illustrates the concepts of using the charting engine a JS-centric app pretty completely. At it's simplest, you just call setDescriptor or setDescriptorUrl.
OK, thanks barneyb
This is pretty amazing. Nice work! Would there be a way to set a chart to have a background image and a title, or would that require modifying the original .swf?
brian,
Not within the chart itself. However, the SWF is configured with a transparent background so you can underlay whatever you want and it'll show through. Same with a title, just add some HTML above the SWF. Neither of these things will come through when you use the built-in "export to image" functionality, but that may or may not matter.
I designed the component specifically for embedding in HTML/JS applications, where the application is laid out with HTML and controlled by JS. As such, it really only does the core charting stuff, assuming the application will take care of all the other stuff.
Barney,
So, with a little css and a lot of fiddling, I should be able to get a background image under the SWF and properly aligned. Thanks for the reply, and again, nice work!!
brian,
If you just wrap the SWF in a div and set background-image on that div you should be done without any fiddling beyond maybe some background-position.
One more quick question – is there a way to adjust the marker size? I have an application where the size of the dot is dependent upon a value not overtly shown in the graph, i.e. weighting by size. I tried adjusting the strokeWeight and even tried markerSize, though I didn't see an example of that anywhere in the XML.
Thanks!
brian,
There is not, and no support for BubbleChart either. Both strokeWeight and markerSize (if it existed) apply to a series as a whole, not a single data point anyway, so they wouldn't do what you want.
Barney,
It would work, had it been available, since I'm just plotting points in a triangular space (triangle background image). I found that for points, if I use the line type and put the same point twice, it worked well. I would have done separate series for each point, if they were to have different sized markers.
Anyway, thanks for your help and quick response. Happy New Year!