Código PHP:
/**
* This keyframe contains the Actions required to load a FusionCharts
* chart in your Flash movie.
*
* We've set the FPS of this movie to 120 for smooth animations.
* Depending on your requirements, you can set any FPS. FusionCharts
* renders time based animations, so the length of animation would stay
* same. Only the smoothness would vary.
*/
//You first need to include the following two files in your movie.
//These two files contain pre-loading functions and application
//messages for the chart.
//Note: If you're loading multiple charts in your Flash movie, you
//do NOT need to include these files for each each. You can put these
//lines in the main timeline, so that it gets loaded only once.
#include "com/fusioncharts/includes/LoadingFunctions.as"
#include "com/fusioncharts/includes/AppMessages.as"
//To create the chart, you now need to import the Class of the
//chart which you want to create. All charts are present in the package
//com.fusioncharts.core.charts (Download Package > SourceCode folder)
//If you're using multiple charts, you can import all the requisite
//chart classes in the main timeline of your movie. That ways, you
//wouldn't have to import the chart classes everytime you wish to use.
import com.fusioncharts.core.charts.Column2DChart;
// ------------- XML Data for the chart -------------- //
//FusionCharts necessarily needs its data in XML format.
//So, if you've data in arrays, forms, recordsets, etc., you
//first need to convert it into XML. Only then would you be able
//to use the charts.
//Here, we're hard-coding an XML data document for demo.
//In your applications, this XML data could be dynamically
//built at run time using string concatenation or XML
//Object.
//Generate the XML data. We hide the border of chart, set background
//alpha as 0 (for transparency) and then set palette to 2.
//////////////////////////
//////////////////////////
datos_bd=new XML();
datos_bd.onLoad=function(exito){
if (exito){
var strXML:String = "<chart showBorder='0' bgAlpha='0,0' palette='1' caption='Hourly Working Rate' numberPrefix='$'>";
strXML = strXML <set name=.firstChild.childNodes value= .firstChild.nodeValue />;
strXML = strXML <set name=.firstChild.childNodes value= .firstChild.nodeValue />;
strXML = strXML <set name=.firstChild.childNodes value= .firstChild.nodeValue />;
strXML = strXML <set name=.firstChild.childNodes value= .firstChild.nodeValue />;
strXML = strXML </chart>;
}
else {
trace("Error al cargar los datos");
}
}
datos_bd.load("Data2005.xml");
//Add simple data for demo.
//FusionCharts chart classes accept XML data as XML Object
//and not XML String.
//So, if you've an XML string, first create an XML object from it
//and then pass to the chart. We do the same.
var xmlData:XML = new XML(strXML);
// --------------------------------------------------- //
// -------------- Actual Code to create the chart ------------//
//To create a chart, you first need to create an empty movie clip to act as chart holder.
var chartContainerMC:MovieClip = this.createEmptyMovieClip("ChartHolder",1);
//Now, instantiate the chart using Constructor function of the chart.
/**
* @param targetMC Movie clip reference in which
* the chart will create its own movie clip.s
* @param depth Depth inside parent movie clip in which
* the chart will create its own movie clips.
* @param width Width of chart
* @param height Height of chart
* @param x x Position of chart
* @param y y Position of chart
* @param debugMode Boolean value indicating whether the chart
* is in debug mode.
* @param lang 2 Letter ISO code for the language of application
* messages. Depends on what data you've fed.
* @param scaleMode Scale mode of the movie - noScale or exactFit
*/
var myFirstChart:Column2DChart = new Column2DChart(chartContainerMC, 1, 450, 325, 20, 15, false, "EN", "noScale");
//Convey the XML data to chart.
myFirstChart.setXMLData(xmlData);
//Draw the chart
myFirstChart.render();
//Stop
stop();
Lo que nesesito es poder leer un XML externo
Código PHP:
datos_bd=new XML();
datos_bd.onLoad=function(exito){
if (exito){
var strXML:String = "<chart showBorder='0' bgAlpha='0,0' palette='1' caption='Hourly Working Rate' numberPrefix='$'>";
strXML = strXML <set name=.firstChild.childNodes value= .firstChild.nodeValue />;
strXML = strXML <set name=.firstChild.childNodes value= .firstChild.nodeValue />;
strXML = strXML <set name=.firstChild.childNodes value= .firstChild.nodeValue />;
strXML = strXML <set name=.firstChild.childNodes value= .firstChild.nodeValue />;
strXML = strXML </chart>;
}
else {
trace("Error al cargar los datos");
}
}
datos_bd.load("Data2005.xml");
si se encuentra el archivo para leer Data2005,xml
que cuenta cuantos registros se encuentran y que estos registros esten en este formato.
Código PHP:
var strXML:String = "<chart showBorder='0' bgAlpha='0,0' palette='1' caption='Hourly Working Rate' numberPrefix='$'>";
//Add simple data for demo.
strXML = strXML + "<set name='John' value='32' />";
strXML = strXML + "<set name='Mary' value='65' />";
strXML = strXML + "<set name='Michelle' value='29' />";
strXML = strXML + "<set name='Cary' value='43' />";
strXML = strXML + "</chart>";
quien me lo modifica puedo cambiar tu ayuda por un dominio.com
el que tu quieras
[email protected]