ĐĎॹá>ţ˙ ţ˙˙˙ ˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙Root Entry˙˙˙˙˙˙˙˙pŞ|YŞrĎƒRASH˙nřŰĹc€Contents˙˙˙˙˙˙˙˙˙˙˙˙ +Page 1˙˙˙˙˙˙˙˙pPage 2˙˙˙˙˙˙˙˙˙˙˙˙­ý˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙ý˙˙˙ý˙˙˙f˙˙˙˙˙˙˙˙ý˙˙˙ţ˙˙˙ý˙˙˙ţ˙˙˙ Žţ˙˙˙ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVW]˙˙˙˙Z[\^_`aedYŸghijklmnopqrstuvwxyz{|}~€Root Entry˙˙˙˙˙˙˙˙pŞ|YŞrĎƒRASH kt_ Ĺc€Contents˙˙˙˙˙˙˙˙˙˙˙˙ˇ+Page 1˙˙˙˙˙˙˙˙˙˙˙˙pPage 2 ˙˙˙˙­˙˙˙˙˙˙˙˙Xý˙˙˙ý˙˙˙ý˙˙˙˙˙˙˙f˙˙˙˙ý˙˙˙˙˙˙˙ţ˙˙˙ý˙˙˙ţ˙˙˙˙˙˙˙ Žţ˙˙˙ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVW] Z[\^_`a˙˙˙˙dY˙˙˙˙ghijklmnopqrstuvwxyz{|}~€ţ˙˙˙ţ˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ Ą˘Ł¤ĽŚ§¨ŠŞŤŹ­ŽŻ°ą˛ł´ľśˇ¸šşťź˝žżŔÁÂĂÄř˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙úűüýţ˙ţ˙˙˙ţ˙˙˙    ˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙ţ˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙CPicPage˙˙ CPicLayer˙˙ CPicFrame€€˙˙˙?˙˙V€˙˙ CPicSpriteúě˙˙ˇú˙˙ úě˙˙ˇú˙˙d˙O MovLoaderBg€ü˙˙ňř˙˙ ü˙˙ňř˙˙d˙¸+ MovEmbedText€€˙˙˙?˙˙Symbol 5 ˙˙˙˙ Page 3 ˙˙˙˙b§Page 4˙˙˙˙˙˙˙˙ůSymbol 6˙˙˙˙ ˙˙˙˙O{Symbol 5 ˙˙˙˙ Page 3˙˙˙˙˙˙˙˙˙˙˙˙Ť§Page 4˙˙˙˙ůSymbol 6˙˙˙˙ ˙˙˙˙O{‚›ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™ššœž¨˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙ŠŞ˝Ź­Ż°ą˛ł´ľśţ˙˙˙¸Ěşťźţ˙˙˙žżŔÁÂĂÄĹĆÇČÉĘË]ÍÎĎĐŃŇÓÔŐÖ×ţ˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙‚›ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™ššœž¨ Ą˘Ł¤ĽŚ§ţ˙˙˙ŠŞ˝˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙şťźţ˙˙˙žżŔÁÂĂÄĹĆÇČÉĘË]˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙^_`abcdefghijklmnopqrstuvwxyz{|}~€Symbol 7˙˙˙˙˙˙˙˙˙˙˙˙U*˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙Symbol 1 ˙˙˙˙ Symbol 2˙˙˙˙˙˙˙˙˙˙˙˙‘Symbol 3˙˙˙˙)3 Symbol 4˙˙˙˙˙˙˙˙˙˙˙˙ N ţ˙˙˙ţ˙˙˙ !"#$%&'(ţ˙˙˙*+,-./0123456789:;<=>?@ABCDEFGHIJKLMţ˙˙˙ţ˙˙˙PQRSTţ˙˙˙VWXYţ˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙//Parameters passed to this movie clip //FCheight //FCAnimation //FCColor //Pass on the FCHeight and FCColor parameter to the sub-movie setProperty("MovColumn",_visible,false); MovColumn.FCHeight = this.FCHeight; MovColumn.FCColor = this.FCColor; MovColumn.dataSet = this.dataSet; MovColumn.dataIndex = this.dataIndex; //Animate it, if required if (this.FCAnimation == 1) { currScale = 0; incrementfactor = 2; } else { currScale = 100; } play(); €€€˙˙˙?˙˙Üi//Set the height setProperty("MovColumn", _visible, true); setProperty("MovColumn", _yscale, currScale); €€€˙˙˙?˙˙óJ˙éif (currScale<100) { //If the column is still not fully drawn //Send the control back currScale = currScale+incrementFactor; gotoAndPlay(2); } else { //Re-set the height setProperty("MovColumn", _yscale, 100); //Set the value textbox if (this.dataIndex != null || this.dataIndex != undefined) { _root.FCChart.drawValueTb(this.dataSet, this.dataIndex); } //Set the event handlers MovColumn.onRollOver = function() { if (_root.FCChart.Params.showHoverCap == 1) { _root.FCChart.setHoverCap(this.dataSet, this.dataIndex); } }; MovColumn.onRollOut = function() { _root.FCChart.removeHoverCap(); }; MovColumn.onRelease = function() { _root.FCChart.linkClick(this.dataSet, this.dataIndex); }; MovColu" #endinitclip €€ Class˙˙˙˙O€˙˙€€oto and play the first frame - i.e., re-render the chart gotoAndPlay(1); } } else { //Else- just stay normal stop(); } €€€˙˙˙?˙˙ ErrorStopü//Just stop stop();€€ JavaScript˙˙˙˙™3Ě˙€€€€t€€ ń˙˙;ţ˙˙˙ƒ˙ embedText !@#$%^&*()@Verdana˙"(€€˙˙˙?˙˙J€€ Layer 1˙˙˙˙O€˙˙€€˙˙˙CPicPage˙˙ CPicLayer˙˙ CPicFrame€€˙˙˙?˙˙¸|A#initclip 1 #include "../CodeBase/FCProgressBar.as˙˙CPicPage˙˙ CPicLayer˙˙ CPicFrame€€˙˙˙?˙˙AX€€€˙˙˙?˙˙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", "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(); } €€€˙˙˙?˙˙ ErrorStopŒc//Just stop stop();€€ JavaScript˙˙˙˙™3Ě˙€€€€˙˙˙?˙˙ú˙/* 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 LChartRenderingText = getFirstValue(unescape(_root.ChartRenderingText), "Rendering Chart. Please Wait"); LNoDataText = getFirstValue(unescape(_root.ChartNoDataText), "No data to display."); /* We now set the text message in the textbox instance MovLoadingText. We also re-set the position of the textbox just above the progress bar. */ createText(1, LChartRenderingText, _chartHorCenter, _chartVerCenter, "Verdana", "10", LPBarTextColor, false, "center","left", null, false); //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.numDs==0 || FCChart.Params.numSets == 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(); } €€€˙˙˙?˙˙0o˙/* 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 divisional lines FCChart.drawDivLines(); //Allot column depth - basically to get the depth of zero plane //Between the positive and negative valued columns FCChart.allotColumnDepths(); //Zero Plane FCChart.drawZeroPlane(); //===============================// //Create the columns now for (i=1; i<=FCChart.Params.num; i++) { for (j=1; j<=FCChart.Params.numDs; j++) { //Render the column if it's primary DS if (FCChart.dataSet[j].parentYAxis == "P") { FCChart.renderColumn(j, i); } } } //===============================// //Set category name FCChart.setCatNames(); //Now, calculate the points for the line chart FCChart.calculateLinePoints(); //Set the labels on the chart FCChart.setLabels(); //----------DRAW THE LINE CHART------------- _root.onEnterFrame = function() { if (FCChart.isAllColumnRendered() == true) { FCChart.renderLineChart(); delete this.onEnterFrame; } }; //Render the *raw* hover caption FCChart.renderHoverCap(); //Finally stop once the chart has been rendered stop(); €€ Actions˙˙˙˙˙OO˙€€€€˙˙˙?˙˙R˙˙˙)t//** 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.dataSet = new Array(); this.data = new Array(); //Chart.categories is an array to store the category names this.categories = 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.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.numDs indicates the number of dataset this.Params.numDs = 0; //Count of primary and secondary dataset this.Params.numPDS = 0; this.Params.numSDS = 0; //First and last indexes of the dataset this.Params.firstPDSIndex = 0; this.Params.lastPDSIndex = 0; this.Params.firstSDSIndex = 0; this.Params.lastSDSIndex = 0; //Params.numCat indicates the number of categories we need to show this.Params.numCat = 0; //Params.numSets indicates the number of set elements present this.Params.numSets = 0; //A counter to keep count of the number of textboxes whose names are to be shown this.Params.numWithNames = 0; this.Params.PNegativeNumPresent = false; this.Params.numNegativeNumbers = 0; this.Params.PShowZeroPlane = false; this.Params.PZeroPlanePos = 0; //High depth Columns?? this.Params.highDepthColumns = false; //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")); //Column Chart related constant values //Padding between the first & last column and the canvas this.Constants.CANVAS_PADDING = Number(getFirstValue(_root.CANVAS_PADDING, "7")); //Tilt angle of the column base this.Constants.COLUMN_TILT_ANGLE = 45; this.Constants.MAX_COLUMN_WIDTH = 60; this.Constants.DARK_SHADOW_INTENSITY = 0.65; this.Constants.LIGHT_SHADOW_INTENSITY = 0.80; this.Constants.CANVAS_ALPHA = 100; this.Constants.ANIMATION_PIXEL_INCREMENT = 2; }; //** 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(dataValue, dataColor, dataLink, dataAlpha) { //Chart.dataItem indicates an object which is going to contain the data //and other related details for a particular element this.value = dataValue; this.color = dataColor; this.link = dataLink; this.alpha = dataAlpha; //Based on alpha, set whether this data set will be displayed or not this.showDataSet = 1; if (this.alpha == 0) { //We also set the value to 0 this.value = 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; //Face center positions this.frontFaceCenterX = 0; this.rearFaceCenterX = 0; //Colors this.darkShadowColor = null; this.lightShadowColor = null; //Animation values this.heightRendered = 0; this.isNeg = false; if (this.value<0) { this.isNeg = true; } //Depth this.depth = 0; }; Chart.category = function(catName, catShowName, catHoverText) { //Chart.category indicates a category object this.name = catName; this.showName = catShowName; this.hoverText = catHoverText; this.xPos = 0; this.yPos = 0; }; Chart.divLine = function(value, secondaryValue, displayValue, displaySecondaryValue, showValue, showSecondaryValue) { //Chart.divLine indicates a div line object //Properties set by the user this.value = value; this.secondaryValue = secondaryValue; this.displayValue = displayValue; this.displaySecondaryValue = displaySecondaryValue; this.showValue = showValue; this.showSecondaryValue = showSecondaryValue; //Internal properties 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; }; Chart.dataSetParams = function() { //An invisible object used to store the data set attributes }; //** 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 = 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; } //Canvas Properties this.Params.canvasBgColor = formatHexColor(getFirstValue(levelOneNodes[i].attributes.canvasBgColor, "DDE3D5")); this.Params.canvasBaseColor = formatHexColor(getFirstValue(levelOneNodes[i].attributes.canvasBaseColor, "ACBB99")); this.Params.canvasBaseDepth = Number(getFirstValue(levelOneNodes[i].attributes.canvasBaseDepth, "10")); this.Params.canvasBgDepth = Number(getFirstValue(levelOneNodes[i].attributes.canvasBgDepth, "3")); //X and Y Axis Name this.Params.xAxisName = getFirstValue(levelOneNodes[i].attributes.xAxisName, ""); this.Params.PYAxisName = getFirstValue(levelOneNodes[i].attributes.PYAxisName, ""); this.Params.SYAxisName = getFirstValue(levelOneNodes[i].attributes.SYAxisName, ""); //Canvas background color, border color and border thickness (in pixels) //The upper and lower limits of y axis (both primary and secondary) this.Params.PYAxisMinValue = levelOneNodes[i].attributes.PYAxisMinValue; this.Params.PYAxisMaxValue = levelOneNodes[i].attributes.PYAxisMaxValue; this.Params.SYAxisMinValue = levelOneNodes[i].attributes.SYAxisMinValue; this.Params.SYAxisMaxValue = levelOneNodes[i].attributes.SYAxisMaxValue; this.Params.animation = Number(getFirstValue(levelOneNodes[i].attributes.animation, "1")); //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, "1")); //Option to show/hide limits this.Params.showLimits = Number(getFirstValue(levelOneNodes[i].attributes.showLimits, "1")); this.Params.showSecondaryLimits = Number(getFirstValue(levelOneNodes[i].attributes.showSecondaryLimits, this.Params.showLimits)); //Show/hide the legend this.Params.showLegend = Number(getFirstValue(levelOneNodes[i].attributes.showLegend, "1")); //Option to show/hide canvas base and bg this.Params.showCanvasBg = Number(getFirstValue(levelOneNodes[i].attributes.showCanvasBg, "1")); this.Params.showCanvasBase = Number(getFirstValue(levelOneNodes[i].attributes.showCanvasBase, "1")); //Option to show vertical x-axis labels this.Params.rotateNames = Number(getFirstValue(levelOneNodes[i].attributes.rotateNames, "0")); //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")); this.Params.showDivLineSecondaryValue = Number(getFirstValue(levelOneNodes[i].attributes.showDivLineSecondaryValue, this.Params.showDivLineValue)); //Zero Plane this.Params.zeroPlaneColor = formatHexColor(getFirstValue(levelOneNodes[i].attributes.zeroPlaneColor, "ACBB99")); this.Params.zeroPlaneAlpha = Number(getFirstValue(levelOneNodes[i].attributes.zeroPlaneAlpha, "75")); this.Params.zeroPlaneShowBorder = Number(getFirstValue(levelOneNodes[i].attributes.zeroPlaneShowBorder, "1")); this.Params.zeroPlaneBorderColor = formatHexColor(getFirstValue(levelOneNodes[i].attributes.zeroPlaneBorderColor, this.Params.zeroPlaneColor)); //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, ", "); //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)); //Line Properties this.Params.lineColor = formatHexColor(getFirstValue(levelOneNodes[i].attributes.lineColor, "333333")); this.Params.lineThickness = Number(getFirstValue(levelOneNodes[i].attributes.lineThickness, "2")); this.Params.lineAlpha = Number(getFirstValue(levelOneNodes[i].attributes.lineAlpha, "100")); //Line 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, "50")); //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)); //Anchor Properties this.Params.showAnchors = Number(getFirstValue(levelOneNodes[i].attributes.showAnchors, "1")); this.Params.anchorSides = Number(getFirstValue(levelOneNodes[i].attributes.anchorSides, "4")); this.Params.anchorRadius = Number(getFirstValue(levelOneNodes[i].attributes.anchorRadius, "4")); this.Params.anchorBorderColor = formatHexColor(getFirstValue(levelOneNodes[i].attributes.anchorBorderColor, "333333")); this.Params.anchorBorderThickness = Number(getFirstValue(levelOneNodes[i].attributes.anchorBorderThickness, "1")); this.Params.anchorBgColor = formatHexColor(getFirstValue(levelOneNodes[i].attributes.anchorBgColor, "f1f1f1")); this.Params.anchorAlpha = Number(getFirstValue(levelOneNodes[i].attributes.anchorAlpha, "100")); this.Params.anchorBgAlpha = Number(getFirstValue(levelOneNodes[i].attributes.anchorBgAlpha, this.Params.anchorAlpha)); //Option whether the format the number (using Commas) this.Params.formatNumber = Number(getFirstValue(levelOneNodes[i].attributes.formatNumber, "1")); //Option to format number scale this.Params.formatNumberScale = Number(getFirstValue(levelOneNodes[i].attributes.formatNumberScale, "1")); //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")); //Decimal Precision cannot be less than 0 - so adjust it if (this.Params.decimalPrecision<0) { this.Params.decimalPrecision = 0; } //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)); //Chart Margins this.Params.chartLeftMargin = Number(getFirstValue(levelOneNodes[i].attributes.chartLeftMargin, "15")); this.Params.chartRightMargin = Number(getFirstValue(levelOneNodes[i].attributes.chartRightMargin, "0")); 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 TRENDLINES nodes levelTwoNodes = levelOneNodes[i].childNodes; for (j=0; j<=levelTwoNodes.length; j++) { //If its a categories node if (levelTwoNodes[j].nodeName.toUpperCase() == "CATEGORIES") { //Extract the category info //Get a reference to the categories sub nodes categoryNodes = levelTwoNodes[j].childNodes; //Extract the category attributes like font, fontSize & fontColor this.Params.catFont = getFirstValue(levelTwoNodes[j].attributes.font, this.Params.outCnvBaseFont); this.Params.catFontSize = Number(getFirstValue(levelTwoNodes[j].attributes.fontSize, this.Params.outCnvBaseFontSize)); this.Params.catFontColor = formatHexColor(getFirstValue(levelTwoNodes[j].attributes.fontColor, ths.Params.outCnvBaseFontColor)); //Now, iterate through each of the category nodes and store the data in the array for (k=0; k<=categoryNodes.length; k++) { //If the node is really a category subnode if (categoryNodes[k].nodeName.toUpperCase() == "CATEGORY") { //Increment value this.Params.num++; //Get the category name var catName = categoryNodes[k].attributes.name; //Option whether to show the cat Name or not var showCatName = Number(getFirstValue(categoryNodes[k].attributes.showName, this.Params.showNames)); var catHoverText = getFirstValue(categoryNodes[k].attributes.hoverText, catName); this.categories[this.Params.num] = new Chart.category(catName, showCatName, catHoverText); } } //Free memory resources delete categoryNodes; } else if (levelTwoNodes[j].nodeName.toUpperCase() == "DATASET") { //Increment the number of ds this.Params.numDs++; //Extract the attributes this.dataset[this.Params.numDs] = new Chart.dataSetParams(); this.dataset[this.Params.numDs].parentYAxis = getFirstValue(levelTwoNodes[j].attributes.parentYAxis, "P"); this.dataset[this.Params.numDs].parentYAxis = this.dataset[this.Params.numDs].parentYAxis.toUpperCase(); //Make a count of the primary and secondary datasets if (this.dataset[this.Params.numDs].parentYAxis == "P") { this.Params.numPDS++; //Also, make the entry for first index if (this.Params.firstPDSIndex == 0) { this.Params.firstPDSIndex = this.Params.numDs; } //Last Index this.Params.lastPDSIndex = this.Params.numDs; } else { this.Params.numSDS++; //Also, make the entry for first index if (this.Params.firstSDSIndex == 0) { this.Params.firstSDSIndex = this.Params.numDs; } this.Params.lastSDSIndex = this.Params.numDs; } this.dataset[this.Params.numDs].seriesName = levelTwoNodes[j].attributes.seriesName; this.dataset[this.Params.numDs].color = formatHexColor(getFirstValue(levelTwoNodes[j].attributes.color, "FF5904")); this.dataset[this.Params.numDs].showValues = Number(getFirstValue(levelTwoNodes[j].attributes.showValues, this.Params.ShowValues)); this.dataset[this.Params.numDs].alpha = Number(getFirstValue(levelTwoNodes[j].attributes.alpha, "100")); this.dataset[this.Params.numDs].lineThickness = Number(getFirstValue(levelTwoNodes[j].attributes.lineThickness, this.Params.lineThickness)); //Dataset pertinent anchor properties this.dataset[this.Params.numDs].showAnchors = Number(getFirstValue(levelTwoNodes[j].attributes.showAnchors, this.Params.showAnchors)); this.dataset[this.Params.numDs].anchorRadius = Number(getFirstValue(levelTwoNodes[j].attributes.anchorRadius, this.Params.anchorRadius)); this.dataset[this.Params.numDs].anchorSides = Number(getFirstValue(levelTwoNodes[j].attributes.anchorSides, this.Params.anchorSides)); this.dataset[this.Params.numDs].anchorBorderColor = formatHexColor(getFirstValue(levelTwoNodes[j].attributes.anchorBorderColor, this.Params.anchorBorderColor)); this.dataset[this.Params.numDs].anchorBorderThickness = Number(getFirstValue(levelTwoNodes[j].attributes.anchorBorderThickness, this.Params.anchorBorderThickness)); this.dataset[this.Params.numDs].anchorBgColor = formatHexColor(getFirstValue(levelTwoNodes[j].attributes.anchorBgColor, this.Params.anchorBgColor)); this.dataset[this.Params.numDs].anchorAlpha = Number(getFirstValue(levelTwoNodes[j].attributes.anchorAlpha, this.Params.anchorAlpha)); this.dataset[this.Params.numDs].anchorBgAlpha = Number(getFirstValue(levelTwoNodes[j].attributes.anchorBgAlpha, this.Params.anchorBgAlpha)); //Number prefix and suffix this.dataset[this.Params.numDs].numberPrefix = getFirstValue(unescape(levelTwoNodes[j].attributes.numberPrefix), this.Params.numberPrefix); this.dataset[this.Params.numDs].numberSuffix = getFirstValue(unescape(levelTwoNodes[j].attributes.numberSuffix), this.Params.numberSuffix); //Now, get a reference to the child nodes setNodes = levelTwoNodes[j].childNodes; //Now, create a data array and assign it this.dataset[this.Params.numDs].data = new Array(); //A counter var var counter = 0; //Iterate through each set one by one for (k=0; k<=setNodes.length; k++) { //If it's really a set node if (setNodes[k].nodeName.toUpperCase() == "SET") { //Increment the counter counter++; this.Params.numSets++; //Extract the attributes var setValue = setNodes[k].attributes.value; //Check for negative number if (setValue<0 && this.dataset[this.Params.numDs].parentYAxis == "P") { this.Params.PNegativeNumPresent = true; //Now, keep a count of negative numbers if it's a primary dataset (column) this.Params.numNegativeNumbers++; } var setLink = unescape(setNodes[k].attributes.link); var setColor = formatHexColor(getFirstValue(setNodes[k].attributes.color, this.dataSet[this.Params.numDs].color)); var setAlpha = Number(getFirstValue(setNodes[k].attributes.alpha, this.dataset[this.Params.numDs].alpha)); if (setValue == undefined || setValue == null || setValue == "") { //Create an empty dataset element this.dataset[this.Params.numDs].data[counter] = new Chart.dataItem(0, "", "", 0); setAlpha = 0; } else { //Create the object to represent it this.dataset[this.Params.numDs].data[counter] = new Chart.dataItem(Number(setValue), setColor, setLink, setAlpha); } if ((this.dataset[this.Params.numDs].parentYAxis == "S") && (setAlpha == 0)) { //If it's a line dataset and if the alpha of this point is 0, then that of previous line will also be 0. //So that the whole line would appear invisible. this.dataset[this.Params.numDs].data[counter-1].alpha = 0; } } } //Free memory resource delete setNodes; } } } } //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(parentYAxis) { //This method returns the highest y-axis value //amongsts all the dataset having parentYAxis //By default we assume the max value to be that of the first dataset var intMaxVal = (parentYAxis == "P") ? (this.dataSet[this.Params.firstPDSIndex].data[1].value) : (this.dataSet[this.Params.firstSDSIndex].data[1].value); //Now, iterate through each of the dataset for (i=1; i<=this.Params.numDs; i++) { //Iterate through each of the data belonging to parentYAxis if (this.dataSet[i].parentYAxis == parentYAxis) { for (j=1; j<=this.Params.num; j++) { if (this.dataset[i].data[j].value>intMaxVal && this.dataset[i].data[j].showDataSet == 1) { intMaxVal = this.dataset[i].data[j].value; } } } } //Return the value return intMaxVal; }; Chart.prototype.getYAxisMinValue = function(parentYAxis) { //This method returns the lowest y-axis value //amongsts all the dataset having parentYAxis var intMinVal = (parentYAxis == "P") ? (this.dataSet[this.Params.firstPDSIndex].data[1].value) : (this.dataSet[this.Params.firstSDSIndex].data[1].value); //Now, iterate through each of the values to compare //Iterate through each of the data belonging to parentYAxis for (i=1; i<=this.Params.numDs; i++) { if (this.dataSet[i].parentYAxis == parentYAxis) { //Iterate through each of the data for (j=1; j<=this.Params.num; j++) { if (this.dataset[i].data[j].valueminValue) { this.Params.PYAxisMinValue = y_lowerBound; } this.Params.PYAxisMaxValue = Number(this.Params.PYAxisMaxValue); this.Params.PYAxisMinValue = Number(this.Params.PYAxisMinValue); //----------------------------------------------------------------// //---------NOW CALCULATE THE LIMITS FOR SECONDARY LIMITS---------- //----------------------------------------------------------------// //First, we get the y-axis highest and lowest values maxValue = this.getYAxisMaxValue("S"); minValue = this.getYAxisMinValue("S"); //Now, get the maximum power of 10 that is applicable to maxvalue //The Number = 10 to the power maxPowerOfTen + x (where x is another number) //For e.g., in 99 the maxPowerOfTen will be 1 = 10^1 + 89 //And for 102, it will be 2 = 10^2 + 2 var maxPowerOfTen = Math.floor(Math.log(Math.abs(maxValue))/Math.LN10); //Get the minimum power of 10 that is applicable to maxvalue var minPowerOfTen = Math.floor(Math.log(Math.abs(minValue))/Math.LN10); //Find which powerOfTen (the max power or the min power) is bigger //It is this which will be multiplied to get the y-interval var powerOfTen = Math.max(minPowerOfTen, maxPowerOfTen); var y_interval = Math.pow(10, powerOfTen); //For accomodating values falling on exact multiples of 10 like max=0 and min=-10 if (Math.abs(maxValue)/y_interval<2 && Math.abs(minValue)/y_interval<2) { powerofTen--; y_interval = Math.pow(10, powerOfTen); } //Calculate the y-axis upper limit var y_topBouSymbol 1 ˙˙˙˙ Symbol 2˙˙˙˙˙˙˙˙˙˙˙˙‘Symbol 3˙˙˙˙)3 Symbol 4˙˙˙˙˙˙˙˙˙˙˙˙˙˙CPicPage˙˙ CPicLayer˙˙ CPicFrame˙˙ CPicSprite(ě˙˙˙ (ě˙˙˙fffdfff˙ç2 MovShadow€€˙˙˙?˙˙ĹX€€ Shadow˙˙˙˙˙OO˙€€€ d˙FC MovColumn€€˙˙˙?˙˙Ž€€ Column˙˙˙˙O€˙˙€€€€˙˙˙?˙˙6z˙Í//Parameters passed to this movie clip //FCHeight - height of the required column //FCColor - Color of the column //Hide MovShadow if not requires MovShadow._visible = (_root.FCChart.Params.showColumnShadow == 1); //If height required is less than 0, rotate both if (this.FCheight<0) { setProperty("MovColumn", _rotation, 180); setProperty("MovShadow", _rotation, 180); } //Set the actual height currHeight = Math.abs(this.FCheight); setProperty("MovColumn", _height, currHeight); setProperty("MovShadow", _height, currHeight); //Set the color of the column clrCol = new Color("MovColumn"); clrCol.setRGB(parseInt(this.FCColor, 16)); //Set the x-position of the shadow setProperty("MovShadow", _x, MovColumn._x+2); €€ Actions˙˙˙˙O˙O˙€€˙˙ CPicLayer˙˙ CPicFrame˙˙ CPicSpr˙˙CPicPage˙˙ CPicLayer˙˙ CPicFrame˙˙ CPicSprite d˙Ék MovColumn€€˙˙˙?˙˙aD€€ Column˙˙˙˙O€˙˙€€€€˙˙˙?˙˙3˙Ánd = (Math.floor(maxValue/y_interval)+1)*y_interval; //Calculate the y-axis lower limit var y_lowerBound; //If the min value is less than 0 if (minValue<0) { //Then calculate by multiplying negative numbers with y-axis interval y_lowerBound = (Math.floor(minValue/y_interval))*y_interval; } else { //Else, simply set it to 0. y_lowerBound = 0; } //y_topBound now contains the y-axis lower limit //y_lowerBound contains the y-axis upper limit //Now, we need to make a check as to whether the user has provided an upper limit //If he has provided it and it is valid, we leave it as the upper limit //Else, we enforced the value calculate by us as the upper limit. if (this.Params.SYAxisMaxValue == null || this.Params.SYAxisMaxValue == undefined || this.Params.SYAxisMaxValue == "" || this.Params.SYAxisMaxValueminValue) { this.Params.SYAxisMinValue = y_lowerBound; } this.Params.SYAxisMaxValue = Number(this.Params.SYAxisMaxValue); this.Params.SYAxisMinValue = Number(this.Params.SYAxisMinValue); }; Chart.prototype.calculatePoints = function() { //This function calculates the pixel co-ordinates of all //the elements on the chart. //Calculate the y axis intervals this.Params.PYAxisInterval = this.Params.PYAxisMaxValue-this.Params.PYAxisMinValue; this.Params.SYAxisInterval = this.Params.SYAxisMaxValue-this.Params.SYAxisMinValue; //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, t˙˙CPicPage˙˙ CPicLayer˙˙ CPicFrame€€˙˙˙?˙˙ FInitializez€€ Labels˙˙˙˙O˙O˙€€€€˙˙˙?˙˙es˙,//-------------------------// //Chart Initialization here// //-------------------------// /* Set local width and height - this local width and height would be assumed if the user ha˙˙CPicPage˙˙ CPicLayer˙˙ CPicFrame€€˙3f˙ó ˙˙Ŕů0 Ń0@0ŕ.˙˙˙?˙˙ťf€€ Layer 1˙˙˙˙O€˙˙€˙˙CPicPage˙˙ CPicLayer˙˙ CPicFrame˙˙CPicText€€ ń˙˙;ţ˙˙˙ƒ˙ embedText ,./<>?;':"[]{}__+=|\!@#$%^&*()`~@Verdana˙"(€€˙˙˙?˙˙H€€ Layer 1˙˙˙˙O€˙˙˙˙CPicPage˙˙ CPicLayer˙˙ CPicFrame€€ĚĚ˙ó¸ŕü 0Hĺ0ŕü0¸˙˙˙?˙˙"€€ Loader˙˙˙˙O€˙˙€€(#Xhhhh€o been downloaded. In this frame, we'll: 1. Show a rsn'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ú+€€ Physical Objects˙˙˙˙™3Ě˙€€€€˙˙˙?˙˙°b€€€˙˙˙?˙˙ FStartLoad•/€€€˙˙˙?˙˙FLoadingWo€€€˙˙˙?˙˙ FLoadingCheckő€€€˙˙˙?˙˙FXMLLoadß\€€€˙˙˙?˙˙ FXMLLoading€P€€€˙˙˙?˙˙ FXMLChecklr€€€˙˙˙?˙˙FXMLDonem€€ Labels˙˙˙˙O˙O˙€€€€˙˙˙?˙˙D˙Ł//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; €€€˙˙˙?˙˙ts˙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 have 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 the movie that has been loaded (upto this moment) into the viewer's machine bytesLoaded = this.getBytesLoaded(); //Keep on playing play(); €€€˙˙˙?˙˙ŮcB//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, "565")); _global._chartHeight = Number(getFirstValue(_root.chartHeight, "420")); /* 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, setthis.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 - 10 pixels - only required if caption/subcaption to be shown if ((this.Params.showCaption == 1) || (this.Params.showSubCaption == 1)) { LCanvasHeight = LCanvasHeight-10; verticalBlockedHt = verticalBlockedHt+10; } LCanvasStartY = _FCYShift+verticalBlockedHt; //Now, we get the height of the x-axis labels (categories) 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.categories[i].showName == 1) { if (this.Params.rotateNames == 1) { //If the name is to be rendered in rotated style LCatNameHeight = createText(25001, this.categories[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.categories[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 height is more than the previous text height //Override the value if (LCatNameHeight>LMaxCatNameHeight) { ot 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()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()horTextWidth_2) { horizontalMaxLength = horTextWidth; } else { horizontalMaxLength = horTextWidth_2; } } if (this.Params.showSecondaryLimits == 1) { //----------- NOW FOR SECONDARY DATASET --------------- //Get the textwidth for upper limit horTextWidth = createText(25001, this.formatNumber(this.Params.SYAxisMaxValue, this.Params.firstSDSIndex, 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.SYAxisMinValue, this.Params.firstSDSIndex, 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) { horizontalMaxLengthRight = horTextWidth; } else { horizontalMaxLengthRight = 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.PYAxisMinValue+i*(this.Params.PYAxisInterval/(this.Params.numDivLines+1))); divLineSecondaryValue = (this.Params.SYAxisMinValue+i*(this.Params.SYAxisInterval/(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, divLineSecondaryValue, this.formatNumber(divLineValue, this.Params.firstPDSIndex, this.Params.divLineDecimalPrecision), this.formatNumber(divLineSecondaryValue, this.Params.firstSDSIndex, this.Params.divLineDecimalPrecision), this.Params.showDivLineValue, this.Params.showDivLineSecondaryValue); //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 (this.Params.showDivLineSecondaryValue == 1) { horTextWidthRight = createText(25001, this.Divlines[i].displaySecondaryValue, 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; } if (horTextWidthRight>horizontalMaxLengthRight) { horizontalMaxLengthRight = horTextWidthRight; } } if (this.Params.SYAxisName != "") { //Get the textwidth for y axis name horTextWidth = createText(25001, this.Params.SYAxisName, 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 horizontalMaxLengthRight = horizontalMaxLengthRight+horTextWidth; //Create an object representing the y axis name this.objects.SYAxisName = new Chart.cObject((_FCXShift+_chartWidth)-(horTextWidth+this.Params.chartRightMargin), 0, horTextWidth, 0); } //Now, we have the maximum text length //So-set the canvas start and end position horizontalBlockWd = horizontalBlockWd+horizontalMaxLength; LCanvasWidth = LCanvasWidth-horizontalMaxLength; LCanvasStartX = _FCXShift+horizontalBlockWd; //Accomodate for right side div line values horizontalBlockWd = horizontalBlockWd+horizontalMaxLengthRight; LCanvasWidth = LCanvasWidth-horizontalMaxLengthRight; LCanvasEndX = LCanvasStartX+LCanvasWidth; //Create a canvas object in this.Objects this.Objects.canvas = new Chart.cObject(LCanvasStartX, LCanvasStartY, LCanvasHeight, LCanvasWidth); //Now, we have the size for the entire chart canvas //The canvas comprises of two things - canvas background and canvas base //The height and slant width of canvas base depends on the number of columns and width (depth) of each column //Now, we will calculate the space to be alloted to the canvasBg and canvasBase //First, depending on the number of columns, calculate the width of each column. var colWidth, availableWidth, totalSpacingArea, interColSpace; this.Params.totalColums = this.Params.num*this.Params.numPDS; //By default assume total spacing area to be 20% of the space available totalSpacingArea = (this.Objects.Canvas.width-(2*this.Constants.CANVAS_PADDING))*0.2; //Now, calculate the available width availableWidth = this.Objects.Canvas.width-((2*this.Constants.CANVAS_PADDING)+totalSpacingArea); colWidth = availableWidth/this.Params.totalColums; //Now, if colWidth is greater than max, re-set colWidth = (colWidth>this.Constants.MAX_COLUMN_WIDTH) ? (this.Constants.MAX_COLUMN_WIDTH) : (colWidth); //Re-calculate the spacing Area totalSpacingArea = (this.Objects.Canvas.width-((2*this.Constants.CANVAS_PADDING)+(colWidth*this.Params.totalColums))); //Now, get the X and Y (Tilt) Shift this.calcColumnShifts(colWidth); var canvasBaseHeight; this.Objects.canvas = new Chart.cObject(LCanvasStartX, LCanvasStartY, LCanvasHeight, LCanvasWidth); canvasBaseHeight = this.Objects.Canvas.height-(this.Constants.Y_SHIFT+this.Params.canvasBaseDepth); //Now create two objects CanvasBg and CanvasBase this.Objects.CanvasBg = new Chart.cObject(this.Objects.Canvas.xPos, this.Objects.Canvas.yPos, canvasBaseHeight, aL@#sŔlA˙˙˙˙€Symbol 4 MovColumnXp3?E..\..\..\Ver_2_1\CustomizedCharts\MSColumn2D\Developer\MSColumn2D.fla MovColumn‹é@Xp3?sŔlA˙˙˙˙€Symbol 5 MovColumnBase;p3?E..\..\..\Ver_2_1\CustomizedCharts\MSColumn2D\Developer\MSColumn2D.fla MovColumnBase1L@;p3?1L@˙˙˙˙€Symbol 6 MovEmbedTextz}b@ ..\Draft.fla MovEmbedText$:őAz}b@$:őA˙˙˙˙€Symbol 7 FCProgressBarßwëA› FCProgressBar-..\MSColumnLine_3D\FC_2_3_MSColumnLine_3D.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 Format0˙˙˙˙ü˙˙ 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˙˙hhe 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 = 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; } //Canvas Properties this.Params.canvasBgColor = formatHexColor(getFirstValue(levelOneNodes[i].attributes.canvasBgColor, "DDE3D5")); this.Params.canvasBaseColor = formatHexColor(getFirstValue(levelOneNodes[i].attributes.canvasBaseColor, "ACBB99")); this.Params.canvasBaseDepth = Number(getFirstValue(levelOneNodes[i].attributes.canvasBaseDepth, "10")); this.Params.canvasBgDepth = Number(getFirstValue(levelOneNodes[i].attributes.canvasBgDepth, "3")); //X and Y Axis Name this.Params.xAxisName = getFirstValue(levelOneNodes[i].attributes.xAxisName, ""); this.Params.PYAxisName = getFirstValue(levelOneNodes[i].attributes.PYAxisName, ""); this.Params.SYAxisName = getFirstValue(levelOneNodes[i].attributes.SYAxisName, ""); //Canvas background color, border color and border thickness (in pixels) //The upper and lower limits of y axis (both primary and secondary) this.Params.PYAxisMinValue = levelOneNodes[i].attributes.PYAxisMinValue; this.Params.PYAxisMaxValue = levelOneNodes[i].attributes.PYAxisMaxValue; this.Params.SYAxisMinValue = levelOneNodes[i].attributes.SYAxisMinValue; this.Params.SYAxisMaxValue = levelOneNodes[i].attributes.SYAxisMaxValue; this.Params.animation = Number(getFirstValue(levelOneNodes[i].attributes.animation, "1")); //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, "1")); //Option to show/hide limits this.Params.showLimits = Number(getFirstValue(levelOneNodes[i].attributes.showLimits, "1")); this.Params.showSecondaryLimits = Number(getFirstValue(levelOneNodes[i].attributes.showSecondaryLimits, this.Params.showLimits)); //Show/hide the legend this.Params.showLegend = Number(getFirstValue(levelOneNodes[i].attributes.showLegend, "1")); //Option to show/hide canvas base and bg this.Params.showCanvasBg = Number(getFirstValue(levelOneNodes[i].attributes.showCanvasBg, "1")); this.Params.showCanvasBase = Number(getFirstValue(levelOneNodes[i].attributes.showCanvasBase, "1")); //Option to show vertical x-axis labels this.Params.rotateNames = Number(getFirstValue(levelOneNodes[i].attributes.rotateNames, "0")); //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")); this.Params.showDivLineSecondaryValue = Number(getFirstValue(levelOneNodes[i].attributes.showDivLineSecondaryValue, this.Params.showDivLineValue)); //Zero Plane this.Params.zeroPlaneColor = formatHexColor(getFirstValue(levelOneNodes[i].attributes.zeroPlaneColor, "ACBB99")); this.Params.zeroPlaneAlpha = Number(getFirstValue(levelOneNodes[i].attributes.zeroPlaneAlpha, "75")); this.Params.zeroPlaneShowBorder = Number(getFirstValue(levelOneNodes[i].attributes.zeroPlaneShowBorder, "1")); this.Params.zeroPlaneBorderColor = formatHexColor(getFirstValue(levelOneNodes[i].attributes.zeroPlaneBorderColor, this.Params.zeroPlaneColor)); //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, ", "); //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)); //Line Properties this.Params.lineColor = formatHexColor(getFirstValue(levelOneNodes[i].attributes.lineColor, "333333")); this.Params.lineThickness = Number(getFirstValue(levelOneNodes[i].attributes.lineThickness, "2")); this.Params.lineAlpha = Number(getFirstValue(levelOneNodes[i].attributes.lineAlpha, "100")); //Line 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, "50")); //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)); //Anchor Properties this.Params.showAnchors = Number(getFirstValue(levelOneNodes[i].attributes.showAnchors, "1")); this.Params.anchorSides = Number(getFirstValue(levelOneNodes[i].attributes.anchorSides, "4")); this.Params.anchorRadius = Number(getFirstValue(levelOneNodes[i].attributes.anchorRadius, "4")); this.Params.anchorBorderColor = formatHexColor(getFirstValue(levelOneNodes[i].attributes.anchorBorderColor, "333333")); this.Params.anchorBorderThickness = Number(getFirstValue(levelOneNodes[i].attributes.anchorBorderThickness, "1")); this.Params.anchorBgColor = formatHexColor(getFirstValue(levelOneNodes[i].attributes.anchorBgColor, "f1f1f1")); this.Params.anchorAlpha = Number(getFirstValue(levelOneNodes[i].attributes.anchorAlpha, "100")); this.Params.anchorBgAlpha = Number(getFirstValue(levelOneNodes[i].attributes.anchorBgAlpha, this.Params.anchorAlpha)); //Option whether the format the number (using Commas) this.Params.formatNumber = Number(getFirstValue(levelOneNodes[i].attributes.formatNumber, "1")); //Option to format number scale this.Params.formatNumberScale = Number(getFirstValue(levelOneNodes[i].attributes.formatNumberScale, "1")); //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")); //Decimal Precision cannot be less than 0 - so adjust it if (this.Params.decimalPrecision<0) { this.Params.decimalPrecision = 0; } //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)); //Chart Margins this.Params.chartLeftMargin = Number(getFirstValue(levelOneNodes[i].attributes.chartLeftMargin, "15")); this.Params.chartRightMargin = Number(getFirstValue(levelOneNodes[i].attributes.chartRightMargin, "0")); 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 TRENDLINES nodes levelTwoNodes = levelOneNodes[i].childNodes; for (j=0; j<=levelTwoNodes.length; j++) { //If its a categories node if (levelTwoNodes[j].nodeName.toUpperCase() == "CATEGORIES") { //Extract the category info //Get a reference to the categories sub nodes categoryNodes = levelTwoNodes[j].childNodes; //Extract the category attributes like font, fontSize & fontColor this.Params.catFont = getFirstValue(levelTwoNodes[j].attributes.font, this.Params.outCnvBaseFont); this.Params.catFontSize = Number(getFirstValue(levelTwoNodes[j].attributes.fontSize, this.Params.outCnvBaseFontSize)); this.Params.catFontColor = formatHexColor(getFirstValue(levelTwoNodes[j].attributes.fontColor, ths.Params.outCnvBaseFontColor)); //Now, iterate through each of the category nodes and store the data in the array for (k=0; k<=categoryNodes.length; k++) { //If the node is really a category subnode if (categoryNodes[k].nodeName.toUpperCase() == "CATEGORY") { //Increment value this.Params.num++; //Get the category name var catName = categoryNodes[k].attributes.name; //Option whether to show the cat Name or not var showCatName = Number(getFirstValue(categoryNodes[k].attributes.showName, this.Params.showNames)); var catHoverText = getFirstValue(categoryNodes[k].attributes.hoverText, catName); this.categories[this.Params.num] = new Chart.category(catName, showCatName, catHoverText); } } //Free memory resources delete categoryNodes; } else if (levelTwoNodes[j].nodeName.toUpperCase() == "DATASET") { //Increment the number of ds this.Params.numDs++; //Extract the attributes this.dataset[this.Params.numDs] = new Chart.dataSetParams(); this.dataset[this.Params.numDs].parentYAxis = getFirstValue(levelTwoNodes[j].attributes.parentYAxis, "P"); this.dataset[this.Params.numDs].parentYAxis = this.dataset[this.Params.numDs].parentYAxis.toUpperCase(); //Make a count of the primary and secondary datasets if (this.dataset[this.Params.numDs].parentYAxis == "P") { this.Params.numPDS++; //Also, make the entry for first index if (this.Params.firstPDSIndex == 0) { this.Params.firstPDSIndex = this.Params.numDs; } //Last Index this.Params.lastPDSIndex = this.Params.numDs; } else { this.Params.numSDS++; //Also, make the entry for first index if (this.Params.firstSDSIndex == 0) { this.Params.firstSDSIndex = this.Params.numDs; } this.Params.lastSDSIndex = this.Params.numDs; } this.dataset[this.Params.numDs].seriesName = levelTwoNodes[j].attributes.seriesName; this.dataset[this.Params.numDs].color = formatHexColor(getFirstValue(levelTwoNodes[j].attributes.color, "FF5904")); this.dataset[this.Params.numDs].showValues = Number(getFirstValue(levelTwoNodes[j].attributes.showValues, this.Params.ShowValues)); this.dataset[this.Params.numDs].alpha = Number(getFirstValue(levelTwoNodes[j].attributes.alpha, "100")); this.dataset[this.Params.numDs].lineThickness = Number(getFirstValue(levelTwoNodes[j].attributes.lineThickness, this.Params.lineThickness)); //Dataset pertinent anchor properties this.dataset[this.Params.numDs].showAnchors = Number(getFirstValue(levelTwoNodes[j].attributes.showAnchors, this.Params.showAnchors)); this.dataset[this.Params.numDs].anchorRadius = Number(getFirstValue(levelTwoNodes[j].attributes.anchorRadius, this.Params.anchorRadius)); this.dataset[this.Params.numDs].anchorSides = Number(getFirstValue(levelTwoNodes[j].attributes.anchorSides, this.Params.anchorSides)); this.dataset[this.Params.numDs].anchorBorderColor = formatHexColor(getFirstValue(levelTwoNodes[j].attributes.anchorBorderColor, this.Params.anchorBorderColor)); this.dataset[this.Params.numDs].anchorBorderThickness = Number(getFirstValue(levelTwoNodes[j].attributes.anchorBorderThickness, this.Params.anchorBorderThickness)); this.dataset[this.Params.numDs].anchorBgColor = formatHexColor(getFirstValue(levelTwoNodes[j].attributes.anchorBgColor, this.Params.anchorBgColor)); this.dataset[this.Params.numDs].anchorAlpha = Number(getFirstValue(levelTwoNodes[j].attributes.anchorAlpha, this.Params.anchorAlpha)); this.dataset[this.Params.numDs].anchorBgAlpha = Number(getFirstValue(levelTwoNodes[j].attributes.anchorBgAlpha, this.Params.anchorBgAlpha)); //Number prefix and suffix this.dataset[this.Params.numDs].numberPrefix = getFirstValue(unescape(levelTwoNodes[j].attributes.numberPrefix), this.Params.numberPrefix); this.dataset[this.Params.numDs].numberSuffix = getFirstValue(unescape(levelTwoNodes[j].attributes.numberSuffix), this.Params.numberSuffix); //Now, get a reference to the child nodes setNodes = levelTwoNodes[j].childNodes; //Now, create a data array and assign it this.dataset[this.Params.numDs].data = new Array(); //A counter var var counter = 0; //Iterate through each set one by one for (k=0; k<=setNodes.length; k++) { //If it's really a set node if (setNodes[k].nodeName.toUpperCase() == "SET") { //Increment the counter counter++; this.Params.numSets++; //Extract the attributes var setValue = setNodes[k].attributes.value; //Check for negative number if (setValue<0 && this.dataset[this.Params.numDs].parentYAxis == "P") { this.Params.PNegativeNumPresent = true; //Now, keep a count of negative numbers if it's a primary dataset (column) this.Params.numNegativeNumbers++; } var setLink = unescape(setNodes[k].attributes.link); var setColor = formatHexColor(getFirstValue(setNodes[k].attributes.color, this.dataSet[this.Params.numDs].color)); var setAlpha = Number(getFirstValue(setNodes[k].attributes.alpha, this.dataset[this.Params.numDs].alpha)); if (setValue == undefined || setValue == null || setValue == "") { //Create an empty dataset element this.dataset[this.Params.numDs].data[counter] = new Chart.dataItem(0, "", "", 0); setAlpha = 0; } else { //Create the object to represent it this.dataset[this.Params.numDs].data[counter] = new Chart.dataItem(Number(setValue), setColor, setLink, setAlpha); } if ((this.dataset[this.Params.numDs].parentYAxis == "S") && (setAlpha == 0)) { //If it's a line dataset and if the alpha of this point is 0, then that of previous line will also be 0. //So that the whole line would appear invisible. this.dataset[this.Params.numDs].data[counter-1].alpha = 0; } } } //Free memory resource delete setNodes; } } } } //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(parentYAxis) { //This method returns the highest y-axis value //amongsts all the dataset having parentYAxis //By default we assume the max value to be that of the first dataset var intMaxVal = (parentYAxis == "P") ? (this.dataSet[this.Params.firstPDSIndex].data[1].value) : (this.dataSet[this.Params.firstSDSIndex].data[1].value); //Now, iterate through each of the dataset for (i=1; i<=this.Params.numDs; i++) { //Iterate through each of the data belonging to parentYAxis if (this.dataSet[i].parentYAxis == parentYAxis) { for (j=1; j<=this.Params.num; j++) { if (this.dataset[i].data[j].value>intMaxVal && this.dataset[i].data[j].showDataSet == 1) { intMaxVal = this.dataset[i].data[j].value; } } } } //Return the value return intMaxVal; }; Chart.prototype.getYAxisMinValue = function(parentYAxis) { //This method returns the lowest y-axis value //amongsts all the dataset having parentYAxis var intMinVal = (parentYAxis == "P") ? (this.dataSet[this.Params.firstPDSIndex].data[1].value) : (this.dataSet[this.Params.firstSDSIndex].data[1].value); //Now, iterate through each of the values to compare //Iterate through each of the data belonging to parentYAxis for (i=1; i<=this.Params.numDs; i++) { if (this.dataSet[i].parentYAxis == parentYAxis) { //Iterate through each of the data for (j=1; j<=this.Params.num; j++) { if (this.dataset[i].data[j].valueminValue) { this.Params.PYAxisMinValue = y_lowerBound; } this.Params.PYAxisMaxValue = Number(this.Params.PYAxisMaxValue); this.Params.PYAxisMinValue = Number(this.Params.PYAxisMinValue); //----------------------------------------------------------------// //---------NOW CALCULATE THE LIMITS FOR SECONDARY LIMITS---------- //----------------------------------------------------------------// //First, we get the y-axis highest and lowest values maxValue = this.getYAxisMaxValue("S"); minValue = this.getYAxisMinValue("S"); //Now, get the maximum power of 10 that is applicable to maxvalue //The Number = 10 to the power maxPowerOfTen + x (where x is another number) //For e.g., in 99 the maxPowerOfTen will be 1 = 10^1 + 89 //And for 102, it will be 2 = 10^2 + 2 var maxPowerOfTen = Math.floor(Math.log(Math.abs(maxValue))/Math.LN10); //Get the minimum power of 10 that is applicable to maxvalue var minPowerOfTen = Math.floor(Math.log(Math.abs(minValue))/Math.LN10); //Find which powerOfTen (the max power or the min power) is bigger //It is this which will be multiplied to get the y-interval var powerOfTen = Math.max(minPowerOfTen, maxPowerOfTen); var y_interval = Math.pow(10, powerOfTen); //For accomodating values falling on exact multiples of 10 like max=0 and min=-10 if (Math.abs(maxValue)/y_interval<2 && Math.abs(minValue)/y_interval<2) { powerofTen--; y_interval = Math.pow(10, powerOfTen); } //Calculate the y-axis upper limit var y_topBound = (Math.floor(maxValue/y_interval)+1)*y_interval; //Calculate the y-axis lower limit var y_lowerBound; //If the min value is less than 0 if (minValue<0) { //Then calculate by multiplying negative numbers with y-axis interval y_lowerBound = (Math.floor(minValue/y_interval))*y_interval; } else { //Else, simply set it to 0. y_lowerBound = 0; } //y_topBound now contains the y-axis lower limit //y_lowerBound contains the y-axis upper limit //Now, we need to make a check as to whether the user has provided an upper limit //If he has provided it and it is valid, we leave it as the upper limit //Else, we enforced the value calculate by us as the upper limit. if (this.Params.SYAxisMaxValue == null || this.Params.SYAxisMaxValue == undefined || this.Params.SYAxisMaxValue == "" || this.Params.SYAxisMaxValueminValue) { this.Params.SYAxisMinValue = y_lowerBound; } this.Params.SYAxisMaxValue = Number(this.Params.SYAxisMaxValue); this.Params.SYAxisMinValue = Number(this.Params.SYAxisMinValue); }; Chart.prototype.calculatePoints = function() { //This function calculates the pixel co-ordinates of all //the elements on the chart. //Calculate the y axis intervals this.Params.PYAxisInterval = this.Params.PYAxisMaxValue-this.Params.PYAxisMinValue; this.Params.SYAxisInterval = this.Params.SYAxisMaxValue-this.Params.SYAxisMinValue; //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 - 10 pixels - only required if caption/subcaption to be shown if ((this.Params.showCaption == 1) || (this.Params.showSubCaption == 1)) { LCanvasHeight = LCanvasHeight-10; verticalBlockedHt = verticalBlockedHt+10; } LCanvasStartY = _FCYShift+verticalBlockedHt; //Now, we get the height of the x-axis labels (categories) 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.categories[i].showName == 1) { if (this.Params.rotateNames == 1) { //If the name is to be rendered in rotated style LCatNameHeight = createText(25001, this.categories[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.categories[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 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; } //Now, calculate the space required for legend if (this.Params.showLegend == 1) { var legendHeight = this.drawLegend(25001, this.Constants.calcTextXPos, this.Constants.calcTextYPos); //Add to blocked height and canvas size LCanvasHeight = LCanvasHeight-legendHeight; verticalBlockedHt = verticalBlockedHt+legendHeight; //Delete Legend deleteText(25001); } //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 horizontalMaxLengthRight = 0; var horTextWidth, horTextWidth_2, horTextWidthRight; //Now, we need to get the max length of the text of either of the following: //Y-axis name //Limit textboxes //Div Line Textboxes if (this.Params.PYAxisName != "") { //Get the textwidth for y axis name horTextWidth = createText(25001, this.Params.PYAxisName, 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.PYAxisName = new Chart.cObject(_FCXShift+horizontalBlockWd-horTextWidth, 0, 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, formatNumber(this.Params.PYAxisMaxValue, this.Params.firstPDSIndex, 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, formatNumber(this.Params.PYAxisMinValue, this.Params.firstPDSIndex, 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; } } if (this.Params.showSecondaryLimits == 1) { //----------- NOW FOR SECONDARY DATASET --------------- //Get the textwidth for upper limit horTextWidth = createText(25001, this.formatNumber(this.Params.SYAxisMaxValue, this.Params.firstSDSIndex, 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.SYAxisMinValue, this.Params.firstSDSIndex, 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) { horizontalMaxLengthRight = horTextWidth; } else { horizontalMaxLengthRight = 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.PYAxisMinValue+i*(this.Params.PYAxisInterval/(this.Params.numDivLines+1))); divLineSecondaryValue = (this.Params.SYAxisMinValue+i*(this.Params.SYAxisInterval/(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, divLineSecondaryValue, this.formatNumber(divLineValue, this.Params.firstPDSIndex, this.Params.divLineDecimalPrecision), this.formatNumber(divLineSecondaryValue, this.Params.firstSDSIndex, this.Params.divLineDecimalPrecision), this.Params.showDivLineValue, this.Params.showDivLineSecondaryValue); //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 (this.Params.showDivLineSecondaryValue == 1) { horTextWidthRight = createText(25001, this.Divlines[i].displaySecondaryValue, 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; } if (horTextWidthRight>horizontalMaxLengthRight) { horizontalMaxLengthRight = horTextWidthRight; } } if (this.Params.SYAxisName != "") { //Get the textwidth for y axis name horTextWidth = createText(25001, this.Params.SYAxisName, 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 horizontalMaxLengthRight = horizontalMaxLengthRight+horTextWidth; //Create an object representing the y axis name this.objects.SYAxisName = new Chart.cObject((_FCXShift+_chartWidth)-(horTextWidth+this.Params.chartRightMargin), 0, horTextWidth, 0); } //Now, we have the maximum text length //So-set the canvas start and end position horizontalBlockWd = horizontalBlockWd+horizontalMaxLength; LCanvasWidth = LCanvasWidth-horizontalMaxLength; LCanvasStartX = _FCXShift+horizontalBlockWd; //Accomodate for right side div line values horizontalBlockWd = horizontalBlockWd+horizontalMaxLengthRight; LCanvasWidth = LCanvasWidth-horizontalMaxLengthRight; LCanvasEndX = LCanvasStartX+LCanvasWidth; //Create a canvas object in this.Objects this.Objects.canvas = new Chart.cObject(LCanvasStartX, LCanvasStartY, LCanvasHeight, LCanvasWidth); //Now, we have the size for the entire chart canvas //The canvas comprises of two things - canvas background and canvas base //The height and slant width of canvas base depends on the number of columns and width (depth) of each column //Now, we will calculate the space to be alloted to the canvasBg and canvasBase //First, depending on the number of columns, calculate the width of each column. var colWidth, availableWidth, totalSpacingArea, interColSpace; this.Params.totalColums = this.Params.num*this.Params.numPDS; //By default assume total spacing area to be 20% of the space available totalSpacingArea = (this.Objects.Canvas.width-(2*this.Constants.CANVAS_PADDING))*0.2; //Now, calculate the available width availableWidth = this.Objects.Canvas.width-((2*this.Constants.CANVAS_PADDING)+totalSpacingArea); colWidth = availableWidth/this.Params.totalColums; //Now, if colWidth is greater than max, re-set colWidth = (colWidth>this.Constants.MAX_COLUMN_WIDTH) ? (this.Constants.MAX_COLUMN_WIDTH) : (colWidth); //Re-calculate the spacing Area totalSpacingArea = (this.Objects.Canvas.width-((2*this.Constants.CANVAS_PADDING)+(colWidth*this.Params.totalColums))); //Now, get the X and Y (Tilt) Shift this.calcColumnShifts(colWidth); var canvasBaseHeight; this.Objects.canvas = new Chart.cObject(LCanvasStartX, LCanvasStartY, LCanvasHeight, LCanvasWidth); canvasBaseHeight = this.Objects.Canvas.height-(this.Constants.Y_SHIFT+this.Params.canvasBaseDepth); //Now create two objects CanvasBg and CanvasBase this.Objects.CanvasBg = new Chart.cObject(this.Objects.Canvas.xPos, this.Objects.Canvas.yPos, canvasBaseHeight, (this.Objects.Canvas.width-this.Params.canvasBgDepth)); this.Objects.CanvasBase = new Chart.cObject(this.Objects.Canvas.xPos, this.Objects.Canvas.yPos+canvasBaseHeight, this.Constants.Y_SHIFT, this.Constants.X_SHIFT); //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.PPerUnitPixels = this.Objects.CanvasBg.height/this.Params.PYAxisInterval; //Zero plane position calculation //Set the negativeNumPresent and showZeroPlane flag to the correct value if (this.Params.PNegativeNumPresent || this.Params.PYAxisMinValue<0) { if (this.Params.PYAxisMaxValue>=0) { this.Params.PShowZeroPlane = true; } } //Now if the zero plane is to be shown, calculate the zero plane pos if (this.Params.PShowZeroPlane) { this.Params.PZeroPlanePos = (this.Objects.CanvasBg.yPos+this.Objects.CanvasBg.height)-(this.Params.PPerUnitPixels*(0-this.Params.PYAxisMinValue)); } else { this.Params.PZeroPlanePos = (this.Objects.CanvasBg.yPos+this.Objects.CanvasBg.height); } //First, width calculation interColSpace = totalSpacingArea/(this.Params.num+1); //Get the position of the columns now. var leftIntercept, columnCounter; for (i=1; i<=this.Params.Num; i++) { //Get the position of the categories. if (this.Params.num>1) { leftIntercept = this.Objects.CanvasBg.xPos+this.Constants.CANVAS_PADDING+(interColSpace*i)+((i-1)*this.Params.numPDs*colWidth); } else { leftIntercept = this.Objects.CanvasBg.xPos+this.Constants.CANVAS_PADDING+(totalSpacingArea/2); } this.categories[i].xpos = leftIntercept+((this.Params.numPDs*colWidth)/2)-(this.Constants.X_SHIFT/2); this.categories[i].ypos = this.Objects.CanvasBase.yPos+this.Params.canvasBaseDepth+this.Constants.Y_SHIFT; //Now, re-adjust the position of categories and get the position of columns columnCounter = 0; for (j=1; j<=this.Params.numDS; j++) { //If it's a primary dataSet if (this.dataSet[j].parentYAxis == "P") { columnCounter++; //For the x pos of the columns and the categories this.dataset[j].data[i].xpos = leftIntercept+(columnCounter-0.5)*(colWidth); this.dataset[j].data[i].yPos = this.Params.PZeroPlanePos; //Now, height for each column if (this.Params.PYAxisMinValue>0) { this.dataset[j].data[i].height = (this.dataset[j].data[i].value-this.Params.PYAxisMinValue)*this.Params.PPerUnitPixels; } else { this.dataset[j].data[i].height = Math.abs(this.dataset[j].data[i].value)*this.Params.PPerUnitPixels; } //Animation property if (this.Params.animation == 0) { //If no animation is to be done, set full initial height this.dataSet[j].data[i].heightRendered = this.dataSet[j].data[i].height; } this.dataset[j].data[i].width = colWidth; } } } //Now, horizontal divlines var divLineHorizontalSpace; divLineHorizontalSpace = this.Objects.CanvasBg.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.CanvasBg.xPos; this.Divlines[i].endXPos = this.Objects.CanvasBg.xPos+this.Objects.CanvasBg.width; //Calculate the y position of the div line this.Divlines[i].startYPos = this.Objects.CanvasBg.yPos+(divLineHorizontalSpace*i); this.Divlines[i].endYPos = this.Objects.CanvasBg.yPos+(divLineHorizontalSpace*i); } }; Chart.prototype.calculateLinePoints = function() { //This function calculates the line chart points //Fill up empty data points for (i=1; i<=this.Params.numDs; i++) { //It's a secondary dataset if (this.dataSet[i].parentYAxis == "S") { for (j=1; j<=this.Params.num; j++) { if (this.dataSet[i].data[j].value == null || this.dataSet[i].data[j].value == undefined) { this.dataSet[i].data[j] = new Chart.dataItem(0, 0, ""); } } } } //We now get the position of all the points on the chart //Determine the per-unit-pixel factor this.Params.SPerUnitPixels = this.Objects.CanvasBg.height/this.Params.SYAxisInterval; //Zero plane position calculation this.Params.isSZeroPlanePresent = false; if (this.Params.SYAxisMinValue<0) { if (this.Params.SAxisMaxValue>=0) { this.Params.isSZeroPlanePresent = true; } } if (this.Params.isSZeroPlanePresent) { this.Params.SZeroPlanePos = (this.Objects.CanvasBg.yPos+this.Objects.CanvasBg.height)-(this.Params.SPerUnitPixels*(0-this.Params.SYAxisMinValue)); } else { this.Params.SZeroPlanePos = (this.Objects.CanvasBg.yPos+this.Objects.CanvasBg.height); } for (i=1; i<=this.Params.numDs; i++) { //If it's a secondary dataSet if (this.dataSet[i].parentYAxis == "S") { for (j=1; j<=this.Params.num; j++) { //For the x pos of the columns and the categories this.dataset[i].data[j].xPos = this.categories[j].xPos; this.dataset[i].data[j].yPos = this.getAxisPosition(this.dataset[i].data[j].value, this.Params.SYAxisMaxValue, this.Params.SYAxisMinValue, this.Objects.CanvasBg.yPos, this.Objects.CanvasBg.yPos+this.Objects.CanvasBg.height, true); //Calculate the value tb Position this.dataset[i].data[j].valueTbX = this.dataset[i].data[j].xpos; //Value y position this.dataset[i].data[j].valueTbY = this.dataset[i].data[j].ypos; } } } }; //-------- DEPTH RELATED FUNCTIONS ---------// 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.allotColumnDepths = function() { //This function allots Column Depths this.Params.negativeStartDepth = this.getLevel(); //Update the main depth counter _global._FCLastLevel = _global._FCLastLevel+this.Params.numNegativeNumbers; this.Params.zeroPlaneDepth = this.getLevel(); this.Params.positiveStartDepth = this.getLevel(); //Again, update main counter _global._FCLastLevel = _global._FCLastLevel+((this.Params.num*this.Params.numDs)-this.Params.numNegativeNumbers); }; //---- Co-ordinates related ----// Chart.prototype.calculatePoint = function(fromX, fromY, distance, angle) { //This function calculates the x and y co-ordinates of a point at an angular distance of "distance,angle" from the base point fromX, fromY //Angle required in radians - i.e., angle *(Math.PI/180) var xPos = fromX+(distance*Math.Cos(angle)); var yPos = fromY-(distance*Math.sin(angle)); return ({x:xPos, y:yPos}); }; Chart.prototype.calcColumnShifts = function(intColumnWidth) { //This function precalculates the x and y shift of the column based on the width of the column //intColumnWidth - is the width of the column to be drawn //First, calculate the width of the front part and the shadow part var wFront, wShadow; //Initial ratio= front part:shadow=2:1 wFront = intColumnWidth*(2/3); //If the column width is more than 25 pixels, restrict the shadow to max 15 pixels if (intColumnWidth>=25) { wShadow = 15; wFront = (intColumnWidth-(wShadow*(Math.Sin(this.Constants.COLUMN_TILT_ANGLE*(Math.PI/180))))); } else { this.Params.highDepthColumns = true; wShadow = 20; } var pShadowBaseRightY, pShadowBaseRightX; pShadowBaseRightX = 0; pShadowBaseRightY = 0; //Calculate the points and store in a temporary object this.tmpObject = this.calculatePoint(pShadowBaseRightX, pShadowBaseRightY, wShadow, (180+this.Constants.COLUMN_TILT_ANGLE)*(Math.PI/180)); pShadowBaseLeftX = this.tmpObject.x; pShadowBaseLeftY = this.tmpObject.y; //Set the global values this.Constants.X_SHIFT = Math.abs(pShadowBaseLeftX-pShadowBaseRightX); this.Constants.Y_SHIFT = Math.abs(pShadowBaseLeftY-pShadowBaseRightY); this.Constants.COLUMN_WIDTH = wFront; this.Constants.COLUMN_SHADOW_WIDTH = (wShadow*Math.Sin(this.Constants.COLUMN_TILT_ANGLE*(Math.PI/180))); }; 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.prototype.formatNumber = function(number, dataSet, 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.dataSet[dataSet].numberPrefix+strNum+strScale+this.dataSet[dataSet].numberSuffix; return strNum; }; //**** 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 //This function draws the chart canvas if (this.Params.showCanvasBase == 1) { //First, get the color combinations for the canvas base var canvasDarkColor, canvasLightColor; canvasDarkColor = this.getDarkColor(this.Params.canvasBaseColor, this.Constants.DARK_SHADOW_INTENSITY); canvasLightColor = this.getDarkColor(this.Params.canvasBaseColor, this.Constants.LIGHT_SHADOW_INTENSITY); createEmptyMovieClip("ASMov_Canvas_Base", this.getLevel()); canvasMC = eval("ASMov_Canvas_Base"); //Re-allocation of variables for local access var canvasStartX = this.Objects.CanvasBase.xPos; var canvasStartY = this.Objects.CanvasBase.yPos; var canvasWidth = this.Objects.Canvas.width-this.Params.canvasBgDepth; var canvasDepth = this.Params.canvasBaseDepth; //Create the top part canvasMC.beginFill(canvasLightColor, this.Constants.CANVAS_ALPHA); canvasMC.lineStyle(1, canvasLightColor, this.Constants.CANVAS_ALPHA); canvasMC.moveTo(canvasStartX, canvasStartY); canvasMC.lineTo(canvasStartX+canvasWidth, canvasStartY); canvasMC.lineTo((canvasStartX+canvasWidth)-this.Constants.X_SHIFT, canvasStartY+this.Constants.Y_SHIFT); canvasMC.lineTo(canvasStartX-this.Constants.X_SHIFT, canvasStartY+this.Constants.Y_SHIFT); canvasMC.lineTo(canvasStartX, canvasStartY); canvasMC.endFill(); //Create the front part canvasMC.beginFill(parseInt(this.Params.canvasBaseColor, 16), this.Constants.CANVAS_ALPHA); canvasMC.lineStyle(1, parseInt(this.Params.canvasBaseColor, 16), this.Constants.CANVAS_ALPHA); canvasMC.moveTo(canvasStartX-this.Constants.X_SHIFT, canvasStartY+this.Constants.Y_SHIFT); canvasMC.lineTo(canvasStartX-this.Constants.X_SHIFT, canvasStartY+this.Constants.Y_SHIFT+canvasDepth); canvasMC.lineTo((canvasStartX+canvasWidth)-this.Constants.X_SHIFT, canvasStartY+this.Constants.Y_SHIFT+canvasDepth); canvasMC.lineTo(canvasStartX+canvasWidth-this.Constants.X_SHIFT, canvasStartY+canvasDepth+this.Constants.Y_SHIFT); canvasMC.lineTo(canvasStartX+canvasWidth-this.Constants.X_SHIFT, canvasStartY+this.Constants.Y_SHIFT); canvasMC.endFill(); //Create the right most part canvasMC.beginFill(canvasDarkColor, this.Constants.CANVAS_ALPHA); canvasMC.lineStyle(1, canvasDarkColor, this.Constants.CANVAS_ALPHA); canvasMC.moveTo(canvasStartX+canvasWidth-this.Constants.X_SHIFT, canvasStartY+this.Constants.Y_SHIFT); canvasMC.lineTo(canvasStartX+canvasWidth, canvasStartY); canvasMC.lineTo(canvasStartX+canvasWidth, canvasStartY+canvasDepth); canvasMC.lineTo(canvasStartX+canvasWidth-this.Constants.X_SHIFT, canvasStartY+canvasDepth+this.Constants.Y_SHIFT); canvasMC.lineTo(canvasStartX+canvasWidth-this.Constants.X_SHIFT, canvasStartY+this.Constants.Y_SHIFT); canvasMC.endFill(); } if (this.Params.showCanvasBg == 1) { //Now, canvas background //Re-allocation of variables for local access var canvasBgStartX = this.Objects.CanvasBg.xPos; var canvasBgStartY = this.Objects.CanvasBg.yPos; var canvasBgEndX = this.Objects.CanvasBg.xPos+this.Objects.CanvasBg.width; var canvasBgEndY = this.Objects.CanvasBg.yPos+this.Objects.CanvasBg.height; var canvasBgDepth = this.Params.canvasBgDepth; //First, create the face rectangle createEmptyMovieClip("ASMov_Canvas_Bg", this.getLevel()); CanvasBgMC = eval("ASMov_Canvas_Bg"); CanvasBgMC.beginFill(parseInt(this.Params.canvasBgColor, 16), 100); CanvasBgMC.moveTo(canvasBgStartX, canvasBgStartY); CanvasBgMC.lineTo(canvasBgEndX, canvasBgStartY); CanvasBgMC.lineTo(canvasBgEndX, canvasBgEndY); CanvasBgMC.lineTo(canvasBgStartX, canvasBgEndY); CanvasBgMC.lineTo(canvasBgStartX, canvasBgStartY); CanvasBgMC.endFill(); //Create the shadow now (right side) var canvasShadowColor = this.getDarkColor(this.Params.canvasBgColor, this.Constants.LIGHT_SHADOW_INTENSITY); CanvasBgMC.beginFill(canvasShadowColor, 100); CanvasBgMC.moveTo(canvasBgEndX, canvasBgStartY); CanvasBgMC.lineTo(canvasBgEndX+canvasBgDepth, canvasBgStartY+canvasBgDepth); CanvasBgMC.lineTo(canvasBgEndX+canvasBgDepth, canvasBgEndY-canvasBgDepth); CanvasBgMC.lineTo(canvasBgEndX, canvasBgEndY); CanvasBgMC.lineTo(canvasBgEndX, canvasBgStartY); CanvasBgMC.endFill(); } }; 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.PShowZeroPlane) && (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); } } //Show secondary value if (this.divLines[i].showSecondaryValue == 1) { if (!((this.Params.PShowZeroPlane) && (this.divLines[i].secondaryValue == 0))) { createText(this.getLevel(), this.divLines[i].displaySecondaryValue, this.divLines[i].endXPos+this.Params.canvasBgDepth, this.divLines[i].startYPos, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, false, "left", "center", null, true); } } } }; Chart.prototype.setCatNames = function() { //Set the category names //First, recalculate the category position var firstDSX, lastDSX, difference; for (i=1; i<=this.Params.num; i++) { //Get the starting x position of the first column in the group firstDSX = this.dataSet[this.Params.firstPDSIndex].data[i].frontfaceCenterX; //Get the ending X position of the last column in the group barring the shadow lastDSX = this.dataSet[this.Params.lastPDSIndex].data[i].frontfaceCenterX; //Get the difference difference = lastDSX-firstDSX; //Calculate the center position this.categories[i].xpos = firstDSX+(difference/2); } //Now, set the category labels (if its to be shown) for (i=1; i<=this.Params.num; i++) { if (this.categories[i].showName == 1) { if (this.Params.rotateNames == 1) { //If the name is to be rendered in rotated style createText(this.getLevel(), this.categories[i].name, this.categories[i].xPos, this.categories[i].yPos, _embedFontFace, this.Params.catFontSize, this.Params.catFontColor, false, "right", "center", this.Constants.catTextRotationAngle, true); } else { //Straight text createText(this.getLevel(), this.categories[i].name, this.categories[i].xPos, this.categories[i].yPos, this.Params.catFont, this.Params.catFontSize, this.Params.catFontColor, false, "center", "right", null, true); } } } }; 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 - primary createText(this.getLevel(), this.formatNumber(this.Params.PYAxisMaxValue, this.Params.firstPDSIndex, this.Params.limitsDecimalPrecision), this.Objects.CanvasBg.xPos, this.Objects.CanvasBg.yPos, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, true, "right", "center", null, true); //Lower Limit - primary createText(this.getLevel(), this.formatNumber(this.Params.PYAxisMinValue, this.Params.firstPDSIndex, this.Params.limitsDecimalPrecision), this.Objects.CanvasBg.xPos, this.Objects.CanvasBg.yPos+this.Objects.CanvasBg.height, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, true, "right", "center", null, true); } if (this.Params.showSecondaryLimits == 1) { //Upper Limit - secondary createText(this.getLevel(), this.formatNumber(this.Params.SYAxisMaxValue, this.Params.firstSDSIndex, this.Params.limitsDecimalPrecision), this.Objects.CanvasBg.xPos+this.Objects.CanvasBg.width+this.Params.canvasBgDepth, this.Objects.CanvasBg.yPos, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, true, "left", "center", null, true); //Lower Limit - secondary createText(this.getLevel(), this.formatNumber(this.Params.SYAxisMinValue, this.Params.firstSDSIndex, this.Params.limitsDecimalPrecision), this.Objects.CanvasBg.xPos+this.Objects.CanvasBg.width+this.Params.canvasBgDepth, this.Objects.CanvasBg.yPos+this.Objects.CanvasBg.height, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, true, "left", "center", null, true); } //Set the x-axis name if (this.Params.xAxisName != "") { createText(this.getLevel(), this.Params.xAxisName, this.Objects.CanvasBase.xPos+(this.Objects.CanvasBg.width/2)-this.Constants.X_SHIFT, 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.PYAxisName != "") { createText(this.getLevel(), this.Params.PYAxisName, this.Objects.PYAxisName.xPos, this.Objects.Canvas.yPos+(this.Objects.Canvas.height/2), "Verdana", Number(this.Params.outCnvBaseFontSize)+1, this.Params.outCnvBaseFontColor, false, "center", "center", 270, true); } if (this.Params.SYAxisName != "") { createText(this.getLevel(), this.Params.SYAxisName, this.Objects.SYAxisName.xPos, this.Objects.Canvas.yPos+(this.Objects.Canvas.height/2), "Verdana", Number(this.Params.outCnvBaseFontSize)+1, this.Params.outCnvBaseFontColor, false, "center", "center", 90, 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); } //Draw the legend if (this.Params.showLegend == 1) { this.drawLegend(this.getLevel(), _FCXShift+(_chartWidth/2), _FCYShift+(_chartHeight-this.Params.chartBottomMargin)); } }; Chart.prototype.drawLineValues = function() { //This function renders the line chart values //Set the value textboxes for (i=1; i<=this.Params.numDs; i++) { //if the values are to be shown if ((this.dataSet[i].showValues == 1) && (this.dataSet[i].parentYAxis == "S")) { for (j=1; j<=this.Params.num; j++) { if (this.dataset[i].data[j].showDataSet == 1) { //If the current values is greater than previous, show it above the point //Also adjust for the first value in each dataset if ((this.dataset[i].data[j].value>=this.dataset[i].data[j-1].value) || (i == 1) && (this.Params.num>1)) { //above createText(this.getLevel(), this.formatNumber(this.dataSet[i].data[j].value, i), this.dataSet[i].data[j].valueTbX, this.dataSet[i].data[j].valueTbY, this.Params.baseFont, this.Params.baseFontSize, this.Params.baseFontColor, false, "center", "left", null, true); } else { //Down createText(this.getLevel(), this.formatNumber(this.dataSet[i].data[j].value, i), this.dataSet[i].data[j].valueTbX, this.dataSet[i].data[j].valueTbY, this.Params.baseFont, this.Params.baseFontSize, this.Params.baseFontColor, false, "center", "right", null, true); } } } } } }; Chart.prototype.drawLegend = function(depth, xPos, yPos) { //This function draws the legend for FusionCharts //Create the legend string var strLegend; strLegend = "

"; i = 1; while (i<=this.Params.numDs) { if (this.dataSet[i].seriesName != undefined && this.dataSet[i].seriesName != null && this.dataSet[i].seriesName != '') { strLegend = strLegend+""+"•"+""; strLegend = strLegend+""+this.dataset[i].seriesName+" "; } i++; } strLegend = strLegend+"

"; createTextField("ASMovText_"+depth, depth, xPos, yPos, _chartWidth, 100); legendTB = eval("ASMovText_"+depth); //Set the properties legendTB.multiline = true; legendTB.wordWrap = true; legendTB.selectable = false; legendTB.autoSize = "center"; legendTB.border = false; legendTB.html = true; legendTB.htmlText = strLegend; //Set the x and y position legendTB._x = xPos-(legendTB._width/2); legendTB._y = yPos-(legendTB._height); //Return the text height return legendTB._height; }; Chart.prototype.drawZeroPlane = function() { //This function renders the zero plane on the chart if (this.Params.PShowZeroPlane) { //First, get the color combinations for the zero plane createEmptyMovieClip("ASMov_Zero_Plane", this.Params.zeroPlaneDepth); zeroPlaneMC = eval("ASMov_Zero_Plane"); //Re-allocation of variables for local access var zeroPlaneX = this.Objects.CanvasBg.xPos; var zeroPlaneY = this.Params.PZeroPlanePos; var zeroPlaneWidth = this.Objects.CanvasBg.width; //Create the top part zeroPlaneMC.beginFill(parseInt(this.Params.zeroPlaneColor, 16), this.Params.zeroPlaneAlpha); //Set border if required if (this.Params.zeroPlaneShowBorder == 1) { zeroPlaneMC.lineStyle(1, parseInt(this.Params.zeroPlaneBorderColor, 16), 100); } zeroPlaneMC.moveTo(zeroPlaneX, zeroPlaneY); zeroPlaneMC.lineTo(zeroPlaneX+zeroPlaneWidth, zeroPlaneY); zeroPlaneMC.lineTo((zeroPlaneX+zeroPlaneWidth)-this.Constants.X_SHIFT, zeroPlaneY+this.Constants.Y_SHIFT); zeroPlaneMC.lineTo(zeroPlaneX-this.Constants.X_SHIFT, zeroPlaneY+this.Constants.Y_SHIFT); zeroPlaneMC.lineTo(zeroPlaneX, zeroPlaneY); zeroPlaneMC.endFill(); //Render the text of the zero plane createText(this.getLevel(), this.formatNumber("0", this.Params.firstPDSIndex), this.Objects.Canvas.xPos, this.Params.PZeroPlanePos, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, true, "right", "center", null, true); } }; Chart.prototype.drawValueTb = function(dataSet, dataIndex) { //This function draws the value textbox for the particular column //First check if we have to display the value for this particular dataset if (this.dataset[dataset].showValues == 1 && this.dataset[dataset].data[dataIndex].showDataSet == 1) { //If the value belongs to the primary dataSet if (this.dataSet[dataSet].parentYAxis == "P") { //Calculate the co-ordinate for the value tb //Calculate the value tb Position if (this.dataset[dataSet].data[dataIndex].value>=0) { this.dataset[dataSet].data[dataIndex].valueTbX = this.dataset[dataSet].data[dataIndex].rearFaceCenterX; this.dataset[dataSet].data[dataIndex].valueTbY = this.dataset[dataSet].data[dataIndex].ypos-this.dataset[dataSet].data[dataIndex].height; createText(this.getLevel(), this.formatNumber(this.dataSet[dataSet].data[dataIndex].value, dataSet), this.dataSet[dataSet].data[dataIndex].valueTbX, this.dataSet[dataSet].data[dataIndex].valueTbY, this.Params.baseFont, this.Params.baseFontSize, this.Params.baseFontColor, false, "center", "left", null, true); } else { this.dataset[dataSet].data[dataIndex].valueTbX = this.dataset[dataSet].data[dataIndex].frontFaceCenterX; this.dataset[dataSet].data[dataIndex].valueTbY = this.dataset[dataSet].data[dataIndex].ypos+this.dataset[dataSet].data[dataIndex].height+this.Constants.Y_SHIFT; createText(this.getLevel(), this.formatNumber(this.dataSet[dataSet].data[dataIndex].value, dataSet), this.dataSet[dataSet].data[dataIndex].valueTbX, this.dataSet[dataSet].data[dataIndex].valueTbY, this.Params.baseFont, this.Params.baseFontSize, this.Params.baseFontColor, false, "center", "right", null, true); } } else { if ((this.dataset[dataSet].data[dataIndex].value>=this.dataset[dataSet].data[j-1].value) || (dataSet == 1) && (this.Params.num>1)) { //above createText(this.getLevel(), this.formatNumber(this.dataSet[dataSet].data[dataIndex].value, dataSet), this.dataSet[dataSet].data[dataIndex].valueTbX, this.dataSet[dataSet].data[dataIndex].valueTbY, this.Params.baseFont, this.Params.baseFontSize, this.Params.baseFontColor, false, "center", "left", null, true); } else { //Down createText(this.getLevel(), this.formatNumber(this.dataSet[dataSet].data[dataIndex].value, dataSet), this.dataSet[dataSet].data[dataIndex].valueTbX, this.dataSet[dataSet].data[dataIndex].valueTbY, this.Params.baseFont, this.Params.baseFontSize, this.Params.baseFontColor, false, "center", "right", null, true); } } } }; Chart.prototype.createColumn = function(dataSet, dataIndex, xPos, yPos, width, height, alpha, colColor, depth, isNeg, darkShadowColor, lightShadowColor) { //Calculate the various positions of the points var pShadowBaseRightX, pShadowBaseRightY; var pShadowBaseLeftX, pShadowBaseLeftY; var pShadowTopLeftX, pShadowTopLeftY; var pShadowTopRightX, pShadowTopRightY; var pCapTopLeftX, pCapTopLeftY; var pCapBaseLeftX, pCapBaseLeftY; var pColBaseLeftX, pColBaseLeftY; //Three full filled polygons to be drawn //1 (Shadow) - (pShadowBaseRightX, pShadowBaseRightY) - (pShadowBaseLeftX, pShadowBaseLeftY) - ( pShadowTopLeftX, pShadowTopLeftY) - (pShadowTopRightX, pShadowTopRightY) //2 (Cap) - (pShadowTopLeftX, pShadowTopLeftY) - (pShadowTopRightX, pShadowTopRightY)- (pCapTopLeftX, pCapTopLeftY) - (pCapBaseLeftX, pCapBaseLeftY) //3 (Front) - (pCapBaseLeftX, pCapBaseLeftY) - (pShadowTopLeftX, pShadowTopLeftY) - (pShadowBaseLeftX, pShadowBaseLeftY) - (pColBaseLeftX, pColBaseLeftY) if (!isNeg) { pShadowBaseRightX = xPos+(width/2); pShadowBaseRightY = yPos; pShadowBaseLeftX = pShadowBaseRightX-this.Constants.X_SHIFT; pShadowBaseLeftY = pShadowBaseRightY+this.Constants.Y_SHIFT; pShadowTopLeftX = pShadowBaseLeftX; pShadowTopLeftY = pShadowBaseLeftY-height; pShadowTopRightX = pShadowBaseRightX; pShadowTopRightY = pShadowBaseRightY-height; pCapTopLeftX = pShadowTopRightX-this.Constants.COLUMN_WIDTH; pCapTopLeftY = pShadowTopRightY; pCapBaseLeftX = pShadowTopLeftX-this.Constants.COLUMN_WIDTH; pCapBaseLeftY = pShadowTopLeftY; pColBaseLeftX = pCapBaseLeftX; pColBaseLeftY = pCapBaseLeftY+height; //Set the faceCenterX this.dataSet[dataSet].data[dataIndex].frontFaceCenterX = pColBaseLeftX+(this.Constants.COLUMN_WIDTH/2); this.dataSet[dataSet].data[dataIndex].rearFaceCenterX = pCapTopLeftX+(pShadowTopRightX-pCapTopLeftX)/2; //Create the container createEmptyMovieClip("ASMov_Column"+dataSet+"_"+dataIndex, depth); columnMC = eval("ASMov_Column"+dataSet+"_"+dataIndex); columnMC.beginFill(darkShadowColor, alpha); //Draw the Shadow columnMC.moveTo(pShadowBaseRightX, pShadowBaseRightY); columnMC.lineTo(pShadowBaseLeftX, pShadowBaseLeftY); columnMC.lineTo(pShadowTopLeftX, pShadowTopLeftY); columnMC.lineTo(pShadowTopRightX, pShadowTopRightY); columnMC.lineTo(pShadowBaseRightX, pShadowBaseRightY); columnMC.endFill(); //Draw the column Cap columnMC.beginFill(lightShadowColor, alpha); columnMC.moveTo(pShadowTopLeftX, pShadowTopLeftY); columnMC.lineTo(pShadowTopRightX, pShadowTopRightY); columnMC.lineTo(pCapTopLeftX, pCapTopLeftY); columnMC.lineTo(pCapBaseLeftX, pCapBaseLeftY); columnMC.lineTo(pShadowTopLeftX, pShadowTopLeftY); columnMC.endFill(); //Draw the column Front columnMC.begin(this.Objects.Canvas.width-this.Params.canvasBgDepth)); this.Objects.CanvasBase = new Chart.cObject(this.Objects.Canvas.xPos, this.Objects.Canvas.yPos+canvasBaseHeight, this.Constants.Y_SHIFT, this.Constants.X_SHIFT); //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.PPerUnitPixels = this.Objects.CanvasBg.height/this.Params.PYAxisInterval; //Zero plane position calculation //Set the negativeNumPresent and showZeroPlane flag to the correct value if (this.Params.PNegativeNumPresent || this.Params.PYAxisMinValue<0) { if (this.Params.PYAxisMaxValue>=0) { this.Params.PShowZeroPlane = true; } } //Now if the zero plane is to be shown, calculate the zero plane pos if (this.Params.PShowZeroPlane) { this.Params.PZeroPlanePos = (this.Objects.CanvasBg.yPos+this.Objects.CanvasBg.height)-(this.Params.PPerUnitPixels*(0-this.Params.PYAxisMinValue)); } else { this.Params.PZeroPlanePos = (this.Objects.CanvasBg.yPos+this.Objects.CanvasBg.height); } //First, width calculation interColSpace = totalSpacingArea/(this.Params.num+1); //Get the position of the columns now. var leftIntercept, columnCounter; for (i=1; i<=this.Params.Num; i++) { //Get the position of the categories. if (this.Params.num>1) { leftIntercept = this.Objects.CanvasBg.xPos+this.Constants.CANVAS_PADDING+(interColSpace*i)+((i-1)*this.Params.numPDs*colWidth); } else { leftIntercept = this.Objects.CanvasBg.xPos+this.Constants.CANVAS_PADDING+(totalSpacingArea/2); } this.categories[i].xpos = leftIntercept+((this.Params.numPDs*colWidth)/2)-(this.Constants.X_SHIFT/2); this.categories[i].ypos = this.Objects.CanvasBase.yPos+this.Params.canvasBaseDepth+this.Constants.Y_SHIFT; //Now, re-adjust the position of categories and get the position of columns columnCounter = 0; for (j=1; j<=this.Params.numDS; j++) { //If it's a primary dataSet if (this.dataSet[j].parentYAxis == "P") { columnCounter++; //For the x pos of the columns and the categories this.dataset[j].data[i].xpos = leftIntercept+(columnCounter-0.5)*(colWidth); this.dataset[j].data[i].yPos = this.Params.PZeroPlanePos; //Now, height for each column if (this.Params.PYAxisMinValue>0) { this.dataset[j].data[i].height = (this.dataset[j].data[i].value-this.Params.PYAxisMinValue)*this.Params.PPerUnitPixels; } else { this.dataset[j].data[i].height = Math.abs(this.dataset[j].data[i].value)*this.Params.PPerUnitPixels; } //Animation property if (this.Params.animation == 0) { //If no animation is to be done, set full initial height this.dataSet[j].data[i].heightRendered = this.dataSet[j].data[i].height; } this.dataset[j].data[i].width = colWidth; } } } //Now, horizontal divlines var divLineHorizontalSpace; divLineHorizontalSpace = this.Objects.CanvasBg.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.CanvasBg.xPos; this.Divlines[i].endXPos = this.Objects.CanvasBg.xPos+this.Objects.CanvasBg.width; //Calculate the y position of the div line this.Divlines[i].startYPos = this.Objects.CanvasBg.yPos+(divLineHorizontalSpace*i); this.Divlines[i].endYPos = this.Objects.CanvasBg.yPos+(divLineHorizontalSpace*i); } }; Chart.prototype.calculateLinePoints = function() { //This function calculates the line chart points //Fill up empty data points for (i=1; i<=this.Params.numDs; i++) { //It's a secondary dataset if (this.dataSet[i].parentYAxis == "S") { for (j=1; j<=this.Params.num; j++) { if (this.dataSet[i].data[j].value == null || this.dataSet[i].data[j].value == undefined) { this.dataSet[i].data[j] = new Chart.dataItem(0, 0, ""); } } } } //We now get the position of all the points on the chart //Determine the per-unit-pixel factor this.Params.SPerUnitPixels = this.Objects.CanvasBg.height/this.Params.SYAxisInterval; //Zero plane position calculation this.Params.isSZeroPlanePresent = false; if (this.Params.SYAxisMinValue<0) { if (this.Params.SAxisMaxValue>=0) { this.Params.isSZeroPlanePresent = true; } } if (this.Params.isSZeroPlanePresent) { this.Params.SZeroPlanePos = (this.Objects.CanvasBg.yPos+this.Objects.CanvasBg.height)-(this.Params.SPerUnitPixels*(0-this.Params.SYAxisMinValue)); } else { this.Params.SZeroPlanePos = (this.Objects.CanvasBg.yPos+this.Objects.CanvasBg.height); } for (i=1; i<=this.Params.numDs; i++) { //If it's a secondary dataSet if (this.dataSet[i].parentYAxis == "S") { for (j=1; j<=this.Params.num; j++) { //For the x pos of the columns and the categories this.dataset[i].data[j].xPos = this.categories[j].xPos; this.dataset[i].data[j].yPos = this.getAxisPosition(this.dataset[i].data[j].value, this.Params.SYAxisMaxValue, this.Params.SYAxisMinValue, this.Objects.CanvasBg.yPos, this.Objects.CanvasBg.yPos+this.Objects.CanvasBg.height, true); //Calculate the value tb Position this.dataset[i].data[j].valueTbX = this.dataset[i].data[j].xpos; //Value y position this.dataset[i].data[j].valueTbY = this.dataset[i].data[j].ypos; } } } }; //-------- DEPTH RELATED FUNCTIONS ---------// 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.allotColumnDepths = function() { //This function allots Column Depths this.Params.negativeStartDepth = this.getLevel(); //Update the main depth counter _global._FCLastLevel = _global._FCLastLevel+this.Params.numNegativeNumbers; this.Params.zeroPlaneDepth = this.getLevel(); this.Params.positiveStartDepth = this.getLevel(); //Again, update main counter _global._FCLastLevel = _global._FCLastLevel+((this.Params.num*this.Params.numDs)-this.Params.numNegativeNumbers); }; //---- Co-ordinates related ----// Chart.prototype.calculatePoint = function(fromX, fromY, distance, angle) { //This function calculates the x and y co-ordinates of a point at an angular distance of "distance,angle" from the base point fromX, fromY //Angle required in radians - i.e., angle *(Math.PI/180) var xPos = fromX+(distance*Math.Cos(angle)); var yPos = fromY-(distance*Math.sin(angle)); return ({x:xPos, y:yPos}); }; Chart.prototype.calcColumnShifts = function(intColumnWidth) { //This function precalculates the x and y shift of the column based on the width of the column //intColumnWidth - is the width of the column to be drawn //First, calculate the width of the front part and the shadow part var wFront, wShadow; //Initial ratio= front part:shadow=2:1 wFront = intColumnWidth*(2/3); //If the column width is more than 25 pixels, restrict the shadow to max 15 pixels if (intColumnWidth>=25) { wShadow = 15; wFront = (intColumnWidth-(wShadow*(Math.Sin(this.Constants.COLUMN_TILT_ANGLE*(Math.PI/180))))); } else { this.Params.highDepthColumns = true; wShadow = 20; } var pShadowBaseRightY, pShadowBaseRightX; pShadowBaseRightX = 0; pShadowBaseRightY = 0; //Calculate the points and store in a temporary object this.tmpObject = this.calculatePoint(pShadowBaseRightX, pShadowBaseRightY, wShadow, (180+this.Constants.COLUMN_TILT_ANGLE)*(Math.PI/180)); pShadowBaseLeftX = this.tmpObject.x; pShadowBaseLeftY = this.tmpObject.y; //Set the global values this.Constants.X_SHIFT = Math.abs(pShadowBaseLeftX-pShadowBaseRightX); this.Constants.Y_SHIFT = Math.abs(pShadowBaseLeftY-pShadowBaseRightY); this.Constants.COLUMN_WIDTH = wFront; this.Constants.COLUMN_SHADOW_WIDTH = (wShadow*Math.Sin(this.Constants.COLUMN_TILT_ANGLE*(Math.PI/180))); }; 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.prototype.formatNumber = function(number, dataSet, 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.dataSet[dataSet].numberPrefix+strNum+strScale+this.dataSet[dataSet].numberSuffix; return strNum; }; //**** 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 //This function draws the chart canvas if (this.Params.showCanvasBase == 1) { //First, get the color combinations for the canvas base var canvasDarkColor, canvasLightColor; canvasDarkColor = this.getDarkColor(this.Params.canvasBaseColor, this.Constants.DARK_SHADOW_INTENSITY); canvasLightColor = this.getDarkColor(this.Params.canvasBaseColor, this.Constants.LIGHT_SHADOW_INTENSITY); createEmptyMovieClip("ASMov_Canvas_Base", this.getLevel()); canvasMC = eval("ASMov_Canvas_Base"); //Re-allocation of variables for local access var canvasStartX = this.Objects.CanvasBase.xPos; var canvasStartY = this.Objects.CanvasBase.yPos; var canvasWidth = this.Objects.Canvas.width-this.Params.canvasBgDepth; var canvasDepth = this.Params.canvasBaseDepth; //Create the top part canvasMC.beginFill(canvasLightColor, this.Constants.CANVAS_ALPHA); canvasMC.lineStyle(1, canvasLightColor, this.Constants.CANVAS_ALPHA); canvasMC.moveTo(canvasStartX, canvasStartY); canvasMC.lineTo(canvasStartX+canvasWidth, canvasStartY); canvasMC.lineTo((canvasStartX+canvasWidth)-this.Constants.X_SHIFT, canvasStartY+this.Constants.Y_SHIFT); canvasMC.lineTo(canvasStartX-this.Constants.X_SHIFT, canvasStartY+this.Constants.Y_SHIFT); canvasMC.lineTo(canvasStartX, canvasStartY); canvasMC.endFill(); //Create the front part canvasMC.beginFill(parseInt(this.Params.canvasBaseColor, 16), this.Constants.CANVAS_ALPHA); canvasMC.lineStyle(1, parseInt(this.Params.canvasBaseColor, 16), this.Constants.CANVAS_ALPHA); canvasMC.moveTo(canvasStartX-this.Constants.X_SHIFT, canvasStartY+this.Constants.Y_SHIFT); canvasMC.lineTo(canvasStartX-this.Constants.X_SHIFT, canvasStartY+this.Constants.Y_SHIFT+canvasDepth); canvasMC.lineTo((canvasStartX+canvasWidth)-this.Constants.X_SHIFT, canvasStartY+this.Constants.Y_SHIFT+canvasDepth); canvasMC.lineTo(canvasStartX+canvasWidth-this.Constants.X_SHIFT, canvasStartY+canvasDepth+this.Constants.Y_SHIFT); canvasMC.lineTo(canvasStartX+canvasWidth-this.Constants.X_SHIFT, canvasStartY+this.Constants.Y_SHIFT); canvasMC.endFill(); //Create the right most part canvasMC.beginFill(canvasDarkColor, this.Constants.CANVAS_ALPHA); canvasMC.lineStyle(1, canvasDarkColor, this.Constants.CANVAS_ALPHA); canvasMC.moveTo(canvasStartX+canvasWidth-this.Constants.X_SHIFT, canvasStartY+this.Constants.Y_SHIFT); canvasMC.lineTo(canvasStartX+canvasWidth, canvasStartY); canvasMC.lineTo(canvasStartX+canvasWidth, canvasStartY+canvasDepth); canvasMC.lineTo(canvasStartX+canvasWidth-this.Constants.X_SHIFT, canvasStartY+canvasDepth+this.Constants.Y_SHIFT); canvasMC.lineTo(canvasStartX+canvasWidth-this.Constants.X_SHIFT, canvasStartY+this.Constants.Y_SHIFT); canvasMC.endFill(); } if (this.Params.showCanvasBg == 1) { //Now, canvas background //Re-allocation of variables for local access var canvasBgStartX = this.Objects.CanvasBg.xPos; var canvasBgStartY = this.Objects.CanvasBg.yPos; var canvasBgEndX = this.Objects.CanvasBg.xPos+this.Objects.CanvasBg.width; var canvasBgEndY = this.Objects.CanvasBg.yPos+this.Objects.CanvasBg.height; var canvasBgDepth = this.Params.canvasBgDepth; //First, create the face rectangle createEmptyMovieClip("ASMov_Canvas_Bg", this.getLevel()); CanvasBgMC = eval("ASMov_Canvas_Bg"); CanvasBgMC.beginFill(parseInt(this.Params.canvasBgColor, 16), 100); CanvasBgMC.moveTo(canvasBgStartX, canvasBgStartY); CanvasBgMC.lineTo(canvasBgEndX, canvasBgStartY); CanvasBgMC.lineTo(canvasBgEndX, canvasBgEndY); CanvasBgMC.lineTo(canvasBgStartX, canvasBgEndY); CanvasBgMC.lineTo(canvasBgStartX, canvasBgStartY); CanvasBgMC.endFill(); //Create the shadow now (right side) var canvasShadowColor = this.getDarkColor(this.Params.canvasBgColor, this.Constants.LIGHT_SHADOW_INTENSITY); CanvasBgMC.beginFill(canvasShadowColor, 100); CanvasBgMC.moveTo(canvasBgEndX, canvasBgStartY); CanvasBgMC.lineTo(canvasBgEndX+canvasBgDepth, canvasBgStartY+canvasBgDepth); CanvasBgMC.lineTo(canvasBgEndX+canvasBgDepth, canvasBgEndY-canvasBgDepth); CanvasBgMC.lineTo(canvasBgEndX, canvasBgEndY); CanvasBgMC.lineTo(canvasBgEndX, canvasBgStartY); CanvasBgMC.endFill(); } }; 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.PShowZeroPlane) && (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); } } //Show secondary value if (this.divLines[i].showSecondaryValue == 1) { if (!((this.Params.PShowZeroPlane) && (this.divLines[i].secondaryValue == 0))) { createText(this.getLevel(), this.divLines[i].displaySecondaryValue, this.divLines[i].endXPos+this.Params.canvasBgDepth, this.divLines[i].startYPos, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, false, "left", "center", null, true); } } } }; Chart.prototype.setCatNames = function() { //Set the category names //First, recalculate the category position var firstDSX, lastDSX, difference; for (i=1; i<=this.Params.num; i++) { //Get the starting x position of the first column in the group firstDSX = this.dataSet[this.Params.firstPDSIndex].data[i].frontfaceCenterX; //Get the ending X position of the last column in the group barring the shadow lastDSX = this.dataSet[this.Params.lastPDSIndex].data[i].frontfaceCenterX; //Get the difference difference = lastDSX-firstDSX; //Calculate the center position this.categories[i].xpos = firstDSX+(difference/2); } //Now, set the category labels (if its to be shown) for (i=1; i<=this.Params.num; i++) { if (this.categories[i].showName == 1) { if (this.Params.rotateNames == 1) { //If the name is to be rendered in rotated style createText(this.getLevel(), this.categories[i].name, this.categories[i].xPos, this.categories[i].yPos, _embedFontFace, this.Params.catFontSize, this.Params.catFontColor, false, "right", "center", this.Constants.catTextRotationAngle, true); } else { //Straight text createText(this.getLevel(), this.categories[i].name, this.categories[i].xPos, this.categories[i].yPos, this.Params.catFont, this.Params.catFontSize, this.Params.catFontColor, false, "center", "right", null, true); } } } }; 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 - primary createText(this.getLevel(), this.formatNumber(this.Params.PYAxisMaxValue, this.Params.firstPDSIndex, this.Params.limitsDecimalPrecision), this.Objects.CanvasBg.xPos, this.Objects.CanvasBg.yPos, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, true, "right", "center", null, true); //Lower Limit - primary createText(this.getLevel(), this.formatNumber(this.Params.PYAxisMinValue, this.Params.firstPDSIndex, this.Params.limitsDecimalPrecision), this.Objects.CanvasBg.xPos, this.Objects.CanvasBg.yPos+this.Objects.CanvasBg.height, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, true, "right", "center", null, true); } if (this.Params.showSecondaryLimits == 1) { //Upper Limit - secondary createText(this.getLevel(), this.formatNumber(this.Params.SYAxisMaxValue, this.Params.firstSDSIndex, this.Params.limitsDecimalPrecision), this.Objects.CanvasBg.xPos+this.Objects.CanvasBg.width+this.Params.canvasBgDepth, this.Objects.CanvasBg.yPos, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, true, "left", "center", null, true); //Lower Limit - secondary createText(this.getLevel(), this.formatNumber(this.Params.SYAxisMinValue, this.Params.firstSDSIndex, this.Params.limitsDecimalPrecision), this.Objects.CanvasBg.xPos+this.Objects.CanvasBg.width+this.Params.canvasBgDepth, this.Objects.CanvasBg.yPos+this.Objects.CanvasBg.height, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, true, "left", "center", null, true); } //Set the x-axis name if (this.Params.xAxisName != "") { createText(this.getLevel(), this.Params.xAxisName, this.Objects.CanvasBase.xPos+(this.Objects.CanvasBg.width/2)-this.Constants.X_SHIFT, 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.PYAxisName != "") { createText(this.getLevel(), this.Params.PYAxisName, this.Objects.PYAxisName.xPos, this.Objects.Canvas.yPos+(this.Objects.Canvas.height/2), "Verdana", Number(this.Params.outCnvBaseFontSize)+1, this.Params.outCnvBaseFontColor, false, "center", "center", 270, true); } if (this.Params.SYAxisName != "") { createText(this.getLevel(), this.Params.SYAxisName, this.Objects.SYAxisName.xPos, this.Objects.Canvas.yPos+(this.Objects.Canvas.height/2), "Verdana", Number(this.Params.outCnvBaseFontSize)+1, this.Params.outCnvBaseFontColor, false, "center", "center", 90, 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); } //Draw the legend if (this.Params.showLegend == 1) { this.drawLegend(this.getLevel(), _FCXShift+(_chartWidth/2), _FCYShift+(_chartHeight-this.Params.chartBottomMargin)); } }; Chart.prototype.drawLineValues = function() { //This function renders the line chart values //Set the value textboxes for (i=1; i<=this.Params.numDs; i++) { //if the values are to be shown if ((this.dataSet[i].showValues == 1) && (this.dataSet[i].parentYAxis == "S")) { for (j=1; j<=this.Params.num; j++) { if (this.dataset[i].data[j].showDataSet == 1) { //If the current values is greater than previous, show it above the point //Also adjust for the first value in each dataset if ((this.dataset[i].data[j].value>=this.dataset[i].data[j-1].value) || (i == 1) && (this.Params.num>1)) { //above createText(this.getLevel(), this.formatNumber(this.dataSet[i].data[j].value, i), this.dataSet[i].data[j].valueTbX, this.dataSet[i].data[j].valueTbY, this.Params.baseFont, this.Params.baseFontSize, this.Params.baseFontColor, false, "center", "left", null, true); } else { //Down createText(this.getLevel(), this.formatNumber(this.dataSet[i].data[j].value, i), this.dataSet[i].data[j].valueTbX, this.dataSet[i].data[j].valueTbY, this.Params.baseFont, this.Params.baseFontSize, this.Params.baseFontColor, false, "center", "right", null, true); } } } } } }; Chart.prototype.drawLegend = function(depth, xPos, yPos) { //This function draws the legend for FusionCharts //Create the legend string var strLegend; strLegend = "

"; i = 1; while (i<=this.Params.numDs) { if (this.dataSet[i].seriesName != undefined && this.dataSet[i].seriesName != null && this.dataSet[i].seriesName != '') { strLegend = strLegend+""+"•"+""; strLegend = strLegend+""+this.dataset[i].seriesName+" "; } i++; } strLegend = strLegend+"

"; createTextField("ASMovText_"+depth, depth, xPos, yPos, _chartWidth, 100); legendTB = eval("ASMovText_"+depth); //Set the properties legendTB.multiline = true; legendTB.wordWrap = true; legendTB.selectable = false; legendTB.autoSize = "center"; legendTB.border = false; legendTB.html = true; legendTB.htmlText = strLegend; //Set the x and y position legendTB._x = xPos-(legendTB._width/2); legendTB._y = yPos-(legendTB._height); //Return the text height return legendTB._height; }; Chart.prototype.drawZeroPlane = function() { //This function renders the zero plane on the chart if (this.Params.PShowZeroPlane) { //First, get the color combinations for the zero plane createEmptyMovieClip("ASMov_Zero_Plane", this.Params.zeroPlaneDepth); zeroPlaneMC = eval("ASMov_Zero_Plane"); //Re-allocation of variables for local access var zeroPlaneX = this.Objects.CanvasBg.xPos; var zeroPlaneY = this.Params.PZeroPlanePos; var zeroPlaneWidth = this.Objects.CanvasBg.width; //Create the top part zeroPlaneMC.beginFill(parseInt(this.Params.zeroPlaneColor, 16), this.Params.zeroPlaneAlpha); //Set border if required if (this.Params.zeroPlaneShowBorder == 1) { zeroPlaneMC.lineStyle(1, parseInt(this.Params.zeroPlaneBorderColor, 16), 100); } zeroPlaneMC.moveTo(zeroPlaneX, zeroPlaneY); zeroPlaneMC.lineTo(zeroPlaneX+zeroPlaneWidth, zeroPlaneY); zeroPlaneMC.lineTo((zeroPlaneX+zeroPlaneWidth)-this.Constants.X_SHIFT, zeroPlaneY+this.Constants.Y_SHIFT); zeroPlaneMC.lineTo(zeroPlaneX-this.Constants.X_SHIFT, zeroPlaneY+this.Constants.Y_SHIFT); zeroPlaneMC.lineTo(zeroPlaneX, zeroPlaneY); zeroPlaneMC.endFill(); //Render the text of the zero plane createText(this.getLevel(), this.formatNumber("0", this.Params.firstPDSIndex), this.Objects.Canvas.xPos, this.Params.PZeroPlanePos, this.Params.outCnvBaseFont, this.Params.outCnvBaseFontSize, this.Params.outCnvBaseFontColor, true, "right", "center", null, true); } }; Chart.prototype.drawValueTb = function(dataSet, dataIndex) { //This function draws the value textbox for the particular column //First check if we have to display the value for this particular dataset if (this.dataset[dataset].showValues == 1 && this.dataset[dataset].data[dataIndex].showDataSet == 1) { //If the value belongs to the primary dataSet if (this.dataSet[dataSet].parentYAxis == "P") { //Calculate the co-ordinate for the value tb //Calculate the value tb Position if (this.dataset[dataSet].data[dataIndex].value>=0) { this.dataset[dataSet].data[dataIndex].valueTbX = this.dataset[dataSet].data[dataIndex].rearFaceCenterX; this.dataset[dataSet].data[dataIndex].valueTbY = this.dataset[dataSet].data[dataIndex].ypos-this.dataset[dataSet].data[dataIndex].height; createText(this.getLevel(), this.formatNumber(this.dataSet[dataSet].data[dataIndex].value, dataSet), this.dataSet[dataSet].data[dataIndex].valueTbX, this.dataSet[dataSet].data[dataIndex].valueTbY, this.Params.baseFont, this.Params.baseFontSize, this.Params.baseFontColor, false, "center", "left", null, true); } else { this.dataset[dataSet].data[dataIndex].valueTbX = this.dataset[dataSet].data[dataIndex].frontFaceCenterX; this.dataset[dataSet].data[dataIndex].valueTbY = this.dataset[dataSet].data[dataIndex].ypos+this.dataset[dataSet].data[dataIndex].height+this.Constants.Y_SHIFT; createText(this.getLevel(), this.formatNumber(this.dataSet[dataSet].data[dataIndex].value, dataSet), this.dataSet[dataSet].data[dataIndex].valueTbX, this.dataSet[dataSet].data[dataIndex].valueTbY, this.Params.baseFont, this.Params.baseFontSize, this.Params.baseFontColor, false, "center", "right", null, true); } } else { if ((this.dataset[dataSet].data[dataIndex].value>=this.dataset[dataSet].data[j-1].value) || (dataSet == 1) && (this.Params.num>1)) { //above createText(this.getLevel(), this.formatNumber(this.dataSet[dataSet].data[dataIndex].value, dataSet), this.dataSet[dataSet].data[dataIndex].valueTbX, this.dataSet[dataSet].data[dataIndex].valueTbY, this.Params.baseFont, this.Params.baseFontSize, this.Params.baseFontColor, false, "center", "left", null, true); } else { //Down createText(this.getLevel(), this.formatNumber(this.dataSet[dataSet].data[dataIndex].value, dataSet), this.dataSet[dataSet].data[dataIndex].valueTbX, this.dataSet[dataSet].data[dataIndex].valueTbY, this.Params.baseFont, this.Params.baseFontSize, this.Params.baseFontColor, false, "center", "right", null, true); } } } }; Chart.prototype.createColumn = function(dataSet, dataIndex, xPos, yPos, width, height, alpha, colColor, depth, isNeg, darkShadowColor, lightShadowColor) { //Calculate the various positions of the points var pShadowBaseRightX, pShadowBaseRightY; var pShadowBaseLeftX, pShadowBaseLeftY; var pShadowTopLeftX, pShadowTopLeftY; var pShadowTopRightX, pShadowTopRightY; var pCapTopLeftX, pCapTopLeftY; var pCapBaseLeftX, pCapBaseLeftY; var pColBaseLeftX, pColBaseLeftY; //Three full filled polygons to be drawn //1 (Shadow) - (pShadowBaseRightX, pShadowBaseRightY) - (pShadowBaseLeftX, pShadowBaseLeftY) - ( pShadowTopLeftX, pShadowTopLeftY) - (pShadowTopRightX, pShadowTopRightY) //2 (Cap) - (pShadowTopLeftX, pShadowTopLeftY) - (pShadowTopRightX, pShadowTopRightY)- (pCapTopLeftX, pCapTopLeftY) - (pCapBaseLeftX, pCapBaseLeftY) //3 (Front) - (pCapBaseLeftX, pCapBaseLeftY) - (pShadowTopLeftX, pShadowTopLeftY) - (pShadowBaseLeftX, pShadowBaseLeftY) - (pColBaseLeftX, pColBaseLeftY) if (!isNeg) { pShadowBaseRightX = xPos+(width/2); pShadowBaseRightY = yPos; pShadowBaseLeftX = pShadowBaseRightX-this.Constants.X_SHIFT; pShadowBaseLeftY = pShadowBaseRightY+this.Constants.Y_SHIFT; pShadowTopLeftX = pShadowBaseLeftX; pShadowTopLeftY = pShadowBaseLeftY-height; pShadowTopRightX = pShadowBaseRightX; pShadowTopRightY = pShadowBaseRightY-height; pCapTopLeftX = pShadowTopRightX-this.Constants.COLUMN_WIDTH; pCapTopLeftY = pShadowTopRightY; pCapBaseLeftX = pShadowTopLeftX-this.Constants.COLUMN_WIDTH; pCapBaseLeftY = pShadowTopLeftY; pColBaseLeftX = pCapBaseLeftX; pColBaseLeftY = pCapBaseLeftY+height; //Set the faceCenterX this.dataSet[dataSet].data[dataIndex].frontFaceCenterX = pColBaseLeftX+(this.Constants.COLUMN_WIDTH/2); this.dataSet[dataSet].data[dataIndex].rearFaceCenterX = pCapTopLeftX+(pShadowTopRightX-pCapTopLeftX)/2; //Create the container createEmptyMovieClip("ASMov_Column"+dataSet+"_"+dataIndex, depth); columnMC = eval("ASMov_Column"+dataSet+"_"+dataIndex); columnMC.beginFill(darkShadowColor, alpha); //Draw the Shadow columnMC.moveTo(pShadowBaseRightX, pShadowBaseRightY); columnMC.lineTo(pShadowBaseLeftX, pShadowBaseLeftY); columnMC.lineTo(pShadowTopLeftX, pShadowTopLeftY); columnMC.lineTo(pShadowTopRightX, pShadowTopRightY); columnMC.lineTo(pShadowBaseRightX, pShadowBaseRightY); columnMC.endFill(); //Draw the column Cap columnMC.beginFill(lightShadowColor, alpha); columnMC.moveTo(pShadowTopLeftX, pShadowTopLeftY); columnMC.lineTo(pShadowTopRightX, pShadowTopRightY); columnMC.lineTo(pCapTopLeftX, pCapTopLeftY); columnMC.lineTo(pCapBaseLeftX, pCapBaseLeftY); columnMC.lineTo(pShadowTopLeftX, pShadowTopLeftY); columnMC.endFill(); //Draw the column Front columnMC.beginFill(parseInt(colColor, 16), alpha); columnMC.moveTo(pCapBaseLeftX, pCapBaseLeftY); columnMC.lineTo(pShadowTopLeftX, pShadowTopLeftY); columnMC.lineTo(pShadowBaseLeftX, pShadowBaseLeftY); columnMC.lineTo(pColBaseLeftX, pColBaseLeftY); columnMC.lineTo(pCapBaseLeftX, pCapBaseLeftY); columnMC.endFill(); } else { //Draw negative column pShadowTopRightX = xPos+(width/2); pShadowTopRightY = yPos; pShadowTopLeftX = pShadowTopRightX-this.Constants.X_SHIFT; pShadowTopLeftY = pShadowTopRightY+this.Constants.Y_SHIFT; pCapTopLeftX = pShadowTopRightX-this.Constants.COLUMN_WIDTH; pCapTopLeftY = pShadowTopRightY; pCapBaseLeftX = pShadowTopLeftX-this.Constants.COLUMN_WIDTH; pCapBaseLeftY = pShadowTopLeftY; pShadowBaseRightX = pShadowTopRightX; pShadowBaseRightY = pShadowTopRightY+height; pShadowBaseLeftX = pShadowTopLeftX; pShadowBaseLeftY = pShadowTopLeftY+height; pColBaseLeftX = pCapBaseLeftX; pColBaseLeftY = pCapBaseLeftY+height; //Set the face center positions this.dataSet[dataSet].data[dataIndex].frontFaceCenterX = pColBaseLeftX+(this.Constants.COLUMN_WIDTH/2); this.dataSet[dataSet].data[dataIndex].rearFaceCenterX = this.dataSet[dataSet].data[dataIndex].frontFaceCenterX; createEmptyMovieClip("ASMov_Column"+dataSet+"_"+dataIndex, depth); columnMC = eval("ASMov_Column"+dataSet+"_"+dataIndex); columnMC.beginFill(darkShadowColor, alpha); //Draw the Shadow columnMC.moveTo(pShadowBaseRightX, pShadowBaseRightY); columnMC.lineTo(pShadowBaseLeftX, pShadowBaseLeftY); columnMC.lineTo(pShadowTopLeftX, pShadowTopLeftY); columnMC.lineTo(pShadowTopRightX, pShadowTopRightY); columnMC.lineTo(pShadowBaseRightX, pShadowBaseRightY); columnMC.endFill(); //Draw the column Cap columnMC.beginFill(lightShadowColor, alpha); columnMC.moveTo(pShadowTopLeftX, pShadowTopLeftY); columnMC.lineTo(pShadowTopRightX, pShadowTopRightY); columnMC.lineTo(pCapTopLeftX, pCapTopLeftY); columnMC.lineTo(pCapBaseLeftX, pCapBaseLeftY); columnMC.lineTo(pShadowTopLeftX, pShadowTopLeftY); columnMC.endFill(); //Draw the column Front columnMC.beginFill(parseInt(colColor, 16), alpha); columnMC.moveTo(pCapBaseLeftX, pCapBaseLeftY); columnMC.lineTo(pShadowTopLeftX, pShadowTopLeftY); columnMC.lineTo(pShadowBaseLeftX, pShadowBaseLeftY); columnMC.lineTo(pColBaseLeftX, pColBaseLeftY); columnMC.lineTo(pCapBaseLeftX, pCapBaseLeftY); columnMC.endFill(); } //If column height is 0, set alpha to 0 if (height == 0) { columnMC._alpha = 0; this.dataSet[dataset].data[dataIndex].showDataSet = 0; } delete columnMC; }; Chart.prototype.renderColumn = function(dataSet, dataIndex) { //This function creates a column //Get the properties for the column //xPos indicates the center position of the base of column xPos = this.dataSet[dataSet].data[dataIndex].xPos; //yPos indicates the vertical position of the shadow right edge yPos = this.dataSet[dataSet].data[dataIndex].yPos; //width - width of the column required width = this.dataSet[dataSet].data[dataIndex].width; //height - height required in pixels height = this.dataSet[dataSet].data[dataIndex].height; //alpha - alpha of the column alpha = this.dataSet[dataSet].data[dataIndex].alpha; //colColor - color colColor = this.dataSet[dataSet].data[dataIndex].color; //isNeg indicates whether the column to be drawn is positive or drawn isNeg = this.dataSet[dataSet].data[dataIndex].isNeg; if (this.dataSet[dataSet].data[dataIndex].depth == 0) { if (isNeg) { //Depth depth = this.Params.negativeStartDepth++; } else { depth = this.Params.positiveStartDepth++; } this.dataSet[dataSet].data[dataIndex].depth = depth; } else { depth = this.dataSet[dataSet].data[dataIndex].depth; } //Define the colors if (this.dataSet[dataSet].data[dataIndex].darkShadowColor == null) { //This function creates the visual column this.dataSet[dataSet].data[dataIndex].darkShadowColor = this.getDarkColor(colColor, this.Constants.DARK_SHADOW_INTENSITY); this.dataSet[dataSet].data[dataIndex].lightShadowColor = this.getDarkColor(colColor, this.Constants.LIGHT_SHADOW_INTENSITY); } //Now, for animation options if (this.dataSet[dataSet].data[dataIndex].heightRendereddsYPosMax) { dsYPosMax = this.dataset[i].data[j].yPos; } if (this.dataset[i].data[j].yPos=(_FCXShift+_chartWidth)) { //Align on left ASMovHoverCaption._x = (_FCXShift+_chartWidth)-ASMovHoverCaption._width-1; } else if (this.dataset[dataSet].data[dataIndex].xPos<=ASMovHoverCaption._width/2) { ASMovHoverCaption._x = 1; } else { //Normal - center aligned ASMovHoverCaption._x = this.dataset[dataSet].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; }; Chart.prototype.resetPositionHoverCap = function() { //This function re-sets the y co-ordinate of the Hover Cap Box ASMovHoverCaption._y = _ymouse-ASMovHoverCaption._height-5; }; Chart.prototype.isAllColumnRendered = function() { var isAllColumnRendered = true; for (i=1; i<=this.Params.numDs; i++) { if (this.dataSet[i].parentYAxis == "P") { for (j=1; j<=this.Params.num; j++) { if (this.dataSet[i].data[j].showDataSet == 1) { isAllColumnRendered = (isAllColumnRendered) && (this.dataSet[i].data[j].heightRendered == this.dataSet[i].data[j].height); } } } } return isAllColumnRendered; }; //**** 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; }; //------------ COLOR RELATED FUNCTIONS --------------------// Chart.prototype.getDarkColor = function(sourceHexColor, intensityRequired) { // This function sets a darker color for the specified object // Based on the intensity specified //First format the hexcolor to trim the # and leading spaces sourceHexColor = formatHexColor(sourceHexColor); //Format the color in RGB notation sourceclrRGB = parseInt(sourceHexColor, 16); //Now, get the r,g,b values separated out of the specified color var r = Math.floor(sourceclrRGB/65536); var g = Math.floor((sourceclrRGB-r*65536)/256); var b = sourceclrRGB-r*65536-g*256; //Now, get the darker color based on the Intesity Specified darkColor = (r*intensityRequired) << 16 | (g*intensityRequired) << 8 | (b*intensityRequired); return (darkColor); }; Chart.prototype.getLightColor = function(sourceHexColor, intensityRequired) { // This function sets a lighter color for the specified object // Based on the intensity specified //First format the hexcolor to trim the # and the leading spaces sourceHexColor = formatHexColor(sourceHexColor); //Format the color in RGB notation sourceclrRGB = parseInt(sourceHexColor, 16); //Now, get the r,g,b values separated out of the specified color var r = Math.floor(sourceclrRGB/65536); var g = Math.floor((sourceclrRGB-r*65536)/256); var b = sourceclrRGB-r*65536-g*256; //Now, get the lighter color based on the Intesity Specified lightColor = (256-((256-r)*intensityRequired)) << 16 | (256-((256-g)*intensityRequired)) << 8 | (256-((256-b)*intensityRequired)); return (lightColor); }; 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€˙˙€€€€˙˙˙?˙˙pZĚ//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îü˙˙˙˙˙˙§FFill(parseInt(colColor, 16), alpha); columnMC.moveTo(pCapBaseLeftX, pCapBaseLeftY); columnMC.lineTo(pShadowTopLeftX, pShadowTopLeftY); columnMC.lineTo(pShadowBaseLeftX, pShadowBaseLeftY); columnMC.lineTo(pColBaseLeftX, pColBaseLeftY); columnMC.lineTo(pCapBaseLeftX, pCapBaseLeftY); columnMC.endFill(); } else { //Draw negative column pShadowTopRightX = xPos+(width/2); pShadowTopRightY = yPos; pShadowTopLeftX = pShadowTopRightX-this.Constants.X_SHIFT; pShadowTopLeftY = pShadowTopRightY+this.Constants.Y_SHIFT; pCapTopLeftX = pShadowTopRightX-this.Constants.COLUMN_WIDTH; pCapTopLeftY = pShadowTopRightY; pCapBaseLeftX = pShadowTopLeftX-this.Constants.COLUMN_WIDTH; pCapBaseLeftY = pShadowTopLeftY; pShadowBaseRightX = pShadowTopRightX; pShadowBaseRightY = pShadowTopRightY+height; pShadowBaseLeftX = pShadowTopLeftX; pShadowBaseLeftY = pShadowTopLeftY+height; pColBaseLeftX = pCapBaseLeftX; pColBaseLeftY = pCapBaseLeftY+height; //Set the face center positions this.dataSet[dataSet].data[dataIndex].frontFaceCenterX = pColBaseLeftX+(this.Constants.COLUMN_WIDTH/2); this.dataSet[dataSet].data[dataIndex].rearFaceCenterX = this.dataSet[dataSet].data[dataIndex].frontFaceCenterX; createEmptyMovieClip("ASMov_Column"+dataSet+"_"+dataIndex, depth); columnMC = eval("ASMov_Column"+dataSet+"_"+dataIndex); columnMC.beginFill(darkShadowColor, alpha); //Draw the Shadow columnMC.moveTo(pShadowBaseRightX, pShadowBaseRightY); columnMC.lineTo(pShadowBaseLeftX, pShadowBaseLeftY); columnMC.lineTo(pShadowTopLeftX, pShadowTopLeftY); columnMC.lineTo(pShadowTopRightX, pShadowTopRightY); columnMC.lineTo(pShadowBaseRightX, pShadowBaseRightY); columnMC.endFill(); //Draw the column Cap columnMC.beginFill(lightShadowColor, alpha); columnMC.moveTo(pShadowTopLeftX, pShadowTopLeftY); columnMC.lineTo(pShadowTopRightX, pShadowTopRightY); columnMC.lineTo(pCapTopLeftX, pCapTopLeftY); columnMC.lineTo(pCapBaseLeftX, pCapBaseLeftY); columnMC.lineTo(pShadowTopLeftX, pShadowTopLeftY); columnMC.endFill(); //Draw the column Front columnMC.beginFill(parseInt(colColor, 16), alpha); columnMC.moveTo(pCapBaseLeftX, pCapBaseLeftY); columnMC.lineTo(pShadowTopLeftX, pShadowTopLeftY); columnMC.lineTo(pShadowBaseLeftX, pShadowBaseLeftY); columnMC.lineTo(pColBaseLeftX, pColBaseLeftY); columnMC.lineTo(pCapBaseLeftX, pCapBaseLeftY); columnMC.endFill(); } //If column height is 0, set alpha to 0 if (height == 0) { columnMC._alpha = 0; this.dataSet[dataset].data[dataIndex].showDataSet = 0; } delete columnMC; }; Chart.prototype.renderColumn = function(dataSet, dataIndex) { //This function creates a column //Get the properties for the column //xPos indicates the center position of the base of column xPos = this.dataSet[dataSet].data[dataIndex].xPos; //yPos indicates the vertical position of the shadow right edge yPos = this.dataSet[dataSet].data[dataIndex].yPos; //width - width of the column required width = this.dataSet[dataSet].data[dataIndex].width; //height - height required in pixels height = this.dataSet[dataSet].data[dataIndex].height; //alpha - alpha of the column alpha = this.dataSet[dataSet].data[dataIndex].alpha; //colColor - color colColor = this.dataSet[dataSet].data[dataIndex].color; //isNeg indicates whether the column to be drawn is positive or drawn isNeg = this.dataSet[dataSet].data[dataIndex].isNeg; if (this.dataSet[dataSet].data[dataIndex].depth == 0) { if (isNeg) { //Depth depth = this.Params.negativeStartDepth++; } else { depth = this.Params.positiveStartDepth++; } this.dataSet[dataSet].data[dataIndex].depth = depth; } else { depth = this.dataSet[dataSet].data[dataIndex].depth; } //Define the colors if (this.dataSet[dataSet].data[dataIndex].darkShadowColor == null) { //This function creates the visual column this.dataSet[dataSet].data[dataIndex].darkShadowColor = this.getDarkColor(colColor, this.Constants.DARK_SHADOW_INTENSITY); this.dataSet[dataSet].data[dataIndex].lightShadowColor = this.getDarkColor(colColor, this.Constants.LIGHT_SHADOW_INTENSITY); } //Now, for animation options if (this.dataSet[dataSet].data[dataIndex].heightRendereddsYPosMax) { dsYPosMax = this.dataset[i].data[j].yPos; } if (this.dataset[i].data[j].yPos=(_FCXShift+_chartWidth)) { //Align on left ASMovHoverCaption._x = (_FCXShift+_chartWidth)-ASMovHoverCaption._width-1; } else if (this.dataset[dataSet].data[dataIndex].xPos<=ASMovHoverCaption._width/2) { ASMovHoverCaption._x = 1; } else { //Normal - center aligned ASMovHoverCaption._x = this.dataset[dataSet].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; }; Chart.prototype.resetPositionHoverCap = function() { //This function re-sets the y co-ordinate of the Hover Cap Box ASMovHoverCaption._y = _ymouse-ASMovHoverCaption._height-5; }; Chart.prototype.isAllColumnRendered = function() { var isAllColumnRendered = true; for (i=1; i<=this.Params.numDs; i++) { if (this.dataSet[i].parentYAxis == "P") { for (j=1; j<=this.Params.num; j++) { if (this.dataSet[i].data[j].showDataSet == 1) { isAllColumnRendered = (isAllColumnRendered) && (this.dataSet[i].data[j].heightRendered == this.dataSet[i].data[j].height); } } } } return isAllColumnRendered; }; //**** 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; }; //------------ COLOR RELATED FUNCTIONS --------------------// Chart.prototype.getDarkColor = function(sourceHexColor, intensityRequired) { // This function sets a darker color for the specified object // Based on the intensity specified //First format the hexcolor to trim the # and leading spaces sourceHexColor = formatHexColor(sourceHexColor); //Format the color in RGB notation sourceclrRGB = parseInt(sourceHexColor, 16); //Now, get the r,g,b values separated out of the specified color var r = Math.floor(sourceclrRGB/65536); var g = Math.floor((sourceclrRGB-r*65536)/256); var b = sourceclrRGB-r*65536-g*256; //Now, get the darker color based on the Intesity Specified darkColor = (r*intensityRequired) << 16 | (g*intensityRequired) << 8 | (b*intensityRequired); return (darkColor); }; Chart.prototype.getLightColor = function(sourceHexColor, intensityRequired) { // This function sets a lighter color for the specified object // Based on the intensity specified //First format the hexcolor to trim the # and the leading spaces sourceHexColor = formatHexColor(sourceHexColor); //Format the color in RGB notation sourceclrRGB = parseInt(sourceHexColor, 16); //Now, get the r,g,b values separated out of the specified color var r = Math.floor(sourceclrRGB/65536); var g = Math.floor((sourceclrRGB-r*65536)/256); var b = sourceclrRGB-r*65536-g*256; //Now, get the lighter color based on the Intesity Specified lightColor = (256-((256-r)*intensityRequired)) << 16 | (256-((256-g)*intensityRequired)) << 8 | (256-((256-b)*intensityRequired)); return (lightColor); }; 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€˙˙€€€€˙˙˙?˙˙ŚmĚ//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îü˙˙˙˙˙˙‰n€€˙˙˙?˙˙?€€ 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˙˙˙˙˙˙O˙€€§4jA ˙˙˙˙ŻęB)˙˙ CDocumentPagePage 3 ChartLoad;÷Ao˙˙˙˙!;÷A˙˙˙˙€Page 4DataLoad ;÷Ap˙˙˙˙C÷A˙˙˙˙€Page 2Chart§4jA ˙˙˙˙šçB˙˙˙˙€Symbol 1 MovLoaderBglÁN@G..\..\..\Customized\ClientWise\StreamCore\StackedArea\StackedArea2D.fla MovLoaderBg{ÁN@lÁN@{ÁN@˙˙˙˙€Symbol 3 MovColumnAniaL@#E..\..\..\Ver_2_1\CustomizedCharts\MSColumn2D\Developer\MSColumn2D.fla MovColumnAni é@aL@#sŔlA˙˙˙˙€Symbol 4 MovColumnXp3?E..\..\..\Ver_2_1\CustomizedCharts\MSColumn2D\Developer\MSColumn2D.fla MovColumn‹é@Xp3?sŔlA˙˙˙˙€Symbol 5 MovColumnBase;p3?E..\..\..\Ver_2_1\CustomizedCharts\MSColumn2D\Developer\MSColumn2D.fla MovColumnBase1L@;p3?1L@˙˙˙˙€Symbol 6 MovEmbedTextz}b@ ..\Draft.fla MovEmbedText$:őAz}b@$:ő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 Format0˙˙˙˙ü˙˙ CColorDef˙ €˙ €˙ €3˙Pď €f˙Pď0 €™˙PďH €Ě˙Pď` €˙˙Pďx €3˙ď €33˙(ď €€€˙˙˙?˙˙đ €€ 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˙˙CPicPage˙˙ CPicLayer˙˙ CPicFrame€€˙˙˙?˙˙['˙//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();€€€˙˙˙?˙˙bI˙Ó//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(); €€€˙˙˙?˙˙Š<˙ź//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"); } €€€˙˙˙?˙˙Ša˙â/* 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=€€€˙˙˙?˙˙FdataURLHandlern €€€˙˙˙?˙˙FdataXMLHandler