Syntax myPopChart.loadData(graphname, datasrc [,method [,HTMLTable]]);
Description Instructs PopChart Server to load data into the specified graph object from one of the following types of data sources: tab delimited data file, comma separated value file, xml database file, or a table in an HTML file.
By default, this command replaces all existing data in the graph. However, if you want to append the data from the file to the existing data, you can set the method attribute to append.
PopChart Server will automatically determine the data format. For more information on loading data and on these data formats, refer to "Importing Data from Data Files" in Chapter 6 of the PopChart Server User Guide.
Important: Your path.xml file must grant PopChart Server permission to read files from the location that you specify. Otherwise, it will be unable to load the data. For more information, see "Setting Path Permissions" in Chapter 3 of the PopChart Server User Guide.
Note: This command provides the same functionality as the LoadFile PCScript command.
Parameters The loadData() method accepts the following parameters.
The name of the graph object into which you want to load the data. If the specified graph object does not exist, the method will be ignored.
The path to and location of the server command file that you want PopChart Server to use. This file is relative to PopChart Server's document root. You can also specify an absolute path or URL.
Make sure that the file is accessible from the machine that PopChart Server runs on. Also make sure that your path.xml file permits PopChart Server to read from this path (see "Setting Path Permissions" in Chapter 3 of the PopChart Server User Guide).
Indicates the method for importing the data. If method is set to replace, all data currently in the graph will be replaced. If it is set to append, the imported data will be appended to any data already in the graph, including data from the appearance file.
If this parameter is not set, it is assumed to be replace. It must always be set when importing data from HTML tables. It must always be set when you use the COM PopChart Embedder.
The title or number of the table that should be loaded from the web page. If this parameter is a title, be sure that the title corresponds to the value of the title attribute of your <table> tag. If it is a number, PopChart Server will import data from the nth table in the web page, where n is the number you specify.
Example 4.11 illustrates how this parameter is used. The first line of code imports data from the table titled pricing on the web page stats.html. The second line of code imports data from the 11th table on the web page morestats.html.
This parameter must always be set when you import data from HTML tables. It also must always be set when you use the COM PopChart Embedder, but you should send an empty string if you are not importing from an HTML Table.
Important: Due to limitations in the Component Object Model, loadData() always requires four arguments in the COM PopChart Embedder, even if you have no need to set the last two parameters. If you don't need to set the last two parameter and you are using the COM PopChart Embedder, set the third argument to "replace" and the fourth argument to an empty string (e.g loadData("graph","prices.csv","replace","");).