日期:2014-05-16 浏览次数:20396 次
#include "com/fusioncharts/includes/LoadingFunctions.as"
#include "com/fusioncharts/includes/AppMessages.as"
import com.fusioncharts.core.charts.Column2DChart;
import com.fusioncharts.core.charts.Line2DChart;
var strXML1:String = "<chart showBorder='0' bgAlpha='0,0' palette='1' caption='Hourly Working Rate' numberPrefix='$'>";
strXML1 = strXML1+"<set label='John' value='32' />";
strXML1 = strXML1+"<set label='Mary' value='65' />";
strXML1 = strXML1+"<set label='Michelle' value='29' />";
strXML1 = strXML1+"<set label='Cary' value='43' />";
strXML1 = strXML1+"</chart>";
var xmlData1:XML = new XML(strXML1);
// Data for Chart 2
var strXML2:String = "<chart showBorder='0' bgAlpha='0,0' palette='1' caption='Hours Worked Last week' canvasPadding='20'>";
//Add simple data for demo.
strXML2 = strXML2+"<set label='John' value='49' />";
strXML2 = strXML2+"<set label='Mary' value='34' />";
strXML2 = strXML2+"<set label='Michelle' value='61' />";
strXML2 = strXML2+"<set label='Cary' value='40' />";
strXML2 = strXML2+"</chart>";
var xmlData2:XML = new XML(strXML2);
// --------------------------------------------------- //
// -------------- Actual Code to create the chart ------------//
//Create movie clips required for both the charts
var chartContainer1MC:MovieClip = this.createEmptyMovieClip("ChartHolder1", 1);
var chartContainer2MC:MovieClip = this.createEmptyMovieClip("ChartHolder2", 2);
//Now, instantiate the charts using Constructor function of the chart.
var chart1:Column2DChart = new Column2DChart(chartContainer1MC, 1, 380, 325, 20, 15, false, "EN", "noScale");
var chart2:Line2DChart = new Line2DChart(chartContainer2MC, 1, 380, 325, 440, 15, false, "EN", "noScale");
//Convey the XML data to chart.
chart1.setXMLData(xmlData1);
chart2.setXMLData(xmlData2);
//Draw the charts
chart1.render();
chart2.render();
//Stop
stop();