mr_interweb
Members-
Content count
4 -
Joined
-
Last visited
About mr_interweb
-
Rank
Forum Newbie
-
Retrieving point data from a 2D line chart into Flash's main timeline
mr_interweb replied to mr_interweb's topic in General usage
I was able to get access to the data points I was after. I posted my code in the thread: http://www.fusioncharts.com/forum/Topic244-28-1.aspx Thank you for your help. -
Is there an onLoad event to know when the graph finished rendering?
mr_interweb replied to kappuz's topic in General usage
I have a solution to your problem. :cool: I started by trying to predict when the chart would be rendered with the undocumented flash function setTimeout, but realized that this would lead to many problems down the road. Unknowns like HTTP XML loading, server load and response times, client CPU, and other variables are out of your control. I would recommend using setInterval approach to check to see if a known movie clip has been rendered. This is how I accomplished running something after render was complete: // Due to the fact that Flash has a horrible XPath implementation, // I am using X Factor Studio's very nice XPath class. Highly recommended. // http://xfactorstudio.com function setHandlers(){ // set handlers for Anchor points var datasets:Array = XPath.selectNodes(dataSet.firstChild, '/chart/dataset'); for(var i:Number = 1; i <= datasets.length; i++){ var set_arr:Array = XPath.selectNodes(datasets[i - 1], 'set'); for(var j:Number = 1; j <= set_arr.length; j++){ trace("_level0.ChartHolder_0.Chart.Anchor_"+i+"_"+j); _level0.ChartHolder_0.Chart["Anchor_"+i+"_"+j].onRollOver = function(){ trace("You just rolled over me: "+this._name); } } } } function isRendered(){ // Goal: test if XML is loaded. // test if last Anchor point has been added to the Chart trace("isRendered called"); if(dataSet.loaded){ // get the array of datasets from our XML var sets:Array = XPath.selectNodes(dataSet.firstChild, '/chart/dataset'); // get the last dataset's set nodes var lastSet:Array = XPath.selectNodes(dataSet.firstChild, '/chart/dataset[last()]/set'); // I will test to see if the last expected Anchor has been drawn // example _level0.ChartHolder_0.Chart.Anchor_1_12 if(_level0.ChartHolder_0.Chart["Anchor_"+(sets.length)+"_"+(lastSet.length)] != undefined){ clearInterval(my_interval); // clear the interval isRendered test setHandlers(); } } } var my_interval:Number = setInterval(isRendered, 250); // test isRendered every 1/4 second -
Retrieving point data from a 2D line chart into Flash's main timeline
mr_interweb replied to mr_interweb's topic in General usage
What I am trying to accomplish with Fusion Charts is a more interactive version of the charts. I am trying to find out where data points on a 2D line graph are in relation to _level0 so when a user clicks on a data point they can edit data associated with that point. I also was going to have one or more charts stacked vertically with a vertical bar that could be dragged across the chart(s). While the bar is dragged across the charts, the data values of the x-axis would update in text fields. Basically, my client wants the charts to have custom interactive functionality between an interface that I create and the charts. The only way I can think to implement this is to figure out how to let the _root of my flash application retrieve attribute data from the data points in the chart(s). -
Retrieving point data from a 2D line chart into Flash's main timeline
mr_interweb posted a topic in General usage
I am trying to determine if it is possible to have Flash access information in the charts from the main timeline of Flash. For example, I am trying to establish where the relative _x, _y coordinates of a chart's datasets' points are in relation to the _root's x:y axis. I am also trying to get the data values from points on the line using Actionscript. Obviously, I have the data set information from the XML but in order for me to associate where on the graph a user is clicking I need to be able to access the data points' attributes. I have access to the source code for Fusion Charts, but I am reluctant to change the base classes to get the functionality to access data point values from the charts. As far as I can tell, just about every method in the Fusion Charts is a private method, so even if I were to write a wrapper class with accessor methods, I am not sure if Actionscript would allow me to access those private methods and variables from a custom extended class. I am trying to avoid rewriting the source code, because my client would not be able to upgrade to a newer version of Fusion Charts. I hope that I am pursuing the wrong path and that there is some easier way to have Flash interact with data from the charts. Please tell me if there is something in the API to allow for Flash to determine plotted information on a chart. If not, can you give me any advice as to how the source code could be modified to accommodate accessors to data points?