XML data structure

Top  Previous  Next  

Flash Charts Pro® uses XML (eXtensible Markup Language) to create and manipulate charts. XML is a simple and structured language, that is easy to read and understand. In case you're not aware of XML so far, here are a few basic things to know about an XML document:

 

  • An XML document is a simple text file consisting of tags and data associated with them.
  • You can make up your own tags like <mytag></mytag> to store data.
  • Every opening tag requires a matching closing tag like <name> requires </name>. e.g., <name>John Doe</name>. If an element has no content, the opening and closing tags may be combined into a single "shortcut" tag such as <name/>.
  • XML tags are case-sensitive. So <name> should be closed with </name> and not </Name> or </NAME> or any other variant of the same.
  • You can define attributes for a tag to render more details. e.g., <name isPetName='true'>John Doe</name>. Here isPetName is an attribute of the name element. In Flash Charts Pro®, we've four types of attributes:
    • Boolean - attribute which can take a 0 or 1 value. Like <grid showX='0' >
    • Number - attribute which take a numeric value. Like <header size='18' >
    • String - attribute which take a string value. Like <header text='My Chart' >
    • Hex color code - attribute that take a hex color code (without #). Like <header color='FFFFDD' >
  • Special characters like ' (quote), " (double quote), % (percentage) etc. are to be replaced by the XML converts. Like, the character " (double quote) in a string constant must be denoted as &quot;.

 

So every chart is controlled by its XML file. Besides tags every XML file contain header in which you can set its encoding. If you use encoding other than Latin-1/ASCII (ISO-8859-1) you can set appropriate using <?xml encoding="YOUR_CODEPAGE"?>. For universal encoding you can use Unicode UTF-8 (ISO 10646):

 

<?xml version="1.0" encoding="utf-8"?>

...

 

Note: In this case you don't need to turn BOM (Byte Order Mark) signature saving the file in your editor.

 

Encoding shown above covers most of the cases, but in specific cases you can use extended variation of UTF-16. For more information visit official site.

 

Every chart has a <graph> tag declaration:

 

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

<graph>

...

</graph>

 

The entire Flash Charts Pro® chart is controlled by XML parameters i.e., you use XML to define the cosmetic as well as functional properties for the chart. There are a lot of properties that you can define for each chart type.

 

However, it is not necessary to define all the attributes for a given chart. For example, if you do not want to change the default settings of the canvas (color, alpha etc.), you don't need to define any attributes for the canvas - the default values will be assumed. Thus, each chart can be generated using minimal attributes without concern for every finer details. As you become more proficient in the chart attributes, you can use it to create complex charts with a wide range of features and an informative appearance.

 

All parameters and attributes of chart will be placed between <graph> tags and they differ from chart to chart. Below you will find detailed explanation for every chart type.