Introduction to the PCXML Format

The current version of PCXML document type is 4.0.5 (to maintain consistency with PopChart Server).

Resources

Besides this chapter, you may also wish to examine Chapter 7, "PopChart XML," in the PopChart Server Reference manual. Currently, this chapter has a complete list of all PCXML elements and attributes. In the future, it may contain descriptions of these elements and attributes, as well.

Probably your best resource for PopChart XML is PopChart Builder. PopChart Builder is a graphical user interface for creating appearance files. Since it saves appearance files in the PCXML format, you can learn a lot about how things are done in PCXML by creating appearance files with PopChart Builder and viewing the PCXML it creates.PopChart Builder can also validate your PopChart XML documents. Simply open your PopChart XML document in PopChart Builder, and PopChart Builder will tell you if there are any errors in the document.

Note: Not everything you can do with an appearance file will be apparent through PopChart Builder—for interactive features, you will have to view the file with PopChart Server to see the effect.

We are currently in the process of completing it's formal document type definition (DTD). Pay attention to the Corda Technologies website over the next few months for more information.

Compatibility Between Versions

Many elements and attributes have been added or renamed since the 4.0 version of PCXML. To maintain backwards compatibility, PopChart Builder saves appearance files in the PCXML 4.0 format by default. Unless you change this behavior, you will be unable to take advantage of many of the latest PCXML features.

You can change the PCXML format that PopChart Builder uses to save its appearance files by selecting Edit > Preferences > Save and checking the Save Using Latest PCXML Format box. However, be aware that you cannot use appearance files saved in the latest PCXML format with previous versions of PopChart Server. The current version of PopChart Server supports previous versions of PCXML.

If you are manually creating your PCXML documents, be sure to specify the version of PCXML you are using by setting the Version attribute of the Chart tag. This ensures that PopChart Server will properly parse your PCXML.

Main Elements

The top level element in a PCXML document is <Chart>. One important attribute of <Chart> is Version. Be sure to include this attribute so that if future versions of PCXML differ significantly from the current version, PopChart Server will know how to act when it sees your file. The current version is 4.0.5.

The main subelements of <Chart> are <Graph>, <GraphData>, <Textbox>, <Legend>, and <Image>. All of these subelements contain a Name attribute, which is essential, since this element helps PopChart Server identify what element it should apply dynamic data or formatting options to. Other important universal attributes include Top, Left, Anchor, Height, and Width, which control the size and position of the element, and Visible, which hides or shows the element (these attributes are not in <GraphData>).

The <Graph> element represents a graph. A graph's type is specified by its Type and Subtype attributes. There are many attributes and subelements for <Graph>, and they cannot all be listed in this section. You'll probably want to experiment with the element in PopChart Builder to learn more.

The same applies for <Textbox>, <Legend>, and <Image> (the objects that these elements represent should be fairly obvious).

The <GraphData> element is used to store data. It will be associated with the <Graph> element of the same name. In other words, <GraphData Name="graph"> is associated with <Graph Name="graph">.

Because appearance files in PopChart Builder contain sample data, the <GraphData> will also appear in appearance files. However, it is not necessary. Its main function is to store dynamic data that will be sent to PopChart Server. For more information about the <GraphData> tag, refer to "Sending Data with PopChart XML" in Chapter 6.

Example Document

Example 10.1 shows a typical PopChart XML file.

Example 10.1 Typical PopChart XML Document

<?xml version='1.0' encoding='ISO-8859-1' ?> 

 

<Chart Version='4.0' BGColor='#4a6b80'> 

 

   <Graph Name='graph' Top='37' Left='32' Width='475' Height='235' Type='Line' SubType='Basic'> 

      <GridColors BackColorTransparent='False' BottomColorTransparent='False' BottomColor='#85a9df' SideColorTransparent='False' SideColor='#85aadf'/> 

      <ColorPalette Color1='#9f2727' Color2='#4249a9' Color3='#757a75' Color4='#00750e' Color5='#b750fc' Color6='#ccda52' Color7='#e06557' Color8='#57df64' Color9='#53d1e1' Color10='#d8a455' Color11='#cdb4ca' Color12='#996433' Color13='#0fa187' Color14='#dbeabc' Color15='#8b7caa' Color16='#85b705'/> 

      <ValueScale Position='Left' Font='Color:White;' MinorFont='Size:10;'/> 

      <CategoryScale Font='Name:Lucida Bright; Style:Bold; Color:White;'/> 

      <Legend Name='legend_graph' Top='280' Left='90' Width='363' Height='45'> 

         <Properties UseTransparentFill='No'/> 

      </Legend> 

   </Graph> 

 

   <GraphData Name='graph' Method='Replace'> 

      <Categories> 

         <Category Name='Group 1'/> 

         <Category Name='Group 2'/> 

         <Category Name='Group 3'/> 

         <Category Name='Group 4'/> 

         <Category Name='Group 5'/> 

      </Categories> 

      <Series Name='Item 1'> 

         <Data Value='54.0'/> 

         <Data Value='75.0'/> 

         <Data Value='85.0'/> 

         <Data Value='66.0'/> 

         <Data Value='91.0'/> 

      </Series> 

      <Series Name='Item 2'> 

         <Data Value='92.0'/> 

         <Data Value='60.0'/> 

         <Data Value='70.0'/> 

         <Data Value='47.0'/> 

         <Data Value='58.0'/> 

      </Series> 

      <Series Name='Item 3'> 

         <Data Value='68.0'/> 

         <Data Value='87.0'/> 

         <Data Value='37.0'/> 

         <Data Value='77.0'/> 

         <Data Value='42.0'/> 

      </Series> 

   </GraphData> 

 

   <Textbox Name='textbox' Top='7' Left='92'> 

      <Text>Sample Text</Text> 

   </Textbox> 

 

</Chart>

Note: It is necessary to place the <?xml version='1.0' encoding='ISO-8859-1' ?> tag at the top of your PopChart appearance files. This identifies the document as being in XML For other PopChart XML documents, this tag is not required. However, we strongly recommend using it in all XML documents.