аЯрЁБс>ўџ  ўџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџRoot EntryџџџџџџџџpЊ|YЊrЯƒRASH Sм Х›РContentsџџџџџџџџџџџџuPage 1џџџџџџџџџџџџ pPage 2џџџџяљ§џџџџџџџџџџџџџџџџџџџ§џџџџџџџ ўџџџўџџџ §џџџ' !"#$%&n()*+,-./0123456789:;<=šџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџўџџџџџџџџџџџџџџџџџџџ^_`abcdefghцџџџџџџџџџџџџџџџџџџџџopqrstuvwxyz{|}~€Root EntryџџџџџџџџpЊ|YЊrЯƒRASHИ6ьRХ›РContentsџџџџџџџџџџџџgPage 1џџџџџџџџџџџџ pPage 2џџџџ?яљџџџџџџџџ§џџџ§џџџ џџџџ§џџџџџџџўџџџўџџџ џџџџџџџџџџџџџџџџ !"#$%&nџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ§џџџ@ABCDEFGHIJKLMNOPQRSTUVWYўџџџZ[\i^_`abcdefghцjklmopqrstuvwxyz{|}~€џџџџUџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџVWXYZ[\]^_`abcdefўџџџhijklmnopqrsўџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџSymbol 1џџџџ Symbol 2џџџџџџџџџџџџ‘Page 3џџџџџџџџџџџџŸЇPage 4џџџџ]џџџџ      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJўџџџLMNOPQRSTtџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџўџџџvwxyz{|}~€џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџSymbol 1џџџџ Symbol 2џџџџџџџџџџџџ‘Page 3џџџџџџџџџџџџKЇPage 4џџџџ]Symbol 3 џџџџ{Symbol 4џџџџџџџџџџџџ*џџџџџџџџџџџџџџџџџџџџџџџџўџџџ  ўџџџўџџџўџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџCPicPageџџ CPicLayerџџ CPicFrame€€џџџ?џџxT€џџ CPicSpriteњьџџЗњџџ њьџџЗњџџdџM MovLoaderBg€ќџџђјџџ ќџџђјџџdџОT MovEmbedText€€џџџ?џџsm€€ Physical Objectsџџџџ™3Ьџ€€€€џџџ?џџОf€€€џџџ?џџ FStartLoadлC€€€џџџ?џџFLoadingТW€€€џџџ?џџ FLoadingCheckF€€€џџџ?џџFXMLLoadAX€€€џџџ?џџ FXMLLoading+]€€€џџџ?џџ FXMLCheckŒc€€€џџџ?џџFXMLDoneњ€€ LabelsџџџџOџOџ€€€€џџџ?џџ0oџЃ//In this frame, we do the following: /* 1. Configure the movie for dynamic re-sizing 2. Configure the movie for multi-lingual characters */ //Initialization Actions //Set the properties of Stage to enable dynamic re-sizing Stage.scaleMode = "noScale"; Stage.align = "TL"; //Multi-lingual Feature /* To include or load XML data files that are not Unicode-encoded, we set system.useCodepage to true. The Flash Player will now interpret the XML file using the traditional code page of the operating system running the Flash Player. This is generally CP1252 for an English Windows operating system and Shift-JIS for a Japanese operating system. */ System.useCodePage = true; €€€џџџ?џџRџ0&//In this frame, we do the following things: /* 1. Get the chart to load the XML Data. For this, we'll first have to filter the data URL source that has been specified. 2. Create the pre-loader init scripts */ //--------------------------------// //** Load XML Data Document **// //--------------------------------// // :Explanation: Ways to load the XML data /* Here, we'll load the XML document into the previously created temporary XML object (_global.TxmlDataDoc) (declared in Layer Functions/Constants > Frame 1). Data can be provided to FusionCharts in 2 ways: 1. dataXML way - The whole XML data is present in the HTML Page (Containing FusionCharts) - sort of an XML Island. 2. dataURL way - Only a URI (Uniform Resource Identifier) is provided to FusionCharts. The data source for this XML Data has been provided to us using the OBJECT/EMBED Method. Now, it's the job of FusionCharts to request XML data from that particular source. The parameter will be contained in _root.dataurl (data source URL) or _root.dataXML (full XML data). So, first check what we've been provided with - the complete XML Data or just the data source URI We'll first Declare some Local variables that we'll be using: - LboolIsURLProvided is a boolean variable that would maintain the flag indicating whether the data has been provided in URL format or dataXML format. By default, we assume that we have been provided the dataURL */ var LboolIsURLProvided = true; //We copy the contents of _root.dataurl into a variable called LstrXMLDocURL var LstrXMLDocURL = _root.dataURL; // :Explanation: How the source of data is determined? /* We now check whether it was the data url that was provided to us or the complete data xml. The check is based on the length of dataURL. If it's a 0 length string, it means we're either provided with dataXML or nothing has been provided. If nothing has been provided, we assume the dataURL to be a default data file (data.xml). */ if (LstrXMLDocURL.length<1) { //Since the length of dataURL is less than 1 //We haven't been provided with dataURL if (_root.dataXml == "" || _root.dataXml == null || _root.dataXml == undefined) { //Now, if we haven't been provided with dataXML also. //We set the data URI to a default data file (as set in Layer Functions/Constants > Frame 1) LstrXMLDocURL = _defaultDataFile; } else { //We have been provided with the full XML document //So, we re-set the flag LboolIsURLProvided = false; } } // :Explanation: In case of dataURL, how the URL is filtered? /* Now, if dataURL has been provided to us, we need to filter it before we can invoke the XML request. The filter involves the following jobs: 1. Convert the URL Encoded dataURL back to normal form. 2. If not working in local mode, we'll append the time at the end of the dataURL so that a new XML document is sent by the server for each request and the XML data is not cached. Suppose, the dataURL is data.asp, so we'll convert it to data.asp?curr=43743 so that we can fool the server and get new data every time we request for it. */ //** Step 1 of Filtering process: Unescape (HTML Encode the URL Encoded variables)// if (LboolIsURLProvided == true) { //Now, if there are *s present in the URL, we convert it to a normal link (backward version compatibility) if (LstrXMLDocURL.indexOf("*") != -1) { //Get the URL with * xmlDocUrl = new String(LstrXMLDocURL); //Use the split function of array to split the URL wherever a * is found var arrUrl = new Array(); arrUrl = xmlDocUrl.split("*"); var finUrl = ""; //Now, join them depending on their position for (loopvar=0; loopvar Frame 1), we will add a continuously updating data (number of milliseconds that have elapsed since the movie started playing) at the end of the dataURL. This will result in having a new dataURL every time we need to get the data from the server and therefore the server will be "fooled" thereby passing on updated data each time. We add the time in the format ?curr=xxxxx or &curr=xxxxx depending on whether there's already a ? present in the dataURL or not. That is, if filtered dataURL is data.asp?param1=value1, then we add curr as data.asp?param1=value1&curr=xxxxx. However, if dataURL is simply data.asp, we add curr as data.asp?curr=xxxxx */ LstrFilteredURL = LstrXMLDocURL; if (LboolIsURLProvided == true && _isOnline) { //Do this only if we are dealing with dataURL and we are working online if (LstrFilteredURL.indexOf("?") == -1) { //If a ? exists in the data url LstrFilteredURL = LstrFilteredURL+"?curr="+getTimer(); } else { //If a ? does NOT exist in the data url LstrFilteredURL = LstrFilteredURL+"&curr="+getTimer(); } } //We now have a filtered data URL in the variable LstrFilteredURL /* We'll now load the XML document based on either dataURL or dataXML - whatever has been supplied to us. */ if (LboolIsURLProvided == true) { //If we ha‚џџџџ†џџџџџџџџџџџџ‡ˆ‰Š‹ŒŽ‘’ўџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџœXžоџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџпрсщџџџџџџџџџџџџџџџџчшўџџџъыьэюя№ёђѓєњџџџџџџџџџџџџџџџџџџџџћќ§ўџџџCPicPageџџ CPicLayerџџ CPicFrame€€џџџ?џџ#H€€€џџџ?џџJavaScriptHandlerОџХ//This frame responds to JavaScript data. //First, we check if new data has been actually supplied if (_root.isNewData == "1" && (_root.newData != undefined && _root.newData != null)) { //Means new data has been supplied //Get the new data _global.TxmlDataDoc = new XML(); _global.TxmlDataDoc.parseXML(_root.newData); //Now, clear the chart objects already rendered (with depth starting from this.Params.chartStartLevel to FCLastLevel) for (tObj in this) { //Get a reference to all objects present in the current timeline var obj = this[tObj]; //If the object is a movieClip and it's depth is between our required depths //(typeof (obj) == "movieclip") && if ((obj.getDepth()<=_global._FCLastLevel) && (obj.getDepth()>=FCChart.Params.chartStartLevel)) { obj.removeMovieClip(); deleteText(obj.getDepth()); } delete obj; } //Re-set the global counter _global._FCLastLevel = FCChart.Params.chartStartLevel; //Delete FCChart delete FCChart; //If the data is not valid - show error msg and stop if (_global.TxmlDataDoc.status != 0) { //However if the XML Data is not well-formed, Show an error createText(1, "Invalid XML Data", _chartHorCenter, _chartVerCenter, "Verdana", "10", LPBarTextColor, false, "center", "ve been supplied with dataURL _global.TxmlDataDoc.load(LstrFilteredURL); //We also specify the onLoad event handler for the XML document //That is the control will switch to xmlLoaded() function once the data //has been downloaded into the clients machine _global.TxmlDataDoc.onLoad = xmlLoaded; } else { //If the complete data has been specified as dataML var LstrDirectXml = new String(_root.dataXml); _global.TxmlDataDoc.parseXML(LstrDirectXml); } //The data is now being loaded into _global.TxmlDataDoc //So, we move onto the movie preloader part //--------------------------------// //** Movie Preloader BEGIN **// //--------------------------------// //Chart Pre-loader Initialization scripts //Initialize local variables relating to the pre-loader var LPBarHeight, LPBarWidth, LPBarBorderColor, LPBarBgColor, LPBarTextColor; //Define Pre-loader Progress bar Height LPBarHeight = Number(getFirstValue(_root.PBarHeight, "15")); //Calculate the width of the progress bar // :Explanation: How the width of the progress bar is being calculated? /* Basically, what we are aiming to do here is - Center align the progress bar elements with respect to the chart size. So, the width of the progress bar is set in such a way that is the chart width is greater than 200 pixels, the progress bar width will be 150 pixels. However, if the chart width is less than 200 pixels, then the progress bar width will be 25 pixels less than the chart width. */ LPBarWidth = (_chartWidth>200) ? 150 : (_chartWidth-25); /* We also give the user an option to strong-enforce his own progress bar width value in case he wants something on his own. */ LPBarWidth = getFirstValue(_root.PBarWidth, LPBarWidth); /* We let the user specify border color, background color, and text color of the progress bar in case he wants to change the default values We also let him specify the text that would appear while the data is loading */ LPBarBorderColor = getFirstValue(_root.PBarBorderColor, "E2E2E2"); LPBarBgColor = getFirstValue(_root.PBarBgColor, "E2E2E2"); LPBarTextColor = getFirstValue(_root.PBarTextColor, "666666"); LPBarLoadingText = getFirstValue(unescape(_root.PBarLoadingText), "Loading Chart. Please Wait"); LXMLLoadingText = getFirstValue(unescape(_root.XMLLoadingText), "Retrieving Data. Please Wait"); //We now draw the border of the progress bar at the center of the stage createEmptyMovieClip("ASMovPBorder", 10); mcPBorder = eval("ASMovPBorder"); //Set the line style of the border mcPBorder.lineStyle(1, parseInt(LPBarBorderColor, 16), 100); mcPBorder.moveTo(_chartHorCenter-(LPBarWidth/2), _chartVerCenter-(LPBarHeight/2)); mcPBorder.lineTo(_chartHorCenter+(LPBarWidth/2), _chartVerCenter-(LPBarHeight/2)); mcPBorder.lineTo(_chartHorCenter+(LPBarWidth/2), _chartVerCenter+(LPBarHeight/2)); mcPBorder.lineTo(_chartHorCenter-(LPBarWidth/2), _chartVerCenter+(LPBarHeight/2)); mcPBorder.lineTo(_chartHorCenter-(LPBarWidth/2), _chartVerCenter-(LPBarHeight/2)); delete mcPBorder; /* We now set the x, y co-ordinates and width and height of MovLoaderBg Clip MovLoaderBg movie clip instance is the movie clip which would act as the "filler" for the progress bar. That is to say, it would change it's own width representing the percentage of movie loaded. */ MovLoaderBg._x = _chartHorCenter-(LPBarWidth/2); MovLoaderBg._y = _chartVerCenter+(LPBarHeight/2); /* We set the initial width to 0 - to represent that the movie has just started to load. The height of the bar would be the same as that of the progress bar border. We also re-set the color of the bar. */ MovLoaderBg._width = 0; MovLoaderBg._height = LPBarHeight; clrMovLoaderBg = new Color("MovLoaderBg"); clrMovLoaderBg.setRGB(parseInt(LPBarBgColor, 16)); /* We now create a text message to show the loading text. */ createText(1, LPBarLoadingText, _chartHorCenter, _chartVerCenter-(LPBarHeight/2), "Verdana", "10", LPBarTextColor, false, "center", "left", null, false); //*** Pre-loader start ***// var bytesLoaded, bytesTotal; //We get the total size of the movie in bytes. bytesTotal = this.getBytesTotal(); //We also get the size of thcenter", null, false); //Stop the control of the movie gotoAndStop("ErrorStop"); } else { //Else, goto and play the first frame - i.e., re-render the chart gotoAndPlay(1); } } else { //Else- just stay normal stop(); } €€€џџџ?џџ ErrorStop„g//Just stop stop();€€ JavaScript HandlerџџџџOџOџ€€€€џџџ?џџсJџ[/* This frame is invoked, when the chart .swf file has been downloaded onto the end user's machine and the XML file has also been downloaded. In this frame, we'll: 1. Show a rendering chart message 2. Load the Chart Class 3. Instantiate an object representing the Chart Class */ //Show the rendering chart message //Get the default value/value set by the user LNoDataText = getFirstValue(unescape(_root.ChartNoDataText), "No data to display."); //Next, we instantiate an object representing the chart class FCChart = new Chart(); //Acquire the data from the global XML document FCChart.acquireData(); //Parse the data into the Chart arrays and variables. FCChart.parseData(); //Now, if there is no data to display if (FCChart.Params.num == 0) { //Display the no data text createText(1, LNoDataText, _chartHorCenter, _chartVerCenter, "Verdana", "10", LPBarTextColor, false, "center", "left", null, false); //And stop stop(); } else { //Now, if we've data to display then carry on. //Calculate the co-ordinates of various elements on the chart FCChart.calculatePoints(); //Move to the next frame. play(); } €€€џџџ?џџl=џ?/* This frame is a part of the chart rendering process. It is invoked when the chart class has been loaded, an object representing it initialized and XML data has been parsed. Here, we do the following: 1. Hide the rendering chart textbox. 2. Render the various Chart elements */ //First, we hide the "Rendering Chart" textbox deleteText(1); //Also, delete the size calculate movie clip deleteText(25001); //Render the background FCChart.drawBackground(); //Load Bacgkround swf FCChart.loadBgSWF(); //Draw the canvas FCChart.drawCanvas(); //Draw the grid background (alternate) FCChart.drawGridBg(); //Draw the divisional lines FCChart.drawDivLines(); //Zero Plane FCChart.drawZeroPlane(); //Render the underlay trend lines FCChart.drawTrendLines(0); //Set the labels on the chart FCChart.setLabels(); //===============================// //Create the chart now var dsLineLevel; var dsYPosMax, dsYPosMin; dsYPosMax = FCChart.data[1].yPos; dsYPosMin = FCChart.data[1].yPos; //Create a container for the dataset dsLineLevel = FCChart.getLevel(); //Create the main holder createEmptyMovieClip("ASMov_LC_MainHolder_"+dsLineLevel, dsLineLevel); mcLCMainHolder = eval("ASMov_LC_MainHolder_"+dsLineLevel); //Create the subHolder mcLCMainHolder.createEmptyMovieClip("ASMov_LC_SubHolder_"+dsLineLevel, 1); mcLCSubHolder = mcLCMainHolder["ASMov_LC_SubHolder_"+dsLineLevel]; //Create the Chart Holder mcLCSubHolder.createEmptyMovieClip("ASMov_LC_ChartHolder_"+dsLineLevel, 2); mcLCChartHolder = mcLCSubHolder["ASMov_LC_ChartHolder_"+dsLineLevel]; for (i=1; idsYPosMax) { dsYPosMax = FCChart.data[i].yPos; } if (FCChart.data[i].yPos1 || FCChart.data[i-1].showDataSet == 0) { mcLCChartHolder.lineStyle(0, 0xffffff, 0); } //Now, if the border is to be shown - set the proper line style if (FCChart.Params.showAreaBorder == 1) { mcLCChartHolder.lineStyle(FCChart.Params.areaBorderThickness, parseInt(FCChart.Params.areaBorderColor, 16), 100); } //Set fill properties mcLCChartHolder.beginFill(parseInt(FCChart.data[i].color, 16), 100); //Draw the top line mcLCChartHolder.lineTo(FCChart.data[i+1].xPos, FCChart.data[i+1].yPos); if (FCChart.data[i+2].showDataSet == 0) { //If it's an empty data set, we need to show the right border. mcLCChartHolder.lineStyle(FCChart.Params.areaBorderThickness, parseInt(FCChart.Params.areaBorderColor, 16), 100); } else { //Else, pen up mcLCChartHolder.lineStyle(0, 0xffffff, 0); } //Draw the fill lines mcLCChartHolder.lineTo(FCChart.data[i+1].xPos, FCChart.Params.zeroPlanePos); //Again, pen up mcLCChartHolder.lineStyle(0, 0xffffff, 0); mcLCChartHolder.lineTo(FCChart.data[i].xPos, FCChart.Params.zeroPlanePos); if (FCChart.data[i-1].showDataSet == 0) { //If it's an empty data set, we need to show the right border. mcLCChartHolder.lineStyle(FCChart.Params.areaBorderThickness, parseInt(FCChart.Params.areaBorderColor, 16), 100); } mcLCChartHolder.lineTo(FCChart.data[i].xPos, FCChart.data[i].yPos); } } //Set the alpha properties mcLCChartHolder._alpha = FCChart.Params.areaAlpha; //Create the animation effect. mcLCChartHolder._x = 0; mcLCChartHolder._y = 0; mcLCShadowHolder._x = 0; mcLCShadowHolder._y = 0; mcLCSubHolder._x = -((FCChart.Objects.Canvas.xPos)+(FCChart.Objects.Canvas.width/2)); mcLCSubHolder._y = -((dsYPosMax+dsYPosMin)/2); mcLCMainHolder._x = (FCChart.Objects.Canvas.xPos)+(FCChart.Objects.Canvas.width/2); mcLCMainHolder._y = (dsYPosMax+dsYPosMin)/2; //Exception: If the line to draw is a straight line, then no point animating the yScale if ((dsYPosMax-dsYPosMin) == 0) { mcLCMainHolder._yscale = 100; } else { mcLCMainHolder._yscale = 0; } //Xscale set to 0 for animation mcLCMainHolder._xscale = 0; //If animation is not required if (FCChart.Params.animation == 0) { mcLCMainHolder._xscale = 100; mcLCMainHolder._yscale = 100; } mcLCMainHolder.dataSet = i; mcLCMainHolder.onEnterFrame = function() { if (this._xscale<100) { this._xscale += 2; } else { if (this._yscale<100) { this._yscale += 2; } else { //Draw the anchors FCChart.drawAnchors(); //Render the value text boxes FCChart.drawValues(); //Render the *raw* hover caption FCChart.renderHoverCap(); //Render the overlay trend lines FCChart.drawTrendLines(1); //Delete onEnterFrame event delete this.onEnterFrame; } } }; //Delete objects delete mcLCChartHolder; delete mcLCSubHolder; delete mcLCMainHolder; //Draw the canvas border FCChart.drawCanvasBorder(); stop(); €€ ActionsџџџџџOOџ€€€€џџџ?џџж,џув//** Chart Class **// //Chart is the base object on which the whole charting model will be based _global.Chart = function() { //** Initialize the objects within this class **// //Chart.xmlData represents the complete XML data supplied to FusionCharts this.xmlData = new XML(); //Chart.data is an array which would be used to store data this.data = new Array(); //Chart.Params would be used to store the graph properties this.Params = new Object(); //Chart.Constants would be used to store the graph constants this.Constants = new Object(); //Chart.TrendLines would be used to store the list of trendlines to be drawn on the graph this.TrendLines = new Array(); //Chart.DivLines would be used to store the div lines this.DivLines = new Array(); //Chart.Objects would be used to store the co-ordinates of a number of objects this.Objects = new Array(); //** Set the data/properties of a few objects **/ //Params.num indicates the number of data elements in each set this.Params.num = 0; //Params.numTrendLines indicates the number of trend lines for the graph this.Params.numTrendLines = 0; //A counter to keep count of the number of textboxes whose names are to be shown this.Params.numWithNames = 0; this.Params.negativeNumPresent = false; this.Params.showZeroPlane = false; this.Params.zeroPlanePos = 0; //Some constants to be used throughout the movie this.Constants.catTextRotationAngle = Number(getFirstValue(_root.catTextRotationAngle, "270")); this.Constants.calcTextXPos = Number(getFirstValue(_root.calcTextXPos, "-200")); this.Constants.calcTextYPos = Number(getFirstValue(_root.calcTextYPos, "-200")); }; //** Nested Objects **// /* Nested objects are sub-objects whose instance we'll later create and store in the instance of Chart Object. Basically, we are trying to group the data under various heads. */ Chart.dataItem = function(dataName, dataValue, dataColor, dataLink, dataAlpha, hoverText, showName) { //Chart.dataItem indicates an object which is going to contain the data //and other related details for a particular element this.name = dataName; this.value = dataValue; this.color = dataColor; this.link = dataLink; this.alpha = dataAlpha; this.hoverText = hoverText; this.showName = showName; //Based on alpha, set whether this data set will be displayed or not this.showDataSet = 1; if (dataAlpha == 0) { this.showDataSet = 0; } //xPos are dynamically calculated values //which will help us draw the on the stage. this.xPos = 0; this.yPos = 0; this.width = 0; this.height = 0; //Value tb position this.valueTbX = 0; this.valueTbY = 0; }; Chart.divLine = function(value, displayValue, showValue) { //Chart.divLine indicates a div line object //Properties set by the user this.value = value; this.displayValue = displayValue; this.showValue = showValue; //Internal properties this.startXPos = 0; this.endXPos = 0; this.startYPos = 0; this.endYPos = 0; }; Chart.trendLine = function(lineStartValue, lineEndValue, lineColor, lineDisplayValue, lineThickness, lineAlpha, lineShowOnTop, lineIsTrendZone) { //Chart.trendLine indicates a trend line object this.startValue = lineStartValue; this.endValue = lineEndValue; this.color = lineColor; this.displayValue = lineDisplayValue; this.thickness = lineThickness; this.alpha = lineAlpha; this.showOnTop = lineShowOnTop; this.isTrendZone = lineIsTrendZone; this.startXPos = 0; this.endXPos = 0; this.startYPos = 0; this.endYPos = 0; }; Chart.cObject = function(xPos, yPos, objHeight, objWidth) { //Chart.cObject represents an individual element on the chart this.xPos = xPos; this.yPos = yPos; this.height = objHeight; this.width = objWidth; }; //** Methods **// Chart.prototype.acquireData = function() { //This function acquires the data from the global XML object //into the Chart class this.xmlData = _global.TxmlDataDoc; //Delete the global object to free up memory resources delete _global.TxmlDataDoc; }; Chart.prototype.parseData = function() { //This function parses the XML data document, retrieves the //data and stores it into various arrays and objects of the Chart class //levelOneNodes gets reference to the first level nodes - i.e, and associates (if any) var levelOneNodes = this.xmlData.childNodes; //Iterate through each level one node to search for the graph node for (i=0; i<=levelOneNodes.length; i++) { //Check if the node name is Graph if (levelOneNodes[i].nodeName.toUpperCase() == "GRAPH") { //The current node is GRAPH node //So, extract the properties of the graph (which have been provided as attributes of the GRAPH node) //For each property, we also have a pre-set default value which would //be allotted only if the XML doesn't specify a value for the parameter //Background color of the chart this.Params.bgColor = forma‚ƒ†„…“‡ˆ‰Š‹ŒŽ‘’ўџџџ”•–—˜™ЁџџџџœXџџџџџџџџ тЂЃЄЅІЇЈЉЊЋЌ­ЎЏАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнџџџџџџџџџџџџџџџџуфхѕчшўџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџіїјљўџџџџџџџџџџџџџџџџџџџџџџџџџџџџџCPicPageџџ CPicLayerџџ CPicFrame€€џџџ?џџ*]€€€џџџ?џџJavaScriptHandlerіCџХ//This frame responds to JavaScript data. //First, we check if new data has been actually supplied if (_root.isNewData == "1" && (_root.newData != undefined && _root.newData != null)) { //Means new data has been supplied //Get the new data _global.TxmlDataDoc = new XML(); _global.TxmlDataDoc.parseXML(_root.newData); //Now, clear the chart objects already rendered (with depth starting from this.Params.chartStartLevel to FCLastLevel) for (tObj in this) { //Get a reference to all objects present in the current timeline var obj = this[tObj]; //If the object is a movieClip and it's depth is between our required depths //(typeof (obj) == "movieclip") && if ((obj.getDepth()<=_global._FCLastLevel) && (obj.getDepth()>=FCChart.Params.chartStartLevel)) { obj.removeMovieClip(); deleteText(obj.getDepth()); } delete obj; } //Re-set the global counter _global._FCLastLevel = FCChart.Params.chartStartLevel; //Delete FCChart delete FCChart; //If the data is not valid - show error msg and stop if (_global.TxmlDataDoc.status != 0) { //However if the XML Data is not well-formed, Show an error createText(1, "Invalid XML Data", _chartHorCenter, _chartVerCenter, "Verdana", "10", LPBarTextColor, false, "center", "center", null, false); //Stop the control of the movie gotoAndStop("ErrorStop"); } else { //Else, goto and play the first frame - i.e., re-render the chart gotoAndPlay(1); } } else { //Else- just stay normal stop(); } €€€џџџ?џџ ErrorStopW//Just stop stop();€€ JavaScript HandlerџџџџOџOџ€€€€џџџ?џџ­Xџ[/* This frame is invoked, when the chart .swf file has been downloaded onto the end user's machine and the XML file has also been downloaded. In this frame, we'll: 1. Show a rendering chart message 2. Load the Chart Class 3. Instantiate an object representing the Chart Class */ //Show the rendering chart message //Get the default value/value set by the user LNoDataText = getFirstValue(unescape(_root.ChartNoDataText), "No data to display."); //Next, we instantiate an object representing the chart class FCChart = new Chart(); //Acquire the data from the global XML document FCChart.acquireData(); //Parse the data into the Chart arrays and variables. FCChart.parseData(); //Now, if there is no data to display if (FCChart.Params.num == 0) { //Display the no data text createText(1, LNoDataText, _chartHorCenter, _chartVerCenter, "Verdana", "10", LPBarTextColor, false, "center", "left", null, false); //And stop stop(); } else { //Now, if we've data to display then carry on. //Calculate the co-ordinates of various elements on the chart FCChart.calculatePoints(); //Move to the next frame. play(); } €€€џџџ?џџЁ/џ?/* This frame is a part of the chart rendering process. It is invoked when the chart class has been loaded, an object representing it initialized and XML data has been parsed. Here, we do the following: 1. Hide the rendering chart textbox. 2. Render the various Chart elements */ //First, we hide the "Rendering Chart" textbox deleteText(1); //Also, delete the size calculate movie clip deleteText(25001); //Render the background FCChart.drawBackground(); //Load Bacgkround swf FCChart.loadBgSWF(); //Draw the canvas FCChart.drawCanvas(); //Draw the grid background (alternate) FCChart.drawGridBg(); //Draw the divisional lines FCChart.drawDivLines(); //Zero Plane FCChart.drawZeroPlane(); //Render the underlay trend lines FCChart.drawTrendLines(0); //Set the labels on the chart FCChart.setLabels(); //===============================// //Create the chart now var dsLineLevel; var dsYPosMax, dsYPosMin; dsYPosMax = FCChart.data[1].yPos; dsYPosMin = FCChart.data[1].yPos; //Create a container for the dataset dsLineLevel = FCChart.getLevel(); //Create the main holder createEmptyMovieClip("ASMov_LC_MainHolder_"+dsLineLevel, dsLineLevel); mcLCMainHolder = eval("ASMov_LC_MainHolder_"+dsLineLevel); //Create the subHolder mcLCMainHolder.createEmptyMovieClip("ASMov_LC_SubHolder_"+dsLineLevel, 1); mcLCSubHolder = mcLCMainHolder["ASMov_LC_SubHolder_"+dsLineLevel]; //Create the Chart Holder mcLCSubHolder.createEmptyMovieClip("ASMov_LC_ChartHolder_"+dsLineLevel, 2); mcLCChartHolder = mcLCSubHolder["ASMov_LC_ChartHolder_"+dsLineLevel]; for (i=1; idsYPosMax) { dsYPosMax = FCChart.data[i].yPos; } if (FCChart.data[i].yPos1 || FCChart.data[i-1].showDataSet == 0) { mcLCChartHolder.lineStyle(0, 0xffffff, 0); } //Now, if the border is to be shown - set the proper line style if (FCChart.Params.showAreaBorder == 1) { mcLCChartHolder.lineStyle(FCChart.Params.areaBorderThickness, parseInt(FCChart.Params.areaBorderColor, 16), 100); } //Set fill properties mcLCChartHolder.beginFill(parseInt(FCChart.data[i].color, 16), 100); //Draw the top line mcLCChartHolder.lineTo(FCChart.data[i+1].xPos, FCChart.data[i+1].yPos); if (FCChart.data[i+2].showDataSet == 0) { //If it's an empty data set, we need to show the right border. mcLCChartHolder.lineStyle(FCChart.Params.areaBorderThickness, parseInt(FCChart.Params.areaBorderColor, 16), 100); } else { //Else, pen up mcLCChartHolder.lineStyle(0, 0xffffff, 0); } //Draw the fill lines mcLCChartHolder.lineTo(FCChart.data[i+1].xPos, FCChart.Params.zeroPlanePos); //Again, pen up mcLCChartHolder.lineStyle(0, 0xffffff, 0); mcLCChartHolder.lineTo(FCChart.data[i].xPos, FCChart.Params.zeroPlanePos); if (FCChart.data[i-1].showDataSet == 0) { //If it's an empty data set, we need to show the right border. mcLCChartHolder.lineStyle(FCChart.Params.areaBorderThickness, parseInt(FCChart.Params.areaBorderColor, 16), 100); } mcLCChartHolder.lineTo(FCChart.data[i].xPos, FCChart.data[i].yPos); } } //Set the alpha properties mcLCChartHolder._alpha = FCChart.Params.areaAlpha; //Create the animation effect. mcLCChartHolder._x = 0; mcLCChartHolder._y = 0; mcLCShadowHolder._x = 0; mcLCShadowHolder._y = 0; mcLCSubHolder._x = -((FCChart.Objects.Canvas.xPos)+(FCChart.Objects.Canvas.width/2)); mcLCSubHolder._y = -((dsYPosMax+dsYPosMin)/2); mcLCMainHolder._x = (FCChart.Objects.Canvas.xPos)+(FCChart.Objects.Canvas.width/2); mcLCMainHolder._y = (dsYPosMax+dsYPosMin)/2; //Exception: If the line to draw is a straight line, then no point animating the yScale if ((dsYPosMax-dsYPosMin) == 0) { mcLCMainHolder._yscale = 100; } else { mcLCMainHolder._yscale = 0; } //Xscale set to 0 for animation mcLCMainHolder._xscale = 0; //If animation is not required if (FCChart.Params.animation == 0) { mcLCMainHolder._xscale = 100; mcLCMainHolder._yscale = 100; } mcLCMainHolder.dataSet = i; mcLCMainHolder.onEnterFrame = function() { if (this._xscale<100) { this._xscale += 2; } else { if (this._yscale<100) { this._yscale += 2; } else { //Draw the anchors FCChart.drawAnchors(); //Render the value text boxes FCChart.drawValues(); //Render the *raw* hover caption FCChart.renderHoverCap(); //Render the overlay trend lines FCChart.drawTrendLines(1); //Delete onEnterFrame event delete this.onEnterFrame; } } }; //Delete objects delete mcLCChartHolder; delete mcLCSubHolder; delete mcLCMainHolder; //Draw the canvas border FCChart.drawCanvasBorder(); stop(); €€ ActionsџџџџџOOџ€€€€џџџ?џџО1џув//** Chart Class **// //Chart is the base object on which the whole charting model will be based _global.Chart = function() { //** Initialize the objects within this class **// //Chart.xmlData represents the complete XML data supplied to FusionCharts this.xmlData = new XML(); //Chart.data is an array which would be used to store data this.data = new Array(); //Chart.Params would be used to store the graph properties this.Params = new Object(); //Chart.Constants would be used to store the graph constants this.Constants = new Object(); //Chart.TrendLines would be used to store the list of trendlines to be drawn on the graph this.TrendLines = new Array(); //Chart.DivLines would be used to store the div lines this.DivLines = new Array(); //Chart.Objects would be used to store the co-ordinates of a number of objects this.Objects = new Array(); //** Set the data/properties of a few objects **/ //Params.num indicates the number of data elements in each set this.Params.num = 0; //Params.numTrendLines indicates the number of trend lines for the graph this.Params.numTrendLines = 0; //A counter to keep count of the number of textboxes whose names are to be shown this.Params.numWithNames = 0; this.Params.negativeNumPresent = false; this.Params.showZeroPlane = false; this.Params.zeroPlanePos = 0; //Some constants to be used throughout the movie this.Constants.catTextRotationAngle = Number(getFirstValue(_root.catTextRotationAngle, "270")); this.Constants.calcTextXPos = Number(getFirstValue(_root.calcTextXPos, "-200")); this.Constants.calcTextYPos = Number(getFirstValue(_root.calcTextYPos, "-200")); }; //** Nested Objects **// /* Nested objects are sub-objects whose instance we'll later create and store in the instance of Chart Object. Basically, we are trying to group the data under various heads. */ Chart.dataItem = function(dataName, dataValue, dataColor, dataLink, dataAlpha, hoverText, showName) { //Chart.dataItem indicates an object which is going to contain the data //and other related details for a particular element this.name = dataName; this.value = dataValue; this.color = dataColor; this.link = dataLink; this.alpha = dataAlpha; this.hoverText = hoverText; this.showName = showName; //Based on alpha, set whether this data set will be displayed or not this.showDataSet = 1; if (dataAlpha == 0) { this.showDataSet = 0; } //xPos are dynamically calculated values //which will help us draw the on the stage. this.xPos = 0; this.yPos = 0; this.width = 0; this.height = 0; //Value tb position this.valueTbX = 0; this.valueTbY = 0; }; Chart.divLine = function(value, displayValue, showValue) { //Chart.divLine indicates a div line object //Properties set by the user this.value = value; this.displayValue = displayValue; this.showValue = showValue; //Internal properties this.startXPos = 0; this.endXPos = 0; this.startYPos = 0; this.endYPos = 0; }; Chart.trendLine = function(lineStartValue, lineEndValue, lineColor, lineDisplayValue, lineThickness, lineAlpha, lineShowOnTop, lineIsTrendZone) { //Chart.trendLine indicates a trend line object this.startValue = lineStartValue; this.endValue = lineEndValue; this.color = lineColor; this.displayValue = lineDisplayValue; this.thickness = lineThickness; this.alpha = lineAlpha; this.showOnTop = lineShowOnTop; this.isTrendZone = lineIsTrendZone; this.startXPos = 0; this.endXPos = 0; this.startYPos = 0; this.endYPos = 0; }; Chart.cObject = function(xPos, yPos, objHeight, objWidth) { //Chart.cObject represents an individual element on the chart this.xPos = xPos; this.yPos = yPos; this.height = objHeight; this.width = objWidth; }; //** Methods **// Chart.prototype.acquireData = function() { //This function acquires the data from the global XML object //into the Chart class this.xmlData = _global.TxmlDataDoc; //Delete the global object to free up memory resources delete _global.TxmlDataDoc; }; Chart.prototype.parseData = function() { //This function parses the XML data document, retrieves the //data and stores it into various arrays and objects of the Chart class //levelOneNodes gets reference to the first level nodes - i.e, and associates (if any) var levelOneNodes = this.xmlData.childNodes; //Iterate through each level one node to searchџџџ?џџ>€€ Layer 1џџџџO€џџ€€џџџCPicPageџџ CPicLayerџџ CPicFrame€€џџџ?џџFA#initclip 1 #include "../CodeBase/FCProgressBar.as" #endinitclip €€ ClassџџџџO€џџ€€chartHorCenter, _chartVerCenter, "Verdana", "10", LPBarTextColor, false, "center", "ce for the graph node for (i=0; i<=levelOneNodes.length; i++) { //Check if the node name is Graph if (levelOneNodes[i].nodeName.toUpperCase() == "GRAPH") { //The current node is GRAPH node //So, extract the properties of the graph (which have been provided as attributes of the GRAPH node) //For each property, we also have a pre-set default value which would //be allotted only if the XML doesn't specify a value for the parameter //Background color of the chart this.Params.bgColor = formatHexColor(getFirstValue(levelOneNodes[i].attributes.bgColor, "FFFFFF")); this.Params.bgAlpha = Number(getFirstValue(levelOneNodes[i].attributes.bgAlpha, "100")); //Background swf this.Params.bgSWF = levelOneNodes[i].attributes.bgSWF; //Chart Title this.Params.caption = getFirstValue(levelOneNodes[i].attributes.caption, ""); this.Params.subCaption = getFirstValue(levelOneNodes[i].attributes.subCaption, ""); //If no caption has been provided, set an appropriate flag //Default flag this.Params.showCaption = 1; if (this.Params.caption == "") { this.Params.showCaption = 0; } this.Params.showSubCaption = 1; if (this.Params.subCaption == "") { this.Params.showSubCaption = 0; } //X and Y Axis Name this.Params.xAxisName = getFirstValue(levelOneNodes[i].attributes.xAxisName, ""); this.Params.yAxisName = getFirstValue(levelOneNodes[i].attributes.yAxisName, ""); //Canvas background color, border color and border thickness (in pixels) this.Params.canvasBgColor = formatHexColor(getFirstValue(levelOneNodes[i].attributes.canvasBgColor, "FFFFFF")); this.Params.canvasBgAlpha = Number(getFirstValue(levelOneNodes[i].attributes.canvasBgAlpha, "100")); this.Params.canvasBorderColor = formatHexColor(getFirstValue(levelOneNodes[i].attributes.canvasBorderColor, "333333")); this.Params.canvasBorderThickness = Number(getFirstValue(levelOneNodes[i].attributes.canvasBorderThickness, "2")); //The upper and lower limits of y and x axis this.Params.yAxisMinValue =џџCPicPageџџ CPicLayerџџ CPicFrame€€џџџ?џџvmџ//Include the external file containing routines to assist in data loading #include "../CodeBase/FCDataLoad.as" /* LboolIsURLProvided is a global scope boolean variable that would maintain the flag indicating whether the data has been provided in URL format or dataXML format. A true value indicates dataURL. */ _global.LboolIsURLProvided = isDataURLProvided(); if (LboolIsURLProvided == false) { //If it's dataXML, send the control to FdataXMLHandler frame gotoAndPlay("FdataXMLHandler"); } else { //Else, transfer the control to FdataURLHandler frame gotoAndPlay("FdataURLHandler"); } //Stop until the scripts invoke some action stop();€€€џџџ?џџxџг//dataURL handler frame /* This frame handles the data provided via dataURL method. Here, we do the following: 1. Filter the dataURL given to us 2. Load the XML data and store it in _global.TxmlDataDoc XML Object 3. Create the progress bar for XML data 4. If any errors are present in the XML document, show the error. */ //We've been provided with dataURL. So, the first job is to filter the dataURL provided to us. var strXMLDocURL; strXMLDocURL = filterDataURL(_root.dataURL); //Text to be displayed to user while the XML data document is loading. var LXMLLoadingText = getFirstValue(unescape(_root.XMLLoadingText), "Retrieving Data. Please Wait"); //Create the text to be displayed createText(2, LXMLLoadingText, _chartHorCenter, _chartVerCenter-(LPBarHeight/2), "Verdana", "10", LPBarTextColor, false, "center", "left", null, false); //Global flag to check whether the data size has been determined _global.isDataSizeDetermined = false; //Now, create the progress bar for XML data loading attachMovie("FCProgressBar", "FCPB", 1); FCPB.setPosition(_chartHorCenter-(LPBarWidth/2), _chartVerCenter); FCPB.setSize(LPBarWidth, LPBarHeight); FCPB.setColors(LPBarBgColor, LPBarBorderColor); FCPB.setBorderThickness(LPBarBorderThickness); FCPB.draw(); //We now instantiate the routine to load the XML data from the specified URL. TxmlDataDoc.load(strXMLDocURL); /* We also specify the onLoad event handler for the XML document That is, the control will switch to dataLoaded() function once the data has been downloaded into the clients machine dataLoaded function is defined in FCDataLoad.as */ TxmlDataDoc.onLoad = dataLoaded; //Create the onEnter Frame action _root.onEnterFrame = function() { //If the total bytes of the XML document has been detected, //we set the minimum and maximum limits for the progress bar //and update the value. if (_global.TxmlDataDoc.getBytesTotal() != undefined && _global.TxmlDataDoc.getBytesTotal()>0) { if (_global.isDataSizeDetermined == false) { //Set the new limits of the progress bar FCPB.setLimits(0, _global.TxmlDataDoc.getBytesTotal()); //Update the flag _global.isDataSizeDetermined = true; } //Update progess bar FCPB.setValue(_global.TxmlDataDoc.getBytesLoaded()); } }; //Stop here. stop(); €€€џџџ?џџТ6џМ//dataXML handler frame /* This frame handles the data provided via dataXML method. Here, we do the following: 1. Parse the XML string provided to us and store it in _global.TxmlDataDoc XML Object 2. If any errors are present in the XML document, show the error. */ //Get the parsing data text var LPParsingDataText = getFirstValue(unescape(_root.ParsingDataText), "Reading Data. Please Wait"); //Show the parsing data text createText(2, LPParsingDataText, _chartHorCenter, _chartVerCenter-(LPBarHeight/2), "Verdana", "10", LPBarTextColor, false, "center", "left", null, false); //Parse the XML data as string var strXMLData = new String(_root.dataXml); TxmlDataDoc.parseXML(strXMLData); //Check for the validity of the data if (TxmlDataDoc.status == 0) { //if it's valid, we move to the FDataLoadFinalize frame gotoAndPlay("FDataLoadFinalize"); } else { //However if the XML Data is not well-formed, Show an error showDataError("Invalid XML Data"); } €€€џџџ?џџcIџт/* This frame is invoked when the XML data has been loaded - either via dataURL route or dataXML method Here, we hide the progress bar, hide the loading text And finally, move the control to chart frame. */ if (LboolIsURLProvided) { //Delete _root's onEnterFrame event (defined in case of dataURL) delete _root.onEnterFrame; //Hide the progress bar (defined in case of dataURL) FCPB.erase(); } //Delete the text deleteText(2); //Move to the Chart scene gotoAndPlay("Chart", 1); €€ ActionsџџџџOџOџ€€€€џџџ?џџFdataLoadInitialize‰€€€џџџ?џџFdataURLHandlerЉP€€€џџџ?џџFdataXMLHandler‚3€€€џџџ?џџFDataLoadFinalizey €€ LabelsџџџџџOOџ€€€€џџџ?џџ*fџy/* Scene Name: DataLoad =========================================================================== This entire scene acts as a preloader for the XML Data document. In this scene, we first check whether the XML data has been provided as an entire XML data string or only the URL of the XML provider has been given. Data can be provided to FusionCharts in 2 ways: 1. dataXML way - The whole XML data is present in the HTML Page (Containing FusionCharts) - sort of an XML levelOneNodes[i].attributes.yAxisMinvalue; this.Params.yAxisMaxValue = levelOneNodes[i].attributes.yAxisMaxvalue; //Configuration to set whether to show the names or not this.Params.showNames = Number(getFirstValue(levelOneNodes[i].attributes.showNames, "1")); this.Params.ShowValues = Number(getFirstValue(levelOneNodes[i].attributes.ShowValues, "0")); //Option to show/hide limits this.Params.showLimits = Number(getFirstValue(levelOneNodes[i].attributes.showLimits, "1")); //Option to show/hide limits this.Params.showLegend = Number(getFirstValue(levelOneNodes[i].attributes.showLegend, "1")); //Option to show vertical x-axis labels this.Params.rotateNames = Number(getFirstValue(levelOneNodes[i].attributes.rotateNames, "0")); //Animation this.Params.animation = Number(getFirstValue(levelOneNodes[i].attributes.animation, "1")); //Horizontal grid division Lines - Number, color, thickness & alpha this.Params.numDivLines = Number(getFirstValue(levelOneNodes[i].attributes.numDivLines, "4")); this.Params.divLineColor = formatHexColor(getFirstValue(levelOneNodes[i].attributes.divLineColor, "CCCCCC")); this.Params.divLineThickness = Number(getFirstValue(levelOneNodes[i].attributes.divLineThickness, "1")); this.Params.divLineAlpha = Number(getFirstValue(levelOneNodes[i].attributes.divLineAlpha, "100")); this.Params.showDivLineValue = Number(getFirstValue(levelOneNodes[i].attributes.showDivLineValue, "1")); //Vertical div lines this.Params.numVDivLines = Number(getFirstValue(levelOneNodes[i].attributes.numVDivLines, "0")); this.Params.vDivLineColor = formatHexColor(getFirstValue(levelOneNodes[i].attributes.vDivLineColor, this.Params.divLineColor)); this.Params.vDivLineThickness = Number(getFirstValue(levelOneNodes[i].attributes.vDivLineThickness, this.Params.divLineThickness)); this.Params.vDivLineAlpha = Number(getFirstValue(levelOneNodes[i].attributes.vDivLineAlpha, this.Params.divLineAlpha)); //Alternating grid colors this.Params.showAlternateHGridColor = Number(getFirstValue(levelOneNodes[i].attributes.showAlternateHGridColor, "0")); this.Params.alternateHGridColor = formatHexColor(getFirstValue(levelOneNodes[i].attributes.alternateHGridColor, this.Params.divLineColor)); this.Params.alternateHGridAlpha = Number(getFirstValue(levelOneNodes[i].attributes.alternateHGridAlpha, "30")); this.Params.showAlternateVGridColor = Number(getFirstValue(levelOneNodes[i].attributes.showAlternateVGridColor, "0")); this.Params.alternateVGridColor = formate movie that has been loaded (upto this moment) into the viewer's machine bytesLoaded = this.getBytesLoaded(); //Keep on playing play(); €€€џџџ?џџpZB//This frame is a part of the preloader script //Just play play();€€€џџџ?џџ№ џK//This frame is a part of the preloader script //Here, we check the movie has been fully downloaded to the end user's machine. if (bytesLoaded=270) { switch (vAlignPos.toUpperCase()) { case "LEFT" : fcText._x = fcText._x; break; case "CENTER" : fcText._x = fcText._x-(fcText._width/2); break; case "RIGHT" : fcText._x = fcText._x-(fcText._width); break; } } else { switch (vAlignPos.toUpperCase()) { case "LEFT" : fcText._x = fcText._x+(fcText._width); break; case "CENTER" : fcText._x = fcText._x+(fcText._width/2); break; case "RIGHT" : fcText._x = fcText._x; break; } } } //Set 4 properties of the temporary object //textWidth, textHeight, textX, textY //These properties will be returned to the caller function. //for text manipulation LTextProperties.textWidth = fcText._width; LTextProperties.textHeight = fcText._height; //For fonts not included if (LTextProperties.textHeight<=4) { LTextProperties.textHeight = fontSize*2; } LTextProperties.textX = fcText._x; LTextProperties.textY = fcText._y; //Return this object return LTextProperties; //Delete the temporary objects delete LTextProperties; delete fcTextFormat; delete fcText; }; _global.deleteText = function(depth) { //This function deletes a text box created using createText //Get a reference to the textbox mcText = eval("ASMovText_"+depth); //Remove it mcText.removeTextField(); //Delete the reference delete mcText; }; //Next, we initialize the chart by setting the required width and height of the chart _global._chartWidth = Number(getFirstValue(_root.chartWidth, "450")); _global._chartHeight = Number(getFirstValue(_root.chartHeight, "350")); /* defaultDataFile represents the XML data file URI which would be loaded if no other URI or XML data has been provided to us. */ _global._defaultDataFile = getFirstValue(unescape(_root.defaultDataFile), "Data.xml"); //A temporary XML object now to load the XML data until the chart is loaded //We will later transfer the contents of this temporary XML object to our Chart Class // :Explanation: Why use this temporary XML Object? /* We have intentionally created this temporary XML Object to load the data from the XML Source. Since, we have defined our chart class in the next scene (Chart Scene) and this scene will be played only when the chart is loaded. So, while the chart swf file is loading, we also instantiate a request to load the XML data. This eliminates the time the user might have to wait for data loading after chart loading. */ _global.TxmlDataDoc = new XML(); /* FCLastLevel is a variable used to keep track of the number of levels used up for rendering the chart. We use the rendering algorithm of Flash to order the z-axis-index of various elements of the chart. Initially, it is set to 1 (or _global._FCLastLevel as set in loader movie) as we haven't rendered any element as yet. */ FCLastLevel = Number(getFirstValue(_root.FCLastLevel, 1)); /* _FCXShift and _FCYShift refers to the initial x and y position for the chart. Basically, these parameters would be used when loading the chart inside other Flash movies */ _FCXShift = Number(getFirstValue(_root._FCXShift, 0)); _FCYShift = Number(getFirstValue(_root._FCYShift, 0)); /* Calculate the chart horizontal and vertical center */ _chartHorCenter = _FCXShift+(_chartWidth/2); _chartVerCenter = _FCYShift+(_chartHeight/2); /* _global._embedFontFace defines the font face which has been embedded in this Flash movie for rotated text boxes. */ _global._embedFontFace = "Verdana"; /* We also define some local functions which will be used in this scene itself. */ function hideProgressBar() { //This function hides the progress bar //We first remove the border of the progress bar ASMovPBorder.removeMovieClip(); //Now, set the visibility of "fill" bar to false MovLoaderBg._visible = false; } /* xmlLoaded function acts as the onLoad event handler for _global.TxmlDataDoc XML Object. success is a Boolean value indicating whether the XML object was successfully loaded. If the XML document is received successfully, the success parameter is true. If the document was not received, or if an error occurred in receiving the response from the server, the success parameter is false. Based on this success parameter, we'll show the required msgs to the user */ function xmlLoaded(success) { if (success) { //Data has been loaded successfully - so check for validity of data if (_global.TxmlDataDoc.status == 0) { //Data is error free //So jump to FXMLDone Frame gotoAndPlay("FXMLDone"); } else { //XML Data is not well-formed. Show an error createText(1, "Invalid XML Data", _chartHorCenter, _chartVerCenter-(LPBarHeight/2), "Verdana", "10", LPBarTextColor, false, "center", "left", null, false); //Hide the progress bar hideProgressBar(); //Stop the control of the movie stop(); } } else { //An error occurred while fetching the data. Show an error to viewer createText(1, "Error in Loading Data", _chartHorCenter, _chartVerCenter-(LPBarHeight/2), "Verdana", "10", LPBarTextColor, false, "center", "left", null, false); //Hide the progress bar hideProgressBar(); //Stop the control of the movie stop(); } } €€ Functions/ConstantsџџџџO€џџ€€џџџџO€џџ€€uired msgs to the user */ function xmlLoaded(success) { if (success) { //Data has been loaded successfully - so check for validity of data if (_global.TxmlDataDoc.status == 0) { //Data is error free //So jump to FXMLDone Frame gotoAndPlay("FXMLDone"); } else { //XML Data is not well-formed. Show an error createText(1, "Invalid XML Data", _chartHorCenter, _chartVerCenter-(LPBarHeight/2), "Verdana", "10", LPBarTextColor, false, s[i].attributes.areaBgColor, "ff5904")); this.Params.showAreaBorder = Number(getFirstValue(levelOneNodes[i].attributes.showAreaBorder, "1")); this.Params.areaBorderThickness = Number(getFirstValue(levelOneNodes[i].attributes.areaBorderThickness, "2")); this.Params.areaBorderColor = formatHexColor(getFirstValue(levelOneNodes[i].attributes.areaBorderColor, this.Params.areaBgColor)); //Font Properties this.Params.baseFont = getFirstValue(levelOneNodes[i].attributes.baseFont, "Verdana"); this.Params.baseFontSize = Number(getFirstValue(levelOneNodes[i].attributes.baseFontSize, "9")); this.Params.baseFontColor = formatHexColor(getFirstValue(levelOneNodes[i].attributes.baseFontColor, "000000")); this.Params.outCnvBaseFont = getFirstValue(levelOneNodes[i].attributes.outCnvBaseFont, this.Params.baseFont); this.Params.outCnvBaseFontSize = Number(getFirstValue(levelOneNodes[i].attributes.outCnvBaseFontSize, this.Params.baseFontSize)); this.Params.outCnvBaseFontColor = formatHexColor(getFirstValue(levelOneNodes[i].attributes.outCnvBaseFontColor, this.Params.baseFontColor)); //Option whether the format the number (using Commas) this.Params.formatNumber = Number(getFirstValue(levelOneNodes[i].attributes.formatNumber, "1")); this.Params.formatNumberScale = Number(getFirstValue(levelOneNodes[i].attributes.formatNumberScale, "0")); //Number prefix and suffix this.Params.numberPrefix = getFirstValue(this.unescapeStr(levelOneNodes[i].attributes.numberPrefix), ""); this.Params.numberSuffix = getFirstValue(this.unescapeStr(levelOneNodes[i].attributes.numberSuffix), ""); //Decimal Separator Character this.Params.decimalSeparator = getFirstValue(levelOneNodes[i].attributes.decimalSeparator, "."); //Thousand Separator Character this.Params.thousandSeparator = getFirstValue(levelOneNodes[i].attributes.thousandSeparator, ","); //Decimal Precision (number of decimal places to be rounded to) this.Params.decimalPrecision = Number(getFirstValue(levelOneNodes[i].attributes.decimalPrecision, "2")); //Div Line display value decimal Precision this.Params.divLineDecimalPrecision = Number(getFirstValue(levelOneNodes[i].attributes.divLineDecimalPrecision, this.Params.decimalPrecision)); //Chart Limits display value decimal precision this.Params.limitsDecimalPrecision = Number(getFirstValue(levelOneNodes[i].attributes.limitsDecimalPrecision, this.Params.decimalPrecision)); //Decimal Precision cannot be less than 0 - so adjust it if (this.Params.decimalPrecision<0) { this.Params.decimalPrecision = 0; } //Chart Margins this.Params.chartLeftMargin = Number(getFirstValue(levelOneNodes[i].attributes.chartLeftMargin, "15")); this.Params.chartRightMargin = Number(getFirstValue(levelOneNodes[i].attributes.chartRightMargin, "15")); this.Params.chartTopMargin = Number(getFirstValue(levelOneNodes[i].attributes.chartTopMargin, "15")); this.Params.chartBottomMargin = Number(getFirstValue(levelOneNodes[i].attributes.chartBottomMargin, "15")); //All the properties have been extracted //Therefore, now we move on to extract the data contained in data, DATA and TRENDLINES nodes levelTwoNodes = levelOneNodes[i].childNodes; for (j=0; j<=levelTwoNodes.length; j++) { if (levelTwoNodes[j].nodeName.toUpperCase() == "SET") { this.Params.num++; //Extract the attributes var setValue = levelTwoNodes[j].attributes.value; var setLink = unescape(levelTwoNodes[j].attributes.link); var setName = getFirstValue(levelTwoNodes[j].attributes.nametHexColor(getFirstValue(levelOneNodes[i].attributes.bgColor, "FFFFFF")); this.Params.bgAlpha = Number(getFirstValue(levelOneNodes[i].attributes.bgAlpha, "100")); //Background swf this.Params.bgSWF = levelOneNodes[i].attributes.bgSWF; //Chart Title this.Params.caption = getFirstValue(levelOneNodes[i].attributes.caption, ""); this.Params.subCaption = getFirstValue(levelOneNodes[i].attributes.subCaption, ""); //If no caption has been provided, set an appropriate flag //Default flag tџџCPicPageџџ CPicLayerџџ CPicFrameџџCPicText€€ ёџџ;ўџџџƒџ embedText ,./<>?;':"[]{}__+=|\!@#$%^&*()`~@Verdanaџ"(€€џџџ?џџa>€€ Layer 1џџџџO€џџ€€naџ"(€џџCPicPageџџ CPicLayerџџ CPicFrameџџCPicText€€ ёџџ;ўџџџƒџ embedText !@#$%^&*()@Verdanaџ"(џџCPicPageџџ CPicLayerџџ CPicFrame€€ЬЬџѓИрќ 0Hх0рќ0Иџџџ?џџ"€€ LoaderџџџџO€џџ€€(#Xhhhh€€his.Params.showCaption = 1; if (this.Params.caption == "") { this.Params.showCaption = 0; } this.Params.showSubCaption = 1; if (this.Params.subCaption == "") { this.Params.showSubCaption = 0; } //X and Y Axis Name this.Params.xAxisName = getFirstValue(levelOneNodes[i].attributes.xAxisName, ""); this.Params.yAxisName = getFirstValue(levelOneNodes[i].attributes.yAxisName, ""); //Canvas background color, border color and border thickness (in pixels) this.Params.canvasBgColor = formatHexColor(getFirstValue(levelOneNodes[i].attributes.canvasBgColor, "FFFFFF")); this.Params.canvasBgAlpha = Number(getFirstValue(levelOneNodes[i].attributes.canvasBgAlpha, "100")); this.Params.canvasBorderColor = formatHexColor(getFirstValue(levelOneNodes[i].attributes.canvasBorderColor, "333333")); this.Params.canvasBorderThickness = Number(getFirstValue(levelOneNodes[i].attributes.canvasBorderThickness, "2")); //The upper and lower limits of y and x axis this.Params.yAxisMinValue =џџCPicPageџџ CPicLayerџџ CPicFrame€€џџџ?џџ FInitializeŸ€€ LabelsџџџџOџOџ€€€€џџџ?џџйџ,//-------------------------// //Chart Initialization here// //-------------------------// /* Set local width and height - this local width and height would be assumed if the user hasn't specified an exact size required for the chart - else it will be over-written. */ LChartWidth = 565; LChartHeight = 420; //Include Global Functions #include "../CodeBase/FCGlobalFunctions.as" //Include Initialization scripts #include "../CodeBase/FCInit.as" //---------------------------------------------------------------------// //----------------- CHART MOVIE PRELOADER BEGINS HERE -----------------// //---------------------------------------------------------------------// /* The pre loader has a l, ""); var setHoverText = getFirstValue(levelTwoNodes[j].attributes.hoverText, setName); var setAlpha = Number(getFirstValue(levelTwoNodes[j].attributes.alpha, "100")); var setShowName = Number(getFirstValue(levelTwoNodes[j].attributes.showName, this.Params.showNames)); var setColor = formatHexColor(getFirstValue(levelTwoNodes[j].attributes.color, this.Params.areaBgColor)); //Check for negative number if (setValue<0) { this.Params.negativeNumPresent = true; } //If setValue is undefined or null i.e, null set if (setValue == undefined || setValue == null || setValue == "") { //Create an empty dataset element this.data[this.Params.num] = new Chart.dataItem(setName, 0, setColor, setLink, 0, setHoverText, setShowName); setAlpha = 0; } else { //Create the normal object to represent it this.data[this.Params.num] = new Chart.dataItem(setName, Number(setValue), setColor, setLink, setAlpha, setHoverText, setShowName); } } else if (levelTwoNodes[j].nodeName.toUpperCase() == "TRENDLINES") { //Extract the trendlines info //Means the node represents the TRENDLINES element //So, get a reference to its child nodes trendLineNodes = levelTwoNodes[j].childNodes; //Now, we need to iterate through each line node for (k=0; k<=trendLineNodes.length; k++) { //Check if the element is a LINE Element if (trendLineNodes[k].nodeName.toUpperCase() == "LINE") { //Increment the counter by 1 this.Params.numTrendLines++; //Extract the data var lineStartValue = Number(getFirstValue(trendLineNodes[k].attributes.startValue, trendLineNodes[k].attributes.value, "0")); var lineEndValue = Number(getFirstValue(trendLineNodes[k].attributes.endValue, lineStartValue)); var lineColor = formatHexColor(getFirstValue(trendLineNodes[k].attributes.color, "000000")); var lineDisplayValue = getFirstValue(trendLineNodes[k].attributes.displayValue, this.formatNumber(lineStartValue)); var lineThickness = Number(getFirstValue(trendLineNodes[k].attributes.thickness, "1")); var lineShowOnTop = Number(getFirstValue(trendLineNodes[k].attributes.ShowOnTop, "1")); var lineIsTrendZone = Number(getFirstValue(trendLineNodes[k].attributes.isTrendZone, "0")); var defaultLineAlpha; defaultLineAlpha = (lineIsTrendZone == 1) ? 40 : 99; var lineAlpha = Number(getFirstValue(trendLineNodes[k].attributes.alpha, defaultLineAlpha)); this.TrendLines[this.Params.numTrendLines] = new Chart.trendLine(lineStartValue, lineEndValue, lineColor, lineDisplayValue, lineThickness, lineAlpha, lineShowOnTop, lineIsTrendZone); } } //Free memory resources delete trendLineNodes; } } } } //Now, remove the unwanted data/objects from memory delete levelTwoNodes; delete levelOneNodes; //Call the function to calculate y-axis upper and lower limits this.calcYAxisLimits(); }; Chart.prototype.getYAxisMaxValue = function() { //This method returns the highest y-axis value //By default we assume the max value to be that of the first data var intMaxVal = this.data[1].value; //Iterate through each of the data for (i=1; i<=this.Params.num; i++) { if (this.data[i].value>intMaxVal && this.data[i].showDataSet == 1) { intMaxVal = this.data[i].value; } } //Return the value return intMaxVal; }; Chart.prototype.getYAxisMinValue = function() { //This method returns the lowest y-axis value //By default we assume the min value to be that of the first data var intMinVal = this.data[1].value; //Now, iterate through each of the values to compare //Iterate through each of the data for (i=1; i<=this.Params.num; i++) { if (this.data[i].valueminValue) { this.Params.yAxisMinValue = y_lowerBound; } this.Params.yAxisMaxValue = Number(this.Params.yAxisMaxValue); this.Params.yAxisMinValue = Number(this.Params.yAxisMinValue); }; Chart.prototype.calculatePoints = function() { //This function calculates the pixel co-ordinates of all //the elements on the chart. //Calculate the y axis interval this.Params.yAxisInterval = this.Params.yAxisMaxValue-this.Params.yAxisMinValue; //First, we'll calculate the height, start y pos & end y position of the canvas //We first assume the canvas height to be of the same size as the stage height //Step by step, we'll now deduct the margins and elements height to get the actual height var LCanvasHeight = _chartHeight; var LCanvasWidth = _chartWidth; var LCanvasStartX, LCanvasEndX, LCanvasStartY, LCanvasEndY; var verticalBlockedHt = 0; var horizontalBlockWd = 0; //Deduct the top and bottom margins LCanvasHeight = LCanvasHeight-(this.Params.chartTopMargin+this.Params.chartBottomMargin); verticalBlockedHt = this.Params.chartTopMargin; //Now, if the caption is to be shown, deduct the height of the caption var LCaption; if (this.Params.showCaption == 1) { LCaption = createText(25001, this.Params.caption, this.Constants.calcTextXPos, this.Constants.calcTextYPos, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, true, "center", "center", null, true); //Create an object in this.objects representing this caption object this.objects.caption = new Chart.cObject(_FCXShift, _FCYShift+verticalBlockedHt+(LCaption.textHeight/2), LCaption.textHeight, LCaption.textWidth); //Add to blocked height and canvas size LCanvasHeight = LCanvasHeight-LCaption.textHeight; verticalBlockedHt = verticalBlockedHt+LCaption.textHeight; } //Space for sub caption if (this.Params.showSubCaption == 1) { LCaption = createText(25001, this.Params.subCaption, this.Constants.calcTextXPos, this.Constants.calcTextYPos, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, true, "center", "center", null, true); //Create an object in this.objects representing this caption object this.objects.subCaption = new Chart.cObject(_FCXShift, _FCYShift+verticalBlockedHt+(LCaption.textHeight/2), LCaption.textHeight, LCaption.textWidth); //Add to blocked height and canvas size LCanvasHeight = LCanvasHeight-LCaption.textHeight; verticalBlockedHt = verticalBlockedHt+LCaption.textHeight; } //Extra space - 20 pixels - only required if caption/subcaption to be shown if ((this.Params.showCaption == 1) || (this.Params.showSubCaption == 1)) { LCanvasHeight = LCanvasHeight-20; verticalBlockedHt = verticalBlockedHt+20; } LCanvasStartY = _FCYShift+verticalBlockedHt; //Now, we get the height of the x-axis labels (data) var LMaxCatNameHeight = 0; var LCatNameHeight = 0; //We'll calculate the max length of the x-axis label height (if the labels are to be shown) if (this.Params.shownames == 1) { for (i=1; i<=this.Params.num; i++) { if (this.data[i].showName == 1) { if (this.Params.rotateNames == 1) { //If the name is to be rendered in rotated style LCatNameHeight = createText(25001, this.data[i].name, this.Constants.calcTextXPos, this.Constants.calcTextYPos, _embedFontFace, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, false, "center", "center", this.Constants.catTextRotationAngle, true).textHeight; } else { //Straight text LCatNameHeight = createText(25001, this.data[i].name, this.Constants.calcTextXPos, this.Constants.calcTextYPos, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, false, "center", "center", this.Params.rotateNames, true).textHeight; } } //Now, if the current cat height is more than the previous text height //Override the value if (LCatNameHeight>LMaxCatNameHeight) { LMaxCatNameHeight = LCatNameHeight; } } //Deduct them from space blocked and total space LCanvasHeight = LCanvasHeight-LMaxCatNameHeight; verticalBlockedHt = verticalBlockedHt+LMaxCatNameHeight; } //Now, for x-axis name //Space for sub caption if (this.Params.xAxisName != "") { LCaption = createText(25001, this.Params.xAxisName, this.Constants.calcTextXPos, this.Constants.calcTextYPos, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, true, "center", "center", null, true); //Create an object in this.objects representing this caption object this.objects.xAxisName = new Chart.cObject(_FCXShift, _FCYShift+verticalBlockedHt+(LCaption.textHeight/2), LCaption.textHeight, LCaption.textWidth); //Add to blocked height and canvas size LCanvasHeight = LCanvasHeight-LCaption.textHeight; verticalBlockedHt = verticalBlockedHt+LCaption.textHeight; } //Calculate the end Y of the canvas LCanvasEndY = LCanvasStartY+LCanvasHeight; //********* For the start and end X of the canvas ********* //Add the left margin horizontalBlockWd = horizontalBlockWd+this.Params.chartLeftMargin; LCanvasWidth = LCanvasWidth-(this.Params.chartLeftMargin+this.Params.chartRightMargin); var horizontalMaxLength = 0; var horTextWidth, horTextWidth_2; //Now, we need to get the max length of the text of either of the following: //Y-axis name //Limit textboxes //Div Line Textboxes //Trend Line textboxes if (this.Params.yAxisName != "") { //Get the textwidth for y axis name horTextWidth = createText(25001, this.Params.yAxisName, this.Constants.calcTextXPos, this.Constants.calcTextYPos, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, false, "center", "center", 270, true).textWidth; //So-set the canvas start and end position horizontalBlockWd = horizontalBlockWd+horTextWidth; LCanvasWidth = LCanvasWidth-horizontalBlockWd; //Create an object representing the y axis name this.objects.yAxisName = new Chart.cObject(_FCXShift+horizontalBlockWd-horTextWidth, _FCYShift, horTextWidth, 0); } //First, we count for the limits textboxes (if they are to be shown) if (this.Params.showLimits == 1) { //Get the textwidth for upper limit horTextWidth = createText(25001, this.formatNumber(this.Params.yAxisMaxValue, this.Params.limitsDecimalPrecision), this.Constants.calcTextXPos, this.Constants.calcTextYPos, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, false, "center", "center", null, true).textWidth; //Count for lower limit horTextWidth_2 = createText(25001, this.formatNumber(this.Params.yAxisMinValue, this.Params.limitsDecimalPrecision), this.Constants.calcTextXPos, this.Constants.calcTextYPos, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, false, "center", "center", null, true).textWidth; //Get the higher value if (horTextWidth>horTextWidth_2) { horizontalMaxLength = horTextWidth; } else { horizontalMaxLength = horTextWidth_2; } } //Now, we calculate the div lines values (if needed) var divLineValue; //Get the value for each div line to be created for (i=1; i<=this.Params.numDivLines; i++) { divLineValue = (this.Params.yAxisMinValue+i*(this.Params.yAxisInterval/(this.Params.numDivLines+1))); //Format this div line value and set it in a div line object this.Divlines[this.Params.numDivLines-i+1] = new Chart.divLine(divLineValue, this.formatNumber(divLineValue, this.Params.divLineDecimalPrecision), this.Params.showDivLineValue); //Now, if the div line text is to be shown, get the text width if (this.Params.showDivLineValue == 1) { horTextWidth = createText(25001, this.Divlines[i].displayValue, this.Constants.calcTextXPos, this.Constants.calcTextYPos, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, false, "center", "center", null, true).textWidth; //If it's greater, then re-set the max length if (horTextWidth>horizontalMaxLength) { horizontalMaxLength = horTextWidth; } } } //Now, we count for the width of trend line display values if any for (i=0; i<=this.Params.numTrendLines; i++) { horTextWidth = createText(25001, this.TrendLines[i].displayValue, this.Constants.calcTextXPos, this.Constants.calcTextYPos, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, false, "center", "center", null, true).textWidth; //If it's greater, then re-set the max length if (horTextWidth>horizontalMaxLength) { horizontalMaxLength = horTextWidth; } } //Now, we have the maximum text length //So-set the canvas start and end position horizontalBlockWd = horizontalBlockWd+horizontalMaxLength; LCanvasWidth = LCanvasWidth-horizontalMaxLength; LCanvasStartX = _FCXShift+horizontalBlockWd; LCanvasEndX = LCanvasStartX+LCanvasWidth; //Create a canvas object in this.Objects this.Objects.canvas = new Chart.cObject(LCanvasStartX, LCanvasStartY, LCanvasHeight, LCanvasWidth); //Now that we have the canvas size calculate, we calculate the position of the various elements on the chart //------------------------------------------------------------// //We now get the position of all the columns on the chart //Determine the per-unit-pixel factor this.Params.perUnitPixels = this.Objects.Canvas.height/this.Params.yAxisInterval; //Zero plane position calculation //Set the negativeNumPresent and showZeroPlane flag to the correct value if (this.Params.negativeNumPresent || this.Params.yAxisMinValue<0) { if (this.Params.yAxisMaxValue>=0) { this.Params.showZeroPlane = true; } } //Now if the zero plane is to be shown, calculate the zero plane pos if (this.Params.showZeroPlane) { this.Params.zeroPlanePos = (this.Objects.Canvas.yPos+this.Objects.Canvas.height)-(this.Params.perUnitPixels*(0-this.Params.yAxisMinValue)); } else { this.Params.zeroPlanePos = (this.Objects.Canvas.yPos+this.Objects.Canvas.height); } //Get the width of individual area var areaWidth; areaWidth = this.Objects.Canvas.width/(this.Params.num-1); //Assign to global this.Params.areaWidth = areaWidth; //Get the position of the area segments now for (i=1; i<=this.Params.num; i++) { //For the x pos of the area and the data this.data[i].xPos = this.Objects.Canvas.xPos+(i-1)*this.Params.areaWidth; if (this.Params.yAxisMinValue>=0) { this.data[i].yPos = this.Params.zeroPlanePos-((this.data[i].value-Math.abs(this.Params.yAxisMinValue))*this.Params.perUnitPixels); } else { this.data[i].yPos = this.Params.zeroPlanePos-((this.data[i].value)*this.Params.perUnitPixels); } this.data[i].valueTbX = this.data[i].xPos; if (this.data[i].value>=0) { this.data[i].valueTbY = this.data[i].yPos-10; } else { this.data[i].valueTbY = this.data[i].yPos+10; } } //Now, horizontal divlines var divLineHorizontalSpace; divLineHorizontalSpace = this.Objects.Canvas.height/(this.Params.numDivLines+1); for (i=1; i<=this.Params.numDivLines; i++) { //Start and end position of a div line is the same as that of the canvas this.Divlines[i].startXPos = this.Objects.Canvas.xPos; this.Divlines[i].endXPos = this.Objects.Canvas.xPos+this.Objects.Canvas.width; //Calculate the y position of the div line this.Divlines[i].startYPos = this.Objects.Canvas.yPos+(divLineHorizontalSpace*i); this.Divlines[i].endYPos = this.Objects.Canvas.yPos+(divLineHorizontalSpace*i); } //Calculate the x and y positions of the trend lines for (i=1; i<=this.Params.numTrendLines; i++) { //Set the x position this.TrendLines[i].startXPos = this.Objects.Canvas.xPos; this.TrendLines[i].endXPos = this.Objects.Canvas.xPos+this.Objects.Canvas.width; this.TrendLines[i].startYPos = this.getAxisPosition(this.TrendLines[i].startValue, this.Params.yAxisMaxValue, this.Params.yAxisMinValue, this.Objects.Canvas.yPos, this.Objects.Canvas.yPos+this.Objects.Canvas.height, -1); this.TrendLines[i].endYPos = this.getAxisPosition(this.TrendLines[i].endValue, this.Params.yAxisMaxValue, this.Params.yAxisMinValue, this.Objects.Canvas.yPos, this.Objects.Canvas.yPos+this.Objects.Canvas.height, -1); } }; Chart.prototype.formatNumber = function(number, decimalPrecision) { //This function formats a number in FusionCharts format //decimalPrecision here is optional var precision; //If no decimalPrecision specified take the global one if (decimalPrecision == undefined || decimalPrecision == null) { precision = this.Params.decimalPrecision; } else { precision = decimalPrecision; } var intNum = number; var strScale = ""; //If number is to be scaled if (this.Params.formatNumberScale == 1) { if (Math.abs(intNum)>=1000) { strScale = "K"; intNum = intNum/1000; } if (Math.abs(intNum)>=1000) { strScale = "M"; intNum = intNum/1000; } } //Convert it into string var strNum = String(intNum); //We format the number if required if (this.Params.formatNumber == 1) { //Format the decimal precision strNum = Math.formatDecimals(intNum, precision); //Format the commas in the number strNum = formatCommas(String(strNum), this.Params.thousandSeparator, this.Params.decimalSeparator); } //Now, we append the prefix and the suffix strNum = this.Params.numberPrefix+strNum+strScale+this.Params.numberSuffix; return strNum; }; Chart.prototype.getLevel = function() { //This function returns the highest current level in the movie which does not contain an object. //Increase the last depth _global._FCLastLevel++; //Return it return _global._FCLastLevel; }; Chart.prototype.getAxisPosition = function(value, upperLimit, lowerLimit, startAxisPos, endAxisPos, isYAxis) { //This function returns the axis position of a value on an axis //having specified upper limit and lower limit and specified axes positions //Set default for isYAxis if (isYAxis == null || isYAxis == undefined) { isYAxis = false; } var numericalInterval = (upperLimit-lowerLimit); if (isYAxis) { var positionInterval = (endAxisPos-startAxisPos); var relativePosition = (positionInterval/numericalInterval)*(value-lowerLimit); //If it's a y axis co-ordinate then go according to Flash's co-ordinate system //(y decreases as we go upwards) var absolutePosition = endAxisPos-relativePosition; } else { var positionInterval = (endAxisPos-startAxisPos)-(2*this.Constants.CCanvasPadding); var relativePosition = (positionInterval/numericalInterval)*(value-lowerLimit); //The normal x-axis rule - increases as we go right var absolutePosition = startAxisPos+this.Constants.CCanvasPadding+relativePosition; } return absolutePosition; }; //**** Chart Element Rendering Methods ****// Chart.prototype.drawBackground = function() { //This function renders the background of the chart var level = this.getLevel(); //Set start level index this.Params.chartStartLevel = level; this.drawRectangle(this.getLevel(), _FCXShift, _FCYShift, _FCXShift+_chartWidth, _FCYShift+_chartHeight, this.Params.bgColor, this.Params.bgColor, 0, 0, this.Params.bgAlpha); }; Chart.prototype.loadBgSWF = function() { //This function loads the background chart swf file //First create a container movie clip createEmptyMovieClip("ASMov_bgSWF", this.getLevel()); //Get a reference to the same mcbgSWF = eval("ASMov_bgSWF"); //Load the external movie mcbgSWF.loadMovie(this.Params.bgSWF); }; Chart.prototype.drawCanvas = function() { //This function renders the canvas of the chart //Basically, the canvas is a small rectangle with the specified fill and border color this.drawRectangle(this.getLevel(), this.Objects.Canvas.xPos, this.Objects.Canvas.yPos, this.Objects.Canvas.xPos+this.Objects.Canvas.width, this.Objects.Canvas.yPos+this.Objects.Canvas.height, this.Params.canvasBorderColor, this.Params.canvasBgColor, 0, 0, this.Params.canvasBgAlpha); }; Chart.prototype.drawCanvasBorder = function() { //This function renders the overlay canvas border of the chart this.drawRectangle(this.getLevel(), this.Objects.Canvas.xPos, this.Objects.Canvas.yPos, this.Objects.Canvas.xPos+this.Objects.Canvas.width, this.Objects.Canvas.yPos+this.Objects.Canvas.height, this.Params.canvasBorderColor, this.Params.canvasBgColor, this.Params.canvasBorderThickness, 100, 0); }; Chart.prototype.drawGridBg = function() { //This function renders the grid background //First render the vertical grid background var verticalDivSpacing; var verticalGridStartXPos; var verticalGridEndXPos; verticalDivSpacing = this.Objects.Canvas.width/(this.Params.numVDivLines+1); for (i=1; i<=this.Params.numVDivLines+1; i=i+2) { //Start from left //Get the positions verticalGridStartXPos = this.Objects.Canvas.xPos+((i-1)*verticalDivSpacing); verticalGridEndXPos = this.Objects.Canvas.xPos+(i*verticalDivSpacing); //Show only if to be shown and if vertical div lines are more than 1 if ((this.Params.showAlternateVGridColor == 1) && (this.Params.numVDivLines>1)) { this.drawRectangle(this.getLevel(), verticalGridStartXPos, this.Objects.Canvas.yPos, verticalGridEndXPos, this.Objects.Canvas.yPos+this.Objects.Canvas.height, "ffffff", this.Params.alternateVGridColor, 0, 0, this.Params.alternateVGridAlpha); } } //Now render the horizontal grid background for (i=1; i<=this.Params.numDivLines; i=i+2) { //Start from top //Show only if to be shown and if vertical div lines are more than 1 if ((this.Params.showAlternateHGridColor == 1) && (this.Params.numDivLines>1)) { if (i == this.Params.numDivLines) { //Now if it has reached the last one - the end position will be end of canvas this.drawRectangle(this.getLevel(), this.divLines[i].startXPos, this.divLines[i].startYPos, this.Objects.Canvas.xPos+this.Objects.Canvas.width, this.Objects.Canvas.yPos+this.Objects.Canvas.height, "ffffff", this.Params.alternateHGridColor, 0, 0, this.Params.alternateHGridAlpha); } else { //Normal - between 2 existing div line objects - Create the rectangle this.drawRectangle(this.getLevel(), this.divLines[i].startXPos, this.divLines[i].startYPos, this.divLines[i+1].endXPos, this.divLines[i+1].endYPos, "ffffff", this.Params.alternateHGridColor, 0, 0, this.Params.alternateHGridAlpha); } } } }; Chart.prototype.drawDivLines = function() { //This function draws the div lines on the chart for (i=1; i<=this.Params.numDivLines; i++) { //Draw the div line this.drawLine(this.divLines[i].startXPos, this.divLines[i].startYPos, this.divLines[i].endXPos, this.divLines[i].endYPos, this.Params.divLineThickness, this.Params.divlinecolor, this.Params.divLineAlpha, this.getLevel()); //Also, render the text of this div line if (this.divLines[i].showValue == 1) { if (!((this.Params.showZeroPlane) && (this.divLines[i].value == 0))) { createText(this.getLevel(), this.divLines[i].displayValue, this.divLines[i].startXPos, this.divLines[i].startYPos, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, false, "right", "center", null, true); } } } //We'll also render the vertial div lines //Vertical div lines var verticalDivSpacing; var verticalDivLineXPos; verticalDivSpacing = this.Objects.Canvas.width/(this.Params.numVDivLines+1); for (i=1; i<=this.Params.numVDivLines; i++) { verticalDivLineXPos = this.Objects.Canvas.xPos+(i*verticalDivSpacing); this.drawLine(verticalDivLineXPos, this.Objects.Canvas.yPos, verticalDivLineXPos, this.Objects.Canvas.yPos+this.Objects.Canvas.height, this.Params.VDivLineThickness, this.Params.VDivlinecolor, this.Params.VDivLineAlpha, this.getLevel()); } }; Chart.prototype.setLabels = function() { //This function sets the various labels on the chart //We first set the limits (if needed) if (this.Params.showLimits == 1) { //Upper Limit createText(this.getLevel(), this.formatNumber(this.Params.yAxisMaxValue, this.Params.limitsDecimalPrecision), this.Objects.Canvas.xPos, this.Objects.Canvas.yPos, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, true, "right", "center", null, true); //Lower Limit createText(this.getLevel(), this.formatNumber(this.Params.yAxisMinValue, this.Params.limitsDecimalPrecision), this.Objects.Canvas.xPos, this.Objects.Canvas.yPos+this.Objects.Canvas.height, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, true, "right", "center", null, true); } //Set the x-axis name if (this.Params.xAxisName != "") { createText(this.getLevel(), this.Params.xAxisName, this.Objects.Canvas.xPos+(this.Objects.Canvas.width/2), this.Objects.Canvas.height+this.Objects.xAxisName.yPos, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, true, "center", "center", null, true); } //Y Axis Name if (this.Params.yAxisName != "") { createText(this.getLevel(), this.Params.yAxisName, this.Objects.yAxisName.xPos, this.Objects.Canvas.yPos+(this.Objects.Canvas.height/2), "Verdana", Number(this.Params.outCnvBaseFontSize)+1, this.Params.outCnvBaseFontColor, false, "center", "center", 270, true); } //Y-axis name //Now, set the x-axis labels (if its to be shown) for (i=1; i<=this.Params.num; i++) { if (this.data[i].showName == 1) { if (this.Params.rotateNames == 1) { //If the name is to be rendered in rotated style createText(this.getLevel(), this.data[i].name, this.data[i].xPos, this.Objects.Canvas.yPos+this.Objects.Canvas.height+2, _embedFontFace, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, false, "right", "center", this.Constants.catTextRotationAngle, true); } else { //Straight text createText(this.getLevel(), this.data[i].name, this.data[i].xPos, this.Objects.Canvas.yPos+this.Objects.Canvas.height+2, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, false, "center", "right", null, true); } } } //Render the chart caption if (this.Params.showCaption == 1) { createText(this.getLevel(), this.Params.caption, this.Objects.Canvas.xPos+(this.Objects.Canvas.width/2), this.Objects.Caption.yPos, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, true, "center", "center", null, true); } if (this.Params.showSubCaption == 1) { createText(this.getLevel(), this.Params.subCaption, this.Objects.Canvas.xPos+(this.Objects.Canvas.width/2), this.Objects.subCaption.yPos, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, true, "center", "center", null, true); } }; Chart.prototype.drawValues = function() { //This function sets the value textboxes //if the values are to be shown if (this.Params.showValues == 1) { for (i=1; i<=this.Params.num; i++) { if (this.data[i].showDataSet == 1) { //Create the textbox createText(this.getLevel(), this.formatNumber(this.data[i].value), this.data[i].valueTbX, this.data[i].valueTbY, this.Params.baseFont, this.Params.baseFontSize, this.Params.baseFontColor, false, "center", "center", null, true); } } } }; Chart.prototype.drawTrendLines = function(showOverlay) { //This function renders the trend lines on the chart //This function draws the div lines on the chart for (i=1; i<=this.Params.numTrendLines; i++) { //Draw the trend line only if none of the y values are undefined and the value is between the defined limits if (this.TrendLines[i].startYPos != undefined && this.TrendLines[i].endYPos != undefined && (this.TrendLines[i].startValue>=this.Params.yAxisMinValue && this.TrendLines[i].startValue<=this.Params.yAxisMaxValue) && (this.TrendLines[i].endValue>=this.Params.yAxisMinValue && this.TrendLines[i].endValue<=this.Params.yAxisMaxValue)) { //Draw the trendline if (this.TrendLines[i].showOnTop == showOverlay) { //If trend zone is to be made if (this.TrendLines[i].isTrendZone == 1) { this.drawRectangle(this.getLevel(), this.TrendLines[i].startXPos, this.TrendLines[i].startYPos, this.TrendLines[i].endXPos, this.TrendLines[i].endYPos, this.TrendLines[i].color, this.TrendLines[i].color, this.TrendLines[i].thickness, 0, this.TrendLines[i].alpha); //Also, render the text of this trendzone createText(this.getLevel(), this.TrendLines[i].displayValue, this.TrendLines[i].startXPos, this.TrendLines[i].startYPos+(this.TrendLines[i].endYPos-this.TrendLines[i].startYPos)/2, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.TrendLines[i].color, false, "right", "center", null, true); } else { //Create slanted trend line this.drawLine(this.TrendLines[i].startXPos, this.TrendLines[i].startYPos, this.TrendLines[i].endXPos, this.TrendLines[i].endYPos, this.TrendLines[i].thickness, this.TrendLines[i].color, this.TrendLines[i].alpha, this.getLevel()); //Also, render the text of this trendline line createText(this.getLevel(), this.TrendLines[i].displayValue, this.TrendLines[i].startXPos, this.TrendLines[i].startYPos, this.Params.outCnvBaseFont, this.Params.out levelOneNodes[i].attributes.yAxisMinvalue; this.Params.yAxisMaxValue = levelOneNodes[i].attributes.yAxisMaxvalue; //Configuration to set whether to show the names or not this.Params.showNames = Number(getFirstValue(levelOneNodes[i].attributes.showNames, "1")); this.Params.ShowValues = Number(getFirstValue(levelOneNodes[i].attributes.ShowValues, "0")); //Option to show/hide limits this.Params.showLimits = Number(getFirstValue(levelOneNodes[i].attributes.showLimits, "1")); //Option to show/hide limits this.Params.showLegend = Number(getFirstValue(levelOneNodes[i].attributes.showLegend, "1")); //Option to show vertical x-axis labels this.Params.rotateNames = Number(getFirstValue(levelOneNodes[i].attributes.rotateNames, "0")); //Animation this.Params.animation = Number(getFirstValue(levelOneNodes[i].attributes.animation, "1")); //Horizontal grid division Lines - Number, color, thickness & alpha this.Params.numDivLines = Number(getFirstValue(levelOneNodes[i].attributes.numDivLines, "4")); this.Params.divLineColor = formatHexColor(getFirstValue(levelOneNodes[i].attributes.divLineColor, "CCCCCC")); this.Params.divLineThickness = Number(getFirstValue(levelOneNodes[i].attributes.divLineThickness, "1")); this.Params.divLineAlpha = Number(getFirstValue(levelOneNodes[i].attributes.divLineAlpha, "100")); this.Params.showDivLineValue = Number(getFirstValue(levelOneNodes[i].attributes.showDivLineValue, "1")); //Vertical div lines this.Params.numVDivLines = Number(getFirstValue(levelOneNodes[i].attributes.numVDivLines, "0")); this.Params.vDivLineColor = formatHexColor(getFirstValue(levelOneNodes[i].attributes.vDivLineColor, this.Params.divLineColor)); this.Params.vDivLineThickness = Number(getFirstValue(levelOneNodes[i].attributes.vDivLineThickness, this.Params.divLineThickness)); this.Params.vDivLineAlpha = Number(getFirstValue(levelOneNodes[i].attributes.vDivLineAlpha, this.Params.divLineAlpha)); //Alternating grid colors this.Params.showAlternateHGridot of cosmetic properties that can be defined. We allow the user to take control of all those properties by specifying certain variables below. Variables that the user can specify in the chart container: PBarHeight - Required height for the progress bar. PBarWidth - Required width for the progress bar. PBarBorderColor - Border color of the progress bar PBarBorderThickness - Border thickness of the progress bar PBarBgColor - Progress bar background color (fill color of the bar) PBarTextColor - Color of the text PBarLoadingText - The actual loading text to be displayed Define local variables to store cosmetic properties */ var LPBarHeight, LPBarWidth, LPBarBorderColor, LPBarBorderThickness, LPBarBgColor, LPBarTextColor, LPBarLoadingText; //Set Progress bar Height LPBarHeight = Number(getFirstValue(_root.PBarHeight, "15")); /* Calculate the width of the progress bar :Explanation: How the width of the progress bar is being calculated? Basically, what we are aiming to do here is - Center align the progress bar elements with respect to the chart size. So, the width of the progress bar is set in such a way that is the chart width is greater than 200 pixels, the progress bar width will be 150 pixels. However, if the chart width is less than 200 pixels, then the progress bar width will be 25 pixels less than the chart width. */ LPBarWidth = (_chartWidth>200) ? 150 : (_chartWidth-25); //We also give the user an option to strong-enforce his own progress bar width value in case he wants something on his own. LPBarWidth = getFirstValue(_root.PBarWidth, LPBarWidth); LPBarBorderColor = getFirstValue(_root.PBarBorderColor, "E2E2E2"); LPBarBorderThickness = Number(getFirstValue(_root.PBarBorderThickness, "1")); LPBarBgColor = getFirstValue(_root.PBarBgColor, "E2E2E2"); LPBarTextColor = getFirstValue(_root.PBarTextColor, "666666"); LPBarLoadingText = getFirstValue(unescape(_root.PBarLoadingText), "Loading Chart. Please Wait"); //If the movie is already loaded (playing from local disk or cached), just send Island. 2. dataURL way - Only a URI (Uniform Resource Identifier) is provided to FusionCharts. The data source for this XML Data has been provided to us using the OBJECT/EMBED Method. Now, it's the job of FusionCharts to request XML data from that particular source. The parameter will be contained in _root.dataURL (data source URL) or _root.dataXML (full XML data). So, first check what we've been provided with - the complete XML Data or just the data source URL. If it's the former, we parse the string and store it in our system (or display error message if the data contains an error). The actions contained in FdataXMLHandler help us do this. If it's the latter, we first filter the dataURL given to us and then we instantiate the loading of the XML document from that particular URL. Also, we show a preloade for this URL. External Includes in the scene: /CodeBase/FCDataLoad.as - Contains data loading functions. */€€ DescriptionџџџџO€џџ€€elOneNodes[i].attributes.chartLeftMargin, "15")); this.Params.chartRightMargin = Number(getFirstValue(levelOneNodes[i].attributes.chartRightMargin, "15")); this.Params.chartTopMargin = Number(getFirstValue(levelOneNodes[i].attributes.chartTopMargin, "15")); this.Params.chartBottomMargin = Number(getFirstValue(levelOneNodes[i].attributes.chartBottomMargin, "15")); //All the properties have been extracted //Therefore, now we move on to extract the data contained in CATEGORIES, DATA and TRENDColor = Number(getFirstValue(levelOneNodes[i].attributes.showAlternateHGridColor, "0")); this.Params.alternateHGridColor = formatHexColor(getFirstValue(levelOneNodes[i].attributes.alternateHGridColor, this.Params.divLineColor)); this.Params.alternateHGridAlpha = Number(getFirstValue(levelOneNodes[i].attributes.alternateHGridAlpha, "30")); this.Params.showAlternateVGridColor = Number(getFirstValue(levelOneNodes[i].attributes.showAlternateVGridColor, "0")); this.Params.alternateVGridColor = formatHexColor(getFirstValue(levelOneNodes[i].attributes.alternateVGridColor, this.Params.VDivLineColor)); this.Params.alternateVGridAlpha = Number(getFirstValue(levelOneNodes[i].attributes.alternateVGridAlpha, "30")); //Zero Plane this.Params.zeroPlaneColor = formatHexColor(getFirstValue(levelOneNodes[i].attributes.zeroPlaneColor, "CCCCCC")); this.Params.zeroPlaneThickness = Number(getFirstValue(levelOneNodes[i].attributes.zeroPlaneThickness, "2")); this.Params.zeroPlaneAlpha = Number(getFirstValue(levelOneNodes[i].attributes.zeroPlaneAlpha, "100")); //Hover Caption - Show/Hide, Background Color, Border Color, Separator Character this.Params.showHoverCap = Number(getFirstValue(levelOneNodes[i].attributes.showHoverCap, "1")); this.Params.hoverCapBgColor = formatHexColor(getFirstValue(levelOneNodes[i].attributes.hoverCapBgColor, levelOneNodes[i].attributes.hoverCapBg, "F1F1F1")); this.Params.hoverCapBorderColor = formatHexColor(getFirstValue(levelOneNodes[i].attributes.hoverCapBorderColor, levelOneNodes[i].attributes.hoverCapBorder, "666666")); this.Params.hoverCapSepChar = getFirstValue(levelOneNodes[i].attributes.hoverCapSepChar, ", "); //Shadow properties this.Params.showShadow = Number(getFirstValue(levelOneNodes[i].attributes.showShadow, "1")); this.Params.shadowColor = formatHexColor(getFirstValue(levelOneNodes[i].attributes.shadowColor, "CCCCCC")); this.Params.shadowThickness = Number(getFirstValue(levelOneNodes[i].attributes.shadowThickness, this.Params.lineThickness+1)); this.Params.shadowAlpha = Number(getFirstValue(levelOneNodes[i].attributes.shadowAlpha, "100")); //Shadow x and y shift this.Params.shadowXShift = Number(getFirstValue(levelOneNodes[i].attributes.shadowXShift, 2)); this.Params.shadowYShift = Number(getFirstValue(levelOneNodes[i].attributes.shadowYShift, 2)); //Area properties this.Params.areaAlpha = Number(getFirstValue(levelOneNodes[i].attributes.areaAlpha, "90")); this.Params.areaBgColor = formatHexColor(getFirstValue(levelOneNodes[i].attributes.areaBgColor, "ff5904")); this.Params.showAreaBorder = Number(getFirstValue(levelOneNodes[i].attributes.showAreaBorder, "1")); this.Params.areaBorderThickness = Number(getFirstValue(levelOneNodes[i].attributes.areaBorderThickness, "2")); this.Params.areaBorderColor = formatHexColor(getFirstValue(levelOneNodes[i].attributes.areaBorderColor, this.Params.areaBgColor)); //Font Properties this.Params.baseFont = getFirstValue(levelOneNodes[i].attributes.baseFont, "Verdana"); this.Params.baseFontSize = Number(getFirstValue(levelOneNodes[i].attributes.baseFontSize, "9")); this.Params.baseFontColor = formatHexColor(getFirstValue(levelOneNodes[i].attributes.baseFontColor, "000000")); this.Params.outCnvBaseFont = getFirstValue(levelOneNodes[i].attributes.outCnvBaseFont, this.Params.baseFont); this.Params.outCnvBaseFontSize = Number(getFirstValue(levelOneNodes[i].attributes.outCnvBaseFontSize, this.Params.baseFontSize)); this.Params.outCnvBaseFontColor = formatHexColor(getFirstValue(levelOneNodes[i].attributes.outCnvBaseFontColor, this.Params.baseFontColor)); //Option whether the format the number (using Commas) this.Params.formatNumber = Number(getFirstValue(levelOneNodes[i].attributes.formatNumber, "1")); this.Params.formatNumberScale = Number(getFirstValue(levelOneNodes[i].attributes.formatNumberScale, "0")); //Number prefix and suffix this.Params.numberPrefix = getFirstValue(this.unescapeStr(levelOneNodes[i].attributes.numberPrefix), ""); this.Params.numberSuffix = getFirstValue(this.unescapeStr(levelOneNodes[i].attributes.numberSuffix), ""); //Decimal Separator Character this.Params.decimalSeparator = getFirstValue(levelOneNodes[i].attributes.decimalSeparator, "."); //Thousand Separator Character this.Params.thousandSeparator = getFirstValue(levelOneNodes[i].attributes.thousandSeparator, ","); //Decimal Precision (number of decimal places to be rounded to) this.Params.decimalPrecision = Number(getFirstValue(levelOneNodes[i].attributes.decimalPrecision, "2")); //Div Line display value decimal Precision this.Params.divLineDecimalPrecision = Number(getFirstValue(levelOneNodes[i].attributes.divLineDecimalPrecision, this.Params.decimalPrecision)); //Chart Limits display value decimal precision this.Params.limitsDecimalPrecision = Number(getFirstValue(levelOneNodes[i].attributes.limitsDecimalPrecision, this.Params.decimalPrecision)); //Decimal Precision cannot be less than 0 - so adjust it if (this.Params.decimalPrecision<0) { this.Params.decimalPrecision = 0; } //Chart Margins this.Params.chartLeftMargin = Number(getFirstValue(levelOneNodes[i].attributes.chartLeftMargin, "15")); this.Params.chartRightMargin = Number(getFirstValue(levelOneNodes[i].attributes.chartRightMargin, "15")); this.Params.chartTopMargin = Number(getFirstValue(levelOneNodes[i].attributes.chartTopMargin, "15")); this.Params.chartBottomMargin = Number(getFirstValue(levelOneNodes[i].attributes.chartBottomMargin, "15")); //All the properties have been extracted //Therefore, now we move on to extract the data contained in data, DATA and TRENDLINES nodes levelTwoNodes = levelOneNodes[i].childNodes; for (j=0; j<=levelTwoNodes.length; j++) { if (levelTwoNodes[j].nodeName.toUpperCase() == "SET") { this.Params.num++; //Extract the attributes var setValue = levelTwoNodes[j].attributes.value; var setLink = unescape(levelTwoNodes[j].attributes.link); var setName = getFirstValue(levelTwoNodes[j].attributes.namethe control to DataLoad scene if (getBytesLoaded() == getBytesTotal()) { gotoAndPlay("DataLoad", 1); } else { //If the control is here, it means the movie isn't still loaded - so, we need to build up the preloader. //We now draw the progress bar at the center of the stage. To do this, we create an instance of the FCProgessBar class attachMovie("FCProgressBar", "FCPB", 1); FCPB.setLimits(0, getBytesTotal()); FCPB.setPosition(_chartHorCenter-(LPBarWidth/2), _chartVerCenter); FCPB.setSize(LPBarWidth, LPBarHeight); FCPB.setColors(LPBarBgColor, LPBarBorderColor); FCPB.setBorderThickness(LPBarBorderThickness); FCPB.setValue(getBytesLoaded()); FCPB.draw(); //Create the loading text createText(2, LPBarLoadingText, _chartHorCenter, _chartVerCenter-(LPBarHeight/2), "Verdana", "10", LPBarTextColor, false, "center", "left", null, false); //Create the preloader sequence _root.onEnterFrame = function() { if (getBytesLoaded()intMaxVal && this.data[i].showDataSet == 1) { intMaxVal = this.data[i].value; } } //Return the value return intMaxVal; }; Chart.prototype.getYAxisMinValue = function() { //This method returns the lowest y-axis value //By default we assume the min value to be that of the first dCnvBaseFontSize, this.TrendLines[i].color, false, "right", "center", null, true); } } } } }; Chart.prototype.drawZeroPlane = function() { //This function renders the zero plane on the chart if (this.Params.showZeroPlane) { this.drawLine(this.Objects.Canvas.xPos, this.Params.zeroPlanePos, this.Objects.Canvas.xPos+this.Objects.Canvas.width, this.Params.zeroPlanePos, this.Params.zeroPlaneThickness, this.Params.zeroPlaneColor, this.Params.zeroPlaneAlpha, this.getLevel()); //Render the text of thata var intMinVal = this.data[1].value; //Now, iterate through each of the values to compare //Iterate through each of the data for (i=1; i<=this.Params.num; i++) { if (this.data[i].valueminValue) { this.Params.yAxisMinValue = y_lowerBound; } this.Params.yAxisMaxValue = Number(this.Params.yAxisMaxValue); this.Params.yAxisMinValue = Number(this.Params.yAxisMinValue); }; Chart.prototype.calculatePoints = function() { //This function calculates the pixel co-ordinates of all //the elements on the chart. //Calculate the y axis interval this.Params.yAxisInterval = this.Params.yAxisMaxValue-this.Params.yAxisMinValue; //First, we'll calculate the height, start y pos & end y position of the canvas //We first assume the canvas height to be of the same size as the stage height //Step by step, we'll now deduct the margins and elements height to get the actual height var LCanvasHeight = _chartHeight; var LCanvasWidth = _chartWidth; var LCanvasStartX, LCanvasEndX, LCanvasStartY, LCanvasEndY; var verticalBlockedHt = 0; var horizontalBlockWd = 0; //Deduct the top and bottom margins LCanvasHeight = LCanvasHeight-(this.Params.chartTopMargin+this.Params.chartBottomMargin); verticalBlockedHt = this.Params.chartTopMargin; //Now, if the caption is to be shown, deduct the height of the caption var LCaption; if (this.Params.showCaption == 1) { LCaption = createText(25001, this.Params.caption, this.Constants.calcTextXPos, this.Constants.calcTextYPos, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, true, "center", "center", null, true); //Create an object in this.objects representing this caption object this.objects.caption = new Chart.cObject(_FCXShift, _FCYShift+verticalBlockedHt+(LCaption.textHeight/2), LCaption.textHeight, LCaption.textWidth); //Add to blocked height and canvas size LCanvasHeight = LCanvasHeight-LCaption.textHeight; verticalBlockedHt = verticalBlockedHt+LCaption.textHeight; } //Space for sub caption if (this.Params.showSubCaption == 1) { LCaption = createText(25001, this.Params.subCaption, this.Constants.calcTextXPos, this.Constants.calcTextYPos, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, true, "center", "center", null, true); //Create an object in this.objects representing this caption object this.objects.subCaption = new Chart.cObject(_FCXShift, _FCYShift+verticalBlockedHt+(LCaption.textHeight/2), LCaption.textHeight, LCaption.textWidth); //Add to blocked height and canvas size LCanvasHeight = LCanvasHeight-LCaption.textHeight; verticalBlockedHt = verticalBlockedHt+LCaption.textHeight; } //Extra space - 20 pixels - only required if caption/subcaption to be shown if ((this.Params.showCaption == 1) || (this.Params.showSubCaption == 1)) { LCanvasHeight = LCanvasHeight-20; verticalBlockedHt = verticalBlockedHt+20; } LCanvasStartY = _FCYShift+verticalBlockedHt; //Now, we get the height of the x-axis labels (data) var LMaxCatNameHeight = 0; var LCatNameHeight = 0; //We'll calculate the max length of the x-axis label height (if the labels are to be shown) if (this.Params.shownames == 1) { for (i=1; i<=this.Params.num; i++) { if (this.data[i].showName == 1) { if (this.Params.rotateNames == 1) { //If the name is to be rendered in rotated style LCatNameHeight = createText(25001, this.data[i].name, this.Constants.calcTextXPos, this.Constants.calcTextYPos, _embedFontFace, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, false, "center", "center", this.Constants.catTextRotationAngle, true).textHeight; } else { //Straight text LCatNameHeight = createText(25001, this.data[i].name, this.Constants.calcTextXPos, this.Constants.calcTextYPos, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, false, "center", "center", this.Params.rotateNames, true).textHeight; } } //Now, if the current cat height is more than the previous text height //Override the value if (LCatNameHeight>LMaxCatNameHeight) { LMaxCatNameHeight = LCatNameHeight; } } //Deduct them from space blocked and total space LCanvasHeight = LCanvasHeight-LMaxCatNameHeight; verticalBlockedHt = verticalBlockedHt+LMaxCatNameHeight; } //Now, for x-axis name //Space for sub caption if (this.Params.xAxisName != "") { LCaption = createText(25001, this.Params.xAxisName, this.Constants.calcTextXPos, this.Constants.calcTextYPos, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, true, "center", "center", null, true); //Create an object in this.objects representing this caption object this.objects.xAxisName = new Chart.cObject(_FCXShift, _FCYShift+verticalBlockedHt+(LCaption.textHeight/2), LCaption.textHeight, LCaption.textWidth); //Add to blocked height and canvas size LCanvasHeight = LCanvasHeight-LCaption.textHeight; verticalBlockedHt = verticalBlockedHt+LCaption.textHeight; } //Calculate the end Y of the canvas LCanvasEndY = LCanvasStartY+LCanvasHeight; //********* For the start and end X of the canvas ********* //Add the left margin horizontalBlockWd = horizontalBlockWd+this.Params.chartLeftMargin; LCanvasWidth = LCanvasWidth-(this.Params.chartLeftMargin+this.Params.chartRightMargin); var horizontalMaxLength = 0; var horTextWidth, horTextWidth_2; //Now, we need to get the max length of the text of either of the following: //Y-axis name //Limit textboxes //Div Line Textboxes //Trend Line textboxes if (this.Params.yAxisName != "") { //Get the textwidth for y axis name horTextWidth = createText(25001, this.Params.yAxisName, this.Constants.calcTextXPos, this.Constants.calcTextYPos, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, false, "center", "center", 270, true).textWidth; //So-set the canvas start and end position horizontalBlockWd = horizontalBlockWd+horTextWidth; LCanvasWidth = LCanvasWidth-horizontalBlockWd; //Create an object representing the y axis name this.objects.yAxisName = new Chart.cObject(_FCXShift+horizontalBlockWd-horTextWidth, _FCYShift, horTextWidth, 0); } //First, we count for the limits textboxes (if they are to be shown) if (this.Params.showLimits == 1) { //Get the textwidth for upper limit horTextWidth = createText(25001, this.formatNumber(this.Params.yAxisMaxValue, this.Params.limitsDecimalPrecision), this.Constants.calcTextXPos, this.Constants.calcTextYPos, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, false, "center", "center", null, true).textWidth; //Count for lower limit horTextWidth_2 = createText(25001, this.formatNumber(this.Params.yAxisMinValue, this.Params.limitsDecimalPrecision), this.Constants.calcTextXPos, this.Constants.calcTextYPos, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, false, "center", "center", null, true).textWidth; //Get the higher value if (horTextWidth>horTextWidth_2) { horizontalMaxLength = horTextWidth; } else { horizontalMaxLength = horTextWidth_2; } } //Now, we calculate the div lines values (if needed) var divLineValue; //Get the value for each div line to be created for (i=1; i<=this.Params.numDivLines; i++) { divLineValue = (this.Params.yAxisMinValue+i*(this.Params.yAxisInterval/(this.Params.numDivLines+1))); //Format this div line value and set it in a div line object this.Divlines[this.Params.numDivLines-i+1] = new Chart.divLine(divLineValue, this.formatNumber(divLineValue, this.Params.divLineDecimalPrecision), this.Params.showDivLineValue); //Now, if the div line text is to be shown, get the text width if (this.Params.showDivLineValue == 1) { horTextWidth = createText(25001, this.Divlines[i].displayValue, this.Constants.calcTextXPos, this.Constants.calcTextYPos, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, false, "center", "center", null, true).textWidth; //If it's greater, then re-set the max length if (horTextWidth>horizontalMaxLength) { horizontalMaxLength = horTextWidth; } } } //Now, we count for the width of trend line display values if any for (i=0; i<=this.Params.numTrendLines; i++) { horTextWidth = createText(25001, this.TrendLines[i].displayValue, this.Constants.calcTextXPos, this.Constants.calcTextYPos, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, false, "center", "center", null, true).textWidth; //If it's greater, then re-set the max length if (horTextWidth>horizontalMaxLength) { horizontalMaxLength = horTextWidth; } } //Now, we have the maximum text length //So-set the canvas start and end position horizontalBlockWd = horizontalBlockWd+horizontalMaxLength; LCanvasWidth = LCanvasWidth-horizontalMaxLength; LCanvasStartX = _FCXShift+horizontalBlockWd; LCanvasEndX = LCanvasStartX+LCanvasWidth; //Create a canvas object in this.Objects this.Objects.canvas = new Chart.cObject(LCanvasStartX, LCanvasStartY, LCanvasHeight, LCanvasWidth); //Now that we have the canvas size calculate, we calculate the position of the various elements on the chart //------------------------------------------------------------// //We now get the position of all the columns on the chart //Determine the per-unit-pixel factor this.Params.perUnitPixels = this.Objects.Canvas.height/this.Params.yAxisInterval; //Zero plane position calculation //Set the negativeNumPresent and showZeroPlane flag to the correct value if (this.Params.negativeNumPresent || this.Params.yAxisMinValue<0) { if (this.Params.yAxisMaxValue>=0) { this.Params.showZeroPlane = true; } } //Now if the zero plane is to be shown, calculate the zero plane pos if (this.Params.showZeroPlane) { this.Params.zeroPlanePos = (this.Objects.Canvas.yPos+this.Objects.Canvas.height)-(this.Params.perUnitPixels*(0-this.Params.yAxisMinValue)); } else { this.Params.zeroPlanePos = (this.Objects.Canvas.yPos+this.Objects.Canvas.height); } //Get the width of individual area var areaWidth; areaWidth = this.Objects.Canvas.width/(this.Params.num-1); //Assign to global this.Params.areaWidth = areaWidth; //Get the position of the area segments now for (i=1; i<=this.Params.num; i++) { //For the x pos of the area and the data this.data[i].xPos = this.Objects.Canvas.xPos+(i-1)*this.Params.areaWidth; if (this.Params.yAxisMinValue>=0) { this.data[i].yPos = this.Params.zeroPlanePos-((this.data[i].value-Math.abs(this.Params.yAxisMinValue))*this.Params.perUnitPixels); } else { this.data[i].yPos = this.Params.zeroPlanePos-((this.data[i].value)*this.Params.perUnitPixels); } this.data[i].valueTbX = this.data[i].xPos; if (this.data[i].value>=0) { this.data[i].valueTbY = this.data[i].yPos-10; } else { this.data[i].valueTbY = this.data[i].yPos+10; } } //Now, horizontal divlines var divLineHorizontalSpace; divLineHorizontalSpace = this.Objects.Canvas.height/(this.Params.numDivLines+1); for (i=1; i<=this.Params.numDivLines; i++) { //Start and end position of a div line is the same as that of the canvas this.Divlines[i].startXPos = this.Objects.Canvas.xPos; this.Divlines[i].endXPos = this.Objects.Canvas.xPos+this.Objects.Canvas.width; //Calculate the y position of the div line this.Divlines[i].startYPos = this.Objects.Canvas.yPos+(divLineHorizontalSpace*i); this.Divlines[i].endYPos = this.Objects.Canvas.yPos+(divLineHorizontalSpace*i); } //Calculate the x and y positions of the trend lines for (i=1; i<=this.Params.numTrendLines; i++) { //Set the x position this.TrendLines[i].startXPos = this.Objects.Canvas.xPos; this.TrendLines[i].endXPos = this.Objects.Canvas.xPos+this.Objects.Canvas.width; this.TrendLines[i].startYPos = this.getAxisPosition(this.TrendLines[i].startValue, this.Params.yAxisMaxValue, this.Params.yAxisMinValue, this.Objects.Canvas.yPos, this.Objects.Canvas.yPos+this.Objects.Canvas.height, -1); this.TrendLines[i].endYPos = this.getAxisPosition(this.TrendLines[i].endValue, this.Params.yAxisMaxValue, this.Params.yAxisMinValue, this.Objects.Canvas.yPos, this.Objects.Canvas.yPos+this.Objects.Canvas.height, -1); } }; Chart.prototype.formatNumber = function(number, decimalPrecision) { //This function formats a number in FusionCharts format //decimalPrecision here is optional var precision; //If no decimalPrecision specified take the global one if (decimalPrecision == undefined || decimalPrecision == null) { precision = this.Params.decimalPrecision; } else { precision = decimalPrecision; } var intNum = number; var strScale = ""; //If number is to be scaled if (this.Params.formatNumberScale == 1) { if (Math.abs(intNum)>=1000) { strScale = "K"; intNum = intNum/1000; } if (Math.abs(intNum)>=1000) { strScale = "M"; intNum = intNum/1000; } } //Convert it into string var strNum = String(intNum); //We format the number if required if (this.Params.formatNumber == 1) { //Format the decimal precision strNum = Math.formatDecimals(intNum, precision); //Format the commas in the number strNum = formatCommas(String(strNum), this.Params.thousandSeparator, this.Params.decimalSeparator); } //Now, we append the prefix and the suffix strNum = this.Params.numberPrefix+strNum+strScale+this.Params.numberSuffix; return strNum; }; Chart.prototype.getLevel = function() { //This function returns the highest current level in the movie which does not contain an object. //Increase the last depth _global._FCLastLevel++; //Return it return _global._FCLastLevel; }; Chart.prototype.getAxisPosition = function(value, upperLimit, lowerLimit, startAxisPos, endAxisPos, isYAxis) { //This function returns the axis position of a value on an axis //having specified upper limit and lower limit and specified axes positions //Set default for isYAxis if (isYAxis == null || isYAxis == undefined) { isYAxis = false; } var numericalInterval = (upperLimit-lowerLimit); if (isYAxis) { var positionInterval = (endAxisPos-startAxisPos); var relativePosition = (positionInterval/numericalInterval)*(value-lowerLimit); //If it's a y axis co-ordinate then go according to Flash's co-ordinate system //(y decreases as we go upwards) var absolutePosition = endAxisPos-relativePosition; } else { var positionInterval = (endAxisPos-startAxisPos)-(2*this.Constants.CCanvasPadding); var relativePosition = (positionInterval/numericalInterval)*(value-lowerLimit); //The normal x-axis rule - increases as we go right var absolutePosition = startAxisPos+this.Constants.CCanvasPadding+relativePosition; } return absolutePosition; }; //**** Chart Element Rendering Methods ****// Chart.prototype.drawBackground = function() { //This function renders the background of the chart var level = this.getLevel(); //Set start level index this.Params.chartStartLevel = level; this.drawRectangle(this.getLevel(), _FCXShift, _FCYShift, _FCXShift+_chartWidth, _FCYShift+_chartHeight, this.Params.bgColor, this.Params.bgColor, 0, 0, this.Params.bgAlpha); }; Chart.prototype.loadBgSWF = function() { //This function loads the background chart swf file //First create a container movie clip createEmptyMovieClip("ASMov_bgSWF", this.getLevel()); //Get a reference to the same mcbgSWF = eval("ASMov_bgSWF"); //Load the external movie mcbgSWF.loadMovie(this.Params.bgSWF); }; Chart.prototype.drawCanvas = function() { //This function renders the canvas of the chart //Basically, the canvas is a small rectangle with the specified fill and border color this.drawRectangle(this.getLevel(), this.Objects.Canvas.xPos, this.Objects.Canvas.yPos, this.Objects.Canvas.xPos+this.Objects.Canvas.width, this.Objects.Canvas.yPos+this.Objects.Canvas.height, this.Params.canvasBorderColor, this.Params.canvasBgColor, 0, 0, this.Params.canvasBgAlpha); }; Chart.prototype.drawCanvasBorder = function() { //This function renders the overlay canvas border of the chart this.drawRectangle(this.getLevel(), this.Objects.Canvas.xPos, this.Objects.Canvas.yPos, this.Objects.Canvas.xPos+this.Objects.Canvas.width, this.Objects.Canvas.yPos+this.Objects.Canvas.height, this.Params.canvasBorderColor, this.Params.canvasBgColor, this.Params.canvasBorderThickness, 100, 0); }; Chart.prototype.drawGridBg = function() { //This function renders the grid background //First render the vertical grid background var verticalDivSpacing; var verticalGridStartXPos; var verticalGridEndXPos; verticalDivSpacing = this.Objects.Canvas.width/(this.Params.numVDivLines+1); for (i=1; i<=this.Params.numVDivLines+1; i=i+2) { //Start from left //Get the positions verticalGridStartXPos = this.Objects.Canvas.xPos+((i-1)*verticalDivSpacing); verticalGridEndXPos = this.Objects.Canvas.xPos+(i*verticalDivSpacing); //Show only if to be shown and if vertical div lines are more than 1 if ((this.Params.showAlternateVGridColor == 1) && (this.Params.numVDivLines>1)) { this.drawRectangle(this.getLevel(), verticalGridStartXPos, this.Objects.Canvas.yPos, verticalGridEndXPos, this.Objects.Canvas.yPos+this.Objects.Canvas.height, "ffffff", this.Params.alternateVGridColor, 0, 0, this.Params.alternateVGridAlpha); } } //Now render the horizontal grid background for (i=1; i<=this.Params.numDivLines; i=i+2) { //Start from top //Show only if to be shown and if vertical div lines are more than 1 if ((this.Params.showAlternateHGridColor == 1) && (this.Params.numDivLines>1)) { if (i == this.Params.numDivLines) { //Now if it has reached the last one - the end position will be end of canvas this.drawRectangle(this.getLevel(), this.divLines[i].startXPos, this.divLines[i].startYPos, this.Objects.Canvas.xPos+this.Objects.Canvas.width, this.Objects.Canvas.yPos+this.Objects.Canvas.height, "ffffff", this.Params.alternateHGridColor, 0, 0, this.Params.alternateHGridAlpha); } else { //Normal - between 2 existing div line objects - Create the rectangle this.drawRectangle(this.getLevel(), this.divLines[i].startXPos, this.divLines[i].startYPos, this.divLines[i+1].endXPos, this.divLines[i+1].endYPos, "ffffff", this.Params.alternateHGridColor, 0, 0, this.Params.alternateHGridAlpha); } } } }; Chart.prototype.drawDivLines = function() { //This function draws the div lines on the chart for (i=1; i<=this.Params.numDivLines; i++) { //Draw the div line this.drawLine(this.divLines[i].startXPos, this.divLines[i].startYPos, this.divLines[i].endXPos, this.divLines[i].endYPos, this.Params.divLineThickness, this.Params.divlinecolor, this.Params.divLineAlpha, this.getLevel()); //Also, render the text of this div line if (this.divLines[i].showValue == 1) { if (!((this.Params.showZeroPlane) && (this.divLines[i].value == 0))) { createText(this.getLevel(), this.divLines[i].displayValue, this.divLines[i].startXPos, this.divLines[i].startYPos, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, false, "right", "center", null, true); } } } //We'll also render the vertial div lines //Vertical div lines var verticalDivSpacing; var verticalDivLineXPos; verticalDivSpacing = this.Objects.Canvas.width/(this.Params.numVDivLines+1); for (i=1; i<=this.Params.numVDivLines; i++) { verticalDivLineXPos = this.Objects.Canvas.xPos+(i*verticalDivSpacing); this.drawLine(verticalDivLineXPos, this.Objects.Canvas.yPos, verticalDivLineXPos, this.Objects.Canvas.yPos+this.Objects.Canvas.height, this.Params.VDivLineThickness, this.Params.VDivlinecolor, this.Params.VDivLineAlpha, this.getLevel()); } }; Chart.prototype.setLabels = function() { //This function sets the various labels on the chart //We first set the limits (if needed) if (this.Params.showLimits == 1) { //Upper Limit createText(this.getLevel(), this.formatNumber(this.Params.yAxisMaxValue, this.Params.limitsDecimalPrecision), this.Objects.Canvas.xPos, this.Objects.Canvas.yPos, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, true, "right", "center", null, true); //Lower Limit createText(this.getLevel(), this.formatNumber(this.Params.yAxisMinValue, this.Params.limitsDecimalPrecision), this.Objects.Canvas.xPos, this.Objects.Canvas.yPos+this.Objects.Canvas.height, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, true, "right", "center", null, true); } //Set the x-axis name if (this.Params.xAxisName != "") { createText(this.getLevel(), this.Params.xAxisName, this.Objects.Canvas.xPos+(this.Objects.Canvas.width/2), this.Objects.Canvas.height+this.Objects.xAxisName.yPos, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, true, "center", "center", null, true); } //Y Axis Name if (this.Params.yAxisName != "") { createText(this.getLevel(), this.Params.yAxisName, this.Objects.yAxisName.xPos, this.Objects.Canvas.yPos+(this.Objects.Canvas.height/2), "Verdana", Number(this.Params.outCnvBaseFontSize)+1, this.Params.outCnvBaseFontColor, false, "center", "center", 270, true); } //Y-axis name //Now, set the x-axis labels (if its to be shown) for (i=1; i<=this.Params.num; i++) { if (this.data[i].showName == 1) { if (this.Params.rotateNames == 1) { //If the name is to be rendered in rotated style createText(this.getLevel(), this.data[i].name, this.data[i].xPos, this.Objects.Canvas.yPos+this.Objects.Canvas.height+2, _embedFontFace, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, false, "right", "center", this.Constants.catTextRotationAngle, true); } else { //Straight text createText(this.getLevel(), this.data[i].name, this.data[i].xPos, this.Objects.Canvas.yPos+this.Objects.Canvas.height+2, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, false, "center", "right", null, true); } } } //Render the chart caption if (this.Params.showCaption == 1) { createText(this.getLevel(), this.Params.caption, this.Objects.Canvas.xPos+(this.Objects.Canvas.width/2), this.Objects.Caption.yPos, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, true, "center", "center", null, true); } if (this.Params.showSubCaption == 1) { createText(this.getLevel(), this.Params.subCaption, this.Objects.Canvas.xPos+(this.Objects.Canvas.width/2), this.Objects.subCaption.yPos, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, true, "center", "center", null, true); } }; Chart.prototype.drawValues = function() { //This function sets the value textboxes //if the values are to be shown if (this.Params.showValues == 1) { for (i=1; i<=this.Params.num; i++) { if (this.data[i].showDataSet == 1) { //Create the textbox createText(this.getLevel(), this.formatNumber(this.data[i].value), this.data[i].valueTbX, this.data[i].valueTbY, this.Params.baseFont, this.Params.baseFontSize, this.Params.baseFontColor, false, "center", "center", null, true); } } } }; Chart.prototype.drawTrendLines = function(showOverlay) { //This function renders the trend lines on the chart //This function draws the div lines on the chart for (i=1; i<=this.Params.numTrendLines; i++) { //Draw the trend line only if none of the y values are undefined and the value is between the defined limits if (this.TrendLines[i].startYPos != undefined && this.TrendLines[i].endYPos != undefined && (this.TrendLines[i].startValue>=this.Params.yAxisMinValue && this.TrendLines[i].startValue<=this.Params.yAxisMaxValue) && (this.TrendLines[i].endValue>=this.Params.yAxisMinValue && this.TrendLines[i].endValue<=this.Params.yAxisMaxValue)) { //Draw the trendline if (this.TrendLines[i].showOnTop == showOverlay) { //If trend zone is to be made if (this.TrendLines[i].isTrendZone == 1) { this.drawRectangle(this.getLevel(), this.TrendLines[i].startXPos, this.TrendLines[i].startYPos, this.TrendLines[i].endXPos, this.TrendLines[i].endYPos, this.TrendLines[i].color, this.TrendLines[i].color, this.TrendLines[i].thickness, 0, this.TrendLines[i].alpha); //Also, render the text of this trendzone createText(this.getLevel(), this.TrendLines[i].displayValue, this.TrendLines[i].startXPos, this.TrendLines[i].startYPos+(this.TrendLines[i].endYPos-this.TrendLines[i].startYPos)/2, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.TrendLines[i].color, false, "right", "center", null, true); } else { //Create slanted trend line this.drawLine(this.TrendLines[i].startXPos, this.TrendLines[i].startYPos, this.TrendLines[i].endXPos, this.TrendLines[i].endYPos, this.TrendLines[i].thickness, this.TrendLines[i].color, this.TrendLines[i].alpha, this.getLevel()); //Also, render the text of this trendline line createText(this.getLevel(), this.TrendLines[i].displayValue, this.TrendLines[i].startXPos, this.TrendLines[i].startYPos, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.TrendLines[i].color, false, "right", "center", null, true); } } } } }; Chart.prototype.drawZeroPlane = function() { //This function renders the zero plane on the chart if (this.Params.showZeroPlane) { this.drawLine(this.Objects.Canvas.xPos, this.Params.zeroPlanePos, this.Objects.Canvas.xPos+this.Objects.Canvas.width, this.Params.zeroPlanePos, this.Params.zeroPlaneThickness, this.Params.zeroPlaneColor, this.Params.zeroPlaneAlpha, this.getLevel()); //Render the text of the zero plane createText(this.getLevel(), this.formatNumber("0"), this.Objects.Canvas.xPos, this.Params.zeroPlanePos, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, true, "right", "center", null, true); } }; Chart.prototype.drawAnchors = function() { //Render the anchors if the hover caption is to be shown if (this.Params.showHoverCap == 1) { var anchorLevel; //First check whether the anchors are to be shown for this particular dataset for (i=1; i<=this.Params.num; i++) { if (this.data[i].showDataSet == 1) { //Create a empty movie clip anchorLevel = this.getLevel(); _root.createEmptyMovieClip("ASMovAnchor_"+i+"_"+anchorLevel, anchorLevel); //Get a reference to it mcAnchor = _root["ASMovAnchor_"+i+"_"+anchorLevel]; mcAnchor.lineStyle(1, parseInt(this.Params.anchorBorderColor, 16), 1); mcAnchor.beginFill(parseInt(this.Params.anchorBgColor, 16), 1); mcAnchor.drawPoly(this.data[i].xPos, this.data[i].yPos, 5, 4, 90); mcAnchor.endFill(); //Set alpha mcAnchor._alpha = 0; //Create the event handlers for the anchor //First convey the properties mcAnchor.dataIndex = i; //If a link has been defined for the candle stick if (this.data[i].link == "" || this.data[i].link == undefined || this.data[i].link == null) { //Dont' use a hand cursor mcAnchor.useHandCursor = false; } else { //Set the click event handlers mcAnchor.onRelease = function() { FCChart.linkClick(this.dataIndex); }; } //Hover Caption event handlers mcAnchor.onRollOver = function() { FCChart.setHoverCap(this.dataIndex); }; mcAnchor.onRollOut = function() { FCChart.removeHoverCap(this.dataIndex); }; delete mcAnchor; } } } }; Chart.prototype.linkClick = function(dataIndex) { //This function navigates to a URL when a column is clicked on the chart. var linkToNav = this.data[dataIndex].link; if (linkToNav != undefined) { //We determine if a window is to be opened var strLink = new String(linkToNav); if ((strLink.CharAt(0) == "n" && strLink.CharAt(1) == "-") || (strLink.CharAt(0) == "N" && strLink.CharAt(1) == "-")) { //Means we have to open the link in a new window. //First we get the exact Link without n: finalLink = strLink.slice(2); getURL(finalLink, "_blank"); } else { //In the same window getURL(linkToNav, "_self"); } } }; Chart.prototype.renderHoverCap = function() { //This function renders the *raw* hover caption box with un-filled values //First check if Hover Caption box is required ? if (this.Params.showHoverCap == 1) { //Get the level in which hover caption will be created this.Params.hoverCapLevel = 25000+this.getLevel(); //Create the text field createTextField("ASMovHoverCaption", this.Params.hoverCapLevel, 0, 0, w, h); hoverCaption._visible = true; } }; Chart.prototype.setHoverCap = function(dataIndex) { //This function sets the position and the text values //of the hover caption box with index as the passed index if (this.Params.showHoverCap == 1) { //If hover cap is to be shown. //Create a new text-format var LHoverCapFormat = new TextFormat(); LHoverCapFormat.align = "left"; LHoverCapFormat.color = parseInt(this.Params.BaseFontColor, 16); LHoverCapFormat.font = this.Params.BaseFont; LHoverCapFormat.size = this.Params.BaseFontSize; LHoverCapFormat.leftMargin = 0; LHoverCapFormat.rightMargin = 0; //Now, make the hover caption textbox visible. ASMovHoverCaption = eval("ASMovHoverCaption"); ASMovHoverCaption._visible = true; //Create the text dsVal = this.formatNumber(this.data[dataIndex].value); var strText = ""; strText = strText+this.data[dataIndex].hoverText+this.Params.hoverCapSepChar+dsVal; ASMovHoverCaption.html = true; ASMovHoverCaption.htmlText = strText; ASMovHoverCaption.setTextFormat(LHoverCapFormat); ASMovHoverCaption.autoSize = true; ASMovHoverCaption.border = true; ASMovHoverCaption.borderColor = parseInt(this.Params.hoverCapBorderColor, 16); ASMovHoverCaption.background = true; ASMovHoverCaption.backgroundColor = parseInt(this.Params.hoverCapBgColor, 16); ASMovHoverCaption.multiline = true; ASMovHoverCaption.selectable = false; ASMovHoverCaption.tabEnabled = false; ASMovHoverCaption.type = "dynamic"; ASMovHoverCaption.wordWrap = false; //Set the x position if (this.data[dataIndex].xPos+ASMovHoverCaption._width/2>=(_FCXShift+_chartWidth)) { //Align on left ASMovHoverCaption._x = (_FCXShift+_chartWidth)-ASMovHoverCaption._width-1; } else if (this.data[dataIndex].xPos<=ASMovHoverCaption._width/2) { ASMovHoverCaption._x = 1; } else { //Normal - center aligned ASMovHoverCaption._x = this.data[dataIndex].xPos-ASMovHoverCaption._width/2; } //Set its y pos to the current y mouse pos ASMovHoverCaption._y = _ymouse-ASMovHoverCaption._height-5; } }; Chart.prototype.removeHoverCap = function() { //This function hides the hover caption ASMovHoverCaption._visible = false; }; //**** General Methods *****// /* General methods are those methods which can be used with any other Flash movies for some common jobs like font rendering, shapes drawing etc. */ Chart.prototype.drawLine = function(fromX, fromY, toX, toY, lineThickness, lineColor, lineAlpha, depth) { //This function draws a line segment on the canvas based on the arguments //************** PARAMETERS ****************// //fromX - from X point //fromY - from Y point //toX - to X point //toY - to Y point //lineThickness - thickness of the line //lineColor - Color - without # like FFDDDD, 000000 //lineAlpha - Alpha of the line //depth - MC depth //******************************************// //Returns nothing //First, create a movie clip container createEmptyMovieClip("ASMovLine_"+depth, depth); mcLine = eval("ASMovLine_"+depth); mcLine.clear(); //Set the line style mcLine.lineStyle(lineThickness, parseInt(lineColor, 16), lineAlpha); //Move to position fromX, fromY mcLine.moveTo(fromX, fromY); //Draw line mcLine.lineTo(toX, toY); //remove object delete mcLine; }; Chart.prototype.drawRectangle = function(depth, fromX, fromY, toX, toY, borderColor, bgColor, borderThickness, borderAlpha, bgAlpha) { //This function draws a rectangle on the canvas based on the arguments //************** PARAMETERS ****************// //depth - Level in which this rectangle will be rendered //fromX - Starting X Position //fromY - Starting Y Position //toX - Ending X Position //toY - Ending Y Position //borderColor - Border Color of the rectangle //bgColor - Background Color of the rectangle //borderThickness - Thickness of the border of the rectangle (in pixels) //borderAlpha - Alpha (Transparency) of the border //bgAlpha - Alpha (Transparency) of the background //******************************************// //Returns nothing //First, create a movie clip container //This function draws a rectangle based on the parameters passed to it. createEmptyMovieClip("ASMovRect_"+depth, depth); mcRect = eval("ASMovRect_"+depth); mcRect.beginFill(parseInt(bgColor, 16), bgAlpha); mcRect.lineStyle(borderThickness, parseInt(borderColor, 16), borderAlpha); mcRect.moveTo(fromX, fromY); mcRect.lineTo(toX, fromY); mcRect.lineTo(toX, toY); mcRect.lineTo(fromX, toY); mcRect.lineTo(fromX, fromY); mcRect.endFill(); //Clear memory resources delete mcRect; }; Chart.prototype.unescapeStr = function(str) { //This function unescapes a string, if the dataURL method is used var unStr = str; if (LboolIsURLProvided == true) { unStr = unescape(unStr); } return unStr; }; €€ Chart ClassџџџџO€џџ€€€€џџџ?џџЎrЬ//Include external relevant files //Utility Functions #include "../CodeBase/FCFunctions.as" //Utility Math routines #include "../CodeBase/FCMath.as" //Movie Clip #include "../CodeBase/FCMovieClip_Poly.as"€€ External IncludesџџџџџOџџ€€џџ CPicSpriteCюќџџ Cюќџџџџџџ_€€џџџ?џџRi€€ Embedded TextџџџџџџOџ€€€€џџџ?џџёmџ6/* Scene Name: Chart =========================================================================== This is the main scene of the entire movie where the actual chart is rendered. In this scene, we do the following: 1. Parse the XML data document to retrieve data from it and store in our local objects 2. Do various calculations to get the co-ordinates and values for all elements of the chart. 3. Render all the visual elements of the chart. External Includes in the scene: /CodeBase/FCFunctions.as - Utility Functions /CodeBase/FCMath.as - Utility Math Functions */€€ Descriptionџџџџ™3Ьџ€€€€ DescriptџџCPicPageџџ CPicLayerџџ CPicFrame€€џџџ?џџ FInitializeёZ€€ LabelsџџџџOџOџ€€€€џџџ?џџЛAџ,//-------------------------// //Chart Initialization here// //-------------------------// /* Set local width and height - this local width and height would be assumed if the user hasn't specified an exact size required for the chart - else it will be over-written. */ LChartWidth = 565; LChartHeight = 420; //Include Global Functions #include "../CodeBase/FCGlobalFunctions.as" //Include Initialization scripts #include "../CodeBase/FCInit.as" //---------------------------------------------------------------------// //----------------- CHART MOVIE PRELOADER BEGINS HERE -----------------// //---------------------------------------------------------------------// /* The pre loader has a lot of cosmetic properties that can be defined. We allow the user to take control of all those properties by specifying certain variables below. Variables that the user can specify in the chart container: PBarHeight - Required height for the progress bar. PBarWidth - Required width for the progress bar. PBarBorderColor - Border color of the progress bar PBarBorderThickness - Border thickness of the progress bar PBarBgColor - Progress bar background color (fill color of the bar) PBarTextColor - Color of the text PBarLoadingText - The actual loading text to be displayed Define local variables to store cosmetic properties */ var LPBarHeight, LPBarWidth, LPBarBorderColor, LPBarBorderThickness, LPBarBgColor, LPBarTextColor, LPBarLoadingText; //Set Progress bar Height LPBarHeight = Number(getFirstValue(_root.PBarHeight, "15")); /* Calculate the width of the progress bar :Explanation: How the width of the progress bar is being calculated? Basically, what we are aiming to do here is - Center align the progress bar elements with respect to the chart size. So, the width of the progress bar is set in such a way that is the chart width is greater than 200 pixels, the progress bar width will be 150 pixels. However, if the chart width is less than 200 pixels, then the progress bar width will be 25 pixels less than the chart width. */ LPBarWidth = (_chartWidth>200) ? 150 : (_chartWidth-25); //We also give the user an option to strong-enforce his own progress bar width value in case he wants something on his own. LPBarWidth = getFirstValue(_root.PBarWidth, LPBarWidth); LPBarBorderColor = getFirstValue(_root.PBarBorderColor, "E2E2E2"); LPBarBorderThickness = Number(getFirstValue(_root.PBarBorderThickness, "1")); LPBarBgColor = getFirstValue(_root.PBarBgColor, "E2E2E2"); LPBarTextColor = getFirstValue(_root.PBarTextColor, "666666"); LPBarLoadingText = getFirstValue(unescape(_root.PBarLoadingText), "Loading Chart. Please Wait"); //If the movie is already loaded (playing from local disk or cached), just send the control to DataLoad scene if (getBytesLoaded() == getBytesTotal()) { gotoAndPlay("DataLoad", 1); } else { //If the control is here, it means the movie isn't still loaded - so, we need to build up the preloader. //We now draw the progress bar at the center of the stage. To do this, we create an instance of the FCProgessBar class attachMovie("FCProgressBar", "FCPB", 1); FCPB.setLimits(0, getBytesTotal()); FCPB.setPosition(_chartHorCenter-(LPBarWidth/2), _chartVerCenter); FCPB.setSize(LPBarWidth, LPBarHeight); FCPB.setColors(LPBarBgColor, LPBarBorderColor); FCPB.setBorderThickness(LPBarBorderThickness); FCPB.setValue(getBytesLoaded()); FCPB.draw(); //Create the loading text createText(2, LPBarLoadingText, _chartHorCenter, _chartVerCenter-(LPBarHeight/2), "Verdana", "10", LPBarTextColor, false, "center", "left", null, false); //Create the preloader sequence _root.onEnterFrame = function() { if (getBytesLoaded()=(_FCXShift+_chartWidth)) { //Align on left ASMovHoverCaption._x = (_FCXShift+_chartWidth)-ASMovHoverCaption._width-1; } else if (this.data[dataIndex].xPos<=ASMovHoverCaption._width/2) { ASMovHoverCaption._x = 1; } else { //Normal - center aligned ASMovHoverCaption._x = this.data[dataIndex].xPos-ASMovHoverCaption._width/2; } //Set its y pos to the current y mouse pos ASMovHoverCaption._y = _ymouse-ASMovHoverCaption._height-5; } }; Chart.prototype.removeHoverCap = function() { //This function hides the hover caption ASMovHoverCaption._visible = false; }; //**** General Methods *****// /* General methods are those methods which can be used with any other Flash movies for some common jobs like font rendering, shapes drawing etc. */ Chart.prototype.drawLine = function(fromX, fromY, toX, toY, lineThickness, lineColor, lineAlpha, depth) { //This function draws a line segment on the canvas based on the arguments //************** PARAMETERS ****************// //fromX - from X point //fromY - from Y point //toX - to X point //toY - to Y point //lineThickness - thickness of the line //lineColor - Color - without # like FFDDDD, 000000 //lineAlpha - Alpha of the line //depth - MC depth //******************************************// //Returns nothing //First, create a movie clip container createEmptyMovieClip("ASMovLine_"+depth, depth); mcLine = eval("ASMovLine_"+depth); mcLine.clear(); //Set the line style mcLine.lineStyle(lineThickness, parseInt(lineColor, 16), lineAlpha); //Move to position fromX, fromY mcLine.moveTo(fromX, fromY); //Draw line mcLine.lineTo(toX, toY); //remove object delete mcLine; }; Chart.prototype.drawRectangle = function(depth, fromX, fromY, toX, toY, borderColor, bgColor, borderThickness, borderAlpha, bgAlpha) { //This function draws a rectangle on the canvas based on the arguments //************** PARAMETERS ****************// //depth - Level in which this rectangle will be rendered //fromX - Starting X Position //fromY - Starting Y Position //toX - Ending X Position //toY - Ending Y Position //borderColor - Border Color of the rectangle //bgColor - Background Color of the rectangle //borderThickness - Thickness of the border of the rectangle (in pixels) //borderAlpha - Alpha (Transparency) of the border //bgAlpha - Alpha (Transparency) of the background //******************************************// //Returns nothing //First, create a movie clip container //This function draws a rectangle based on the parameters passed to it. createEmptyMovieClip("ASMovRect_"+depth, depth); mcRect = eval("ASMovRect_"+depth); mcRect.beginFill(parseInt(bgColor, 16), bgAlpha); mcRect.lineStyle(borderThickness, parseInt(borderColor, 16), borderAlpha); mcRect.moveTo(fromX, fromY); mcRect.lineTo(toX, fromY); mcRect.lineTo(toX, toY); mcRect.lineTo(fromX, toY); mcRect.lineTo(fromX, fromY); mcRect.endFill(); //Clear memory resources delete mcRect; }; Chart.prototype.unescapeStr = function(str) { //This function unescapes a string, if the dataURL method is used var unStr = str; if (LboolIsURLProvided == true) { unStr = unescape(unStr); } return unStr; }; €€ Chart ClassџџџџO€џџ€€€€џџџ?џџeЬ//Include external relevant files //Utility Functions #include "../CodeBase/FCFunctions.as" //Utility Math routines #include "../CodeBase/FCMath.as" //Movie Clip #include "../CodeBase/FCMovieClip_Poly.as"€€ External IncludesџџџџџOџџ€€џџ CPicSpriteCюќџџ CюќџџџџџџД€€џџџ?џџІg€€ Embedded TextџџџџџџOџ€€€€џџџ?џџР'џ6/* Scene Name: Chart =========================================================================== This is the main scene of the entire movie where the actual chart is rendered. In this scene, we do the following: 1. Parse the XML data document to retrieve data from it and store in our local objects 2. Do various calculations to get the co-ordinates and values for all elements of the chart. 3. Render all the visual elements of the chart. External Includes in the scene: /CodeBase/FCFunctions.as - Utility Functions /CodeBase/FCMath.as - Utility Math Functions */€€ Descriptionџџџџ™3Ьџ€€des in the scene:)џџ CDocumentPagePage 3 ChartLoadНŠіAKџџџџ`ŒіAџџџџ€Page 4DataLoadСŠіALџџџџзŠіAџџџџ€Page 2ChartЇ4jA џџџџУŒBџџџџ€Symbol 1 MovLoaderBglСN@G..\..\..\Customized\ClientWise\StreamCore\StackedArea\StackedArea2D.fla MovLoaderBg{СN@lСN@{СN@џџџџ€Symbol 3 MovEmbedTextz}b@ ..\Draft.fla MovEmbedText$:ѕAz}b@$:ѕAџџџџ€Symbol 4 FCProgressBarпwыA› FCProgressBar ..\Draft.fla FCProgressBarš єAпwыA›š єAџџџџ$,а hhhhhџџџџРРРџxДVector::Debugging Permitted0Vector::External Font Files0Vector::Generator CommandVector::Compress Movie1Vector::Preview as GIF0Vector::Override Sounds0Vector::Protect0Vector::Quality100Vector::Template0Vector::Omit Trace Actions0Vector::Debugging PasswordVector::TopDown0Vector::Report0Vector::Version6Vector::Stream Compress7Vector::Event Format0Vector::Event Compress7Vector::Stream Format0PropSheet::ActiveTab1599џџџџќџџ CColorDefџ€џ€џ€3џPя€fџPя0€™џPяH€ЬџPя`€џџPяx€3џя€33џ(я€3fџ<я0€3™џCяH€3ЬџFя`€3џџHяx€fџя0€f3џя0€ffџ(я0€f™џ5яH€fЬџ<я`€fџџ@яx€џ€333џ0€џ€3џ я€33џxя€f3џdя0€™3џ]яH€Ь3џZя`€џ3џXяx€33џШя€333џ0€3f3џPPH€3™3џPx`€3Ь3џPx€3џ3џPя€f3џмя0€f33џPH€ff3џ(PH€f™3џ<x`€fЬ3џCx€fџ3џFя€џ€fffџ`€џ€fџ я0€3fџŒя0€ffџxя0€™fџkяH€Ьfџdя`€џfџ`яx€3fџДя0€33fџ PH€3ffџxPH€3™fџdx`€3Ьfџ]x€3џfџZя€ffџШя0€f3fџШPH€fffџ`€f™fџP0x€fЬfџPx€fџfџPяЈ€џ€™™™џ€џ€™џ яH€3™џ“яH€f™џ…яH€™™џxяH€Ь™џnя`€џ™џhяx€3™џ­яH€33™џ x`€3f™џŒx`€3™™џxx`€3Ь™џkx€3џ™џdя€f™џЛяH€f3™џДx`€ff™џ 0x€f™™џx0x€fЬ™џdx€fџ™џ]яЈ€џ€ЬЬЬџР€џ€Ьџ я`€3Ьџ–я`€fЬџŒя`€™Ьџ‚я`€ЬЬџxя`€џЬџpяx€3ЬџЊя`€33Ьџ x€3fЬџ“x€3™Ьџ…x€3ЬЬџxx€3џЬџnя€fЬџДя`€f3Ьџ­x€ffЬџ x€f™ЬџŒx€fЬЬџxx€fџЬџkяЈ€џ€џџџџ№€џ€џџ яx€3џџ˜яx€fџџяx€™џџˆяx€Ьџџ€яx€џџџxяx€3џџЈяx€33џџ я€3fџџ–я€3™џџŒя€3Ьџџ‚я€3џџџxя€fџџАяx€f3џџЊя€ffџџ яЈ€f™џџ“яЈ€fЬџџ…яЈ€fџџџxяЈ€џ€џџяx€џ€™џяH€™3џ яH€™fџяH€™™џ(яH€™Ьџ2я`€™џџ8яx€Ьџя`€Ь3џ я`€Ьfџя`€Ь™џя`€ЬЬџ(я`€Ьџџ0яx€џџяx€џ3џяx€џfџяx€џ™џяx€џЬџ яx€џџџ(яx€џ€џџPяx€џ€™3џуяH€™33џx`€™f3џx`€™™3џ(x`€™Ь3џ5x€™џ3џ<я€Ь3џця`€Ь33џx€Ьf3џ x€Ь™3џx€ЬЬ3џ(x€Ьџ3џ2я€џ3џшяx€џ33џя€џf3џ я€џ™3џя€џЬ3џя€џџ3џ(я€џ€џџ яx€џ€™fџеяH€™3fџмx`€™ffџ0x€™™fџ(0x€™Ьfџ<x€™џfџCяЈ€Ьfџмя`€Ь3fџуx€Ьffџx€Ь™fџx€ЬЬfџ(x€Ьџfџ5яЈ€џfџряx€џ3fџця€џffџяЈ€џ™fџ яЈ€џЬfџяЈ€џџfџ(яЈ€џ€џџџ(яx€џ€™™џШяH€™3™џШx`€™f™џШ0x€™™™џ€™Ь™џPPЈ€™џ™џPяР€Ь™џвя`€Ь3™џеx€Ьf™џмx€Ь™™џPЈ€ЬЬ™џ(PЈ€Ьџ™џ<яР€џ™џияx€џ3™џмя€џf™џуяЈ€џ™™џяР€џЬ™џяР€џџ™џ(яР€џ€џџџxяx€џ€™ЬџОя`€™3ЬџЛx€™fЬџДx€™™Ьџ PЈ€™ЬЬџxPЈ€™џЬџdяР€ЬЬџШя`€Ь3ЬџШx€ЬfЬџШx€Ь™ЬџШPЈ€ЬЬЬџР€ЬџЬџPяи€џЬџаяx€џ3Ьџвя€џfЬџеяЈ€џ™ЬџмяР€џЬЬџяи€џџЬџ(яи€џ€џџџШяx€џ€™џџИяx€™3џџДя€™fџџ­яЈ€™™џџ яР€™ЬџџŒяР€™џџџxяР€ЬџџРяx€Ь3џџОя€ЬfџџЛяЈ€Ь™џџДяР€ЬЬџџ яи€Ьџџџxяи€џџџШяx€џ3џџШя€џfџџШяЈ€џ™џџШяР€џЬџџШяи€џџџџ№€џ€џџџџџџџ€џџџџџџџ€џџџџџ€џџџџџ€џџџџџ€џf§џ`џџџџzџџџџ€™fџЊџЬџџџџџџ€џџџ*џџџ]џџџџџЊџџдџџџџџџ0›fџџh€џџџџџџџ€џџџџџџџ€џџџџџ€џџџџџ€џџџџџ€џf§џ`џџџџzџџџџ€™fџЊџЬџџџџџџ€џџџ*џџџ]џџџџџЊџџдџџџџџџ0›fџџh to DataLoad scene. External Includes in the scene: /CodeBase/FCInit.as - Contains chart initialization actions common to all FusionCharts charts. /CodeBase/FCProgressBar.as - Progress Bar class designed for FusionCharts /CodeBase/FCGlobalFunctions.as - Global level functions that will be used in all FusionCharts charts. */€€ DescriptionџџџџO€џџ€€яx€џ3џџШя€џfџџШяЈ€џ™џџШяР€џЬџџШяи€џџџџ№€џ)џџ CDocumentPagePage 3 ChartLoadНŠіAKџџџџЌU'Bџџџџ€Page 4DataLoadСŠіALџџџџзŠіAџџџџ€Page 2ChartЇ4jA џџџџИU'Bџџџџ€Symbol 1 MovLoaderBglСN@G..\..\..\Customized\ClientWise\StreamCore\StackedArea\StackedArea2D.fla MovLoaderBg{СN@lСN@{СN@џџџџ€Symbol 3 MovEmbedTextz}b@ ..\Draft.fla MovEmbedText$:ѕAz}b@$:ѕAџџџџ€Symbol 4 FCProgressBarпwыA› FCProgressBar ..\Draft.fla FCProgressBarš єAпwыA›š єAџџџџ$,а hhhhhџџџџРРРџxДVector::External Font Files0Vector::Debugging Permitted0Vector::Generator CommandVector::Compress Movie1Vector::Preview as GIF0Vector::Override Sounds0Vector::Template0Vector::Quality100Vector::Protect0Vector::Debugging PasswordVector::Omit Trace Actions0Vector::TopDown0Vector::Report0Vector::Event Format0Vector::Stream Compress7Vector::Version6Vector::Event Compress7Vector::Stream Format0PropSheet::ActiveTab1599џџџџќџџ CColorDefџ€џ€џ€3џPя€fџPя0€™џPяH€ЬџPя`€џџPяx€3џя€33џ(я€3fџ<я0€3™џCяH€3ЬџFя`€3џџHяx€fџя0€f3џя0€ffџ(я0€f™џ5яH€fЬџ<я`€fџџ@яx€џ€333џ0€џ€3џ я€33џxя€f3џdя0€™3џ]яH€Ь3џZя`€џ3џXяx€33џШя€333џ0€3f3џPPH€3™3џPx`€3Ь3џPx€3џ3џPя€f3џмя0€f33џPH€ff3џ(PH€f™3џ<x`€fЬ3џCx€fџ3џFя€џ€fffџ`€џ€fџ я0€3fџŒя0€ffџxя0€™fџkяH€Ьfџdя`€џfџ`яx€3fџДя0€33fџ PH€3ffџxPH€3™fџdx`€3Ьfџ]x€3џfџZя€ffџШя0€f3fџШPH€fffџ`€f™fџP0x€fЬfџPx€fџfџPяЈ€џ€™™™џ€џ€™џ яH€3™џ“яH€f™џ…яH€™™џxяH€Ь™џnя`€џ™џhяx€3™џ­яH€33™џ x`€3f™џŒx`€3™™џxx`€3Ь™џkx€3џ™џdя€f™џЛяH€f3™џДx`€ff™џ 0x€f™™џx0x€fЬ™џdx€fџ™џ]яЈ€џ€ЬЬЬџР€џ€Ьџ я`€3Ьџ–я`€fЬџŒя`€™Ьџ‚я`€ЬЬџxя`€џЬџpяx€3ЬџЊя`€33Ьџ x€3fЬџ“x€3™Ьџ…x€3ЬЬџxx€3џЬџnя€fЬџДя`€f3Ьџ­x€ffЬџ x€f™ЬџŒx€fЬЬџxx€fџЬџkяЈ€џ€џџџџ№€џ€џџ яx€3џџ˜яx€fџџяx€™џџˆяx€Ьџџ€яx€џџџxяx€3џџЈяx€33џџ я€3fџџ–я€3™џџŒя€3Ьџџ‚я€3џџџxя€fџџАяx€f3џџЊя€ffџџ яЈ€f™џџ“яЈ€fЬџџ…яЈ€fџџџxяЈ€џ€џџяx€џ€™џяH€™3џ яH€™fџяH€™™џ(яH€™Ьџ2я`€™џџ8яx€Ьџя`€Ь3џ я`€Ьfџя`€Ь™џя`€ЬЬџ(я`€Ьџџ0яx€џџяx€џ3џяx€џfџяx€џ™џяx€џЬџ яx€џџџ(яx€џ€џџPяx€џ€™3џуяH€™33џx`€™f3џx`€™™3џ(x`€™Ь3џ5x€™џ3џ<я€Ь3џця`€Ь33џx€Ьf3џ x€Ь™3џx€ЬЬ3џ(x€Ьџ3џ2я€џ3џшяx€џ33џя€џf3џ я€џ™3џя€џЬ3џя€џџ3џ(я€џ€џџ яx€џ€™fџеяH€™3fџмx`€™ffџ0x€™™fџ(0x€™Ьfџ<x€™џfџCяЈ€Ьfџмя`€Ь3fџуx€Ьffџx€Ь™fџx€ЬЬfџ(x€Ьџfџ5яЈ€џfџряx€џ3fџця€џffџяЈ€џ™fџ яЈ€џЬfџяЈ€џџfџ(яЈ€џ€џџџ(яx€џ€™™џШяH€™3™џШx`€™f™џШ0x€™™™џ€™Ь™џPPЈ€™џ™џPяР€Ь™џвя`€Ь3™џеx€Ьf™џмx€Ь™™џPЈ€ЬЬ™џ(PЈ€Ьџ™џ<яР€џ™џияx€џ3™џмя€џf™џуяЈ€џ™™џяР€џЬ™џяР€џџ™џ(яР€џ€џџџxяx€џ€™ЬџОя`€™3ЬџЛx€™fЬџДx€™™Ьџ PЈ€™ЬЬџxPЈ€™џЬџdяР€ЬЬџШя`€Ь3ЬџШx€ЬfЬџШx€Ь™ЬџШPЈ€ЬЬЬџР€ЬџЬџPяи€џЬџаяx€џ3Ьџвя€џfЬџеяЈ€џ™ЬџмяР€џЬЬџяи€џџЬџ(яи€џ€џџџШяx€џ€™џџИяx€™3џџДя€™fџџ­яЈ€™™џџ яР€™ЬџџŒяР€™џџџxяР€ЬџџРяx€Ь3џџОя€ЬfџџЛяЈ€Ь™џџДяР€ЬЬџџ яи€Ьџџџxяи€џџџШяx€џ3џџШя€џfџџШяЈ€џ™џџШяР€џЬџџШяи€џџџџ№€џ€џџџџџџџ€џџџџџџџ€џџџџџ€џџџџџ€џџџџџ€џf§џ`џџџџzџџџџ€™fџЊџЬџџџџџџ€џџџ*џџџ]џџџџџЊџџдџџџџџџ›ѕfџџh‚§џџџўџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ