Choosing an Appearance File

One of the most important steps to embedding a PopChart image is to tell PopChart Server what appearance file it should be using. An appearance file is kind of like a template that tells PopChart Server how to format a PopChart image. It already contains data, but most of the time this data is just "filler" data—you will override it later on.

This is a sidebar.

There are a number of example appearance files in the examples/apfiles directory of the document root. For this example, we will use the bar.pcxml example appearance file.

To tell PopChart Server to use this appearance file, set the appearanceFile attribute of the PopChart Embedder, as we have done below:

myPopChart.appearanceFile = "examples/apfiles/bar.pcxml";

Note that the location of the appearance file should be relative to the document root directory. Alternatively, you can use an absolute path or a URL. For example, suppose you wanted to use an appearance file that is generated dynamically by a web application at http://webapps.mycompany.com/graphgenerator?type=bar. You would use the following line of code:

myPopChart.appearanceFile = "http://webapps.mycompany.com/graphgenerator?type=bar";

However, be aware that if your appearance file resides anywhere other than the document root directory, you must give PopChart Server permission to read from that location. For more information, refer to "Setting Path Permissions".

After choosing an appearance file, you should have inserted the following code into your web page:

Example 4.3 Example Code After Choosing an Appearance File

<script language="JavaScript1.2" src="http://localhost:2001/jsEmbedder"></script> 

 

<script language="JavaScript1.2"> 

<!-- // Embedding a PopChart Image 

 

   myPopChart = new PopChartEmbedder(); 

   myPopChart.appearanceFile = "examples/apfiles/bar.pcxml"; 

 

// Finished Embedding --> 

</script>