Davisor Chart makes extensive use of the Extensible Markup Language (XML). XML is an industry standard text format to represent information in a clear, structural way. Davisor utilizes this framework to define a Davisor Chart XML format that serves the following purposes:
All these aspects can be defined and invoked through corresponding Java API methods, too, but in typical use cases, Davisor Chart XML is the most convenient and preferable method to feed data and attributes to Davisor Chart.
The first major Davisor Chart XML format function is to declare
what kind of graph Davisor Chart should generate from given input
data, what would the visual details of that graph be, and into what
kind of format the resulting graph should be packed in. These
definitions are Davisor Chart
Attributes, and in the Davisor Chart XML format, they all are
collected under the <attributes/> XML
tag.
The most important Davisor Chart attribute is chartType that controls what
kind of visualization Davisor Chart should generate. For information
and examples of what kind of chart types Davisor Chart supports,
please see the separate Chart
Types chapter in this guide.
The chartType attribute is one of the few top-level
<attributes/> tag attributes. The rest of the Chart
Attributes are grouped by their principal function into a number of
other XML tags:
The second major Davisor Chart XML format function is to declare
what kind of data the graphs should visualize, and from where this
data can be acquired from. These declarations define Davisor Chart Data, and in the
Davisor Chart XML format, they all are collected under the <data/> XML tag.
The top-level <data/> tag may then contain any
number of data sources, each of which defines one or more
data series. The set of data series defined collectively by all
the data sources forms the input data a Davisor Chart then
visualizes.
The principal XML data sources are listed below. For more information about Davisor Chart data sources, please see the separate Data Sources chapter in this guide.
The following example shows the entire content of a typical Davisor Chart XML file.
<chart>
<data>
<column dataType="TEXT" id="month_column" type="label">
<e>March</e>
<e>April</e>
<e>May</e>
<e>June</e>
</column>
<column dataType="INT" id="sales_data" type="value">
<e>12000</e>
<e>19000</e>
<e>15000</e>
<e>30000</e>
</column>
</data>
<attributes chartType="column">
<image height="200" width="300"/>
<axes font="Arial-14-plain"/>
</attributes>
</chart>
The first thing to note is that the whole thing is wrapped inside a
<chart/> tag that is the
root tag for all Davisor Chart XML files. Inside the
<chart/> tag, the <data/> tag defines then
chart input data, and the <attributes/> tag defines
chart visual attributes.
Inside the <data/> tag, the two <column/> tags define two
inline XML data sources, each defining one data series. Inside these
<column/> tags, the data values forming these
series are then defined one by one with <e/> tags (as an
element), in the order the <e/> elements appear in
XML.
The attributes of the <column/> tags define
important facts about the data series. The meaning of the attributes
of the first <column/> tag are:
TEXT is one of the specific data value type
Davisor Chart recognizes and can act upon.month_column. This value has no specific fixed meaning,
and any other string value unique within this set of data series would
also do.label is one of the reserved series type keywords
that has special meaning for all Davisor Chart chart types.The meaning of the attributes of the second
<column/> tag are:
INT
is another specific data value types Davisor Chart recognizes and can
act upon.sales_data. Again, any other string value unique within
this set of data series would also do.value is perhaps the most common series type, and
it is always recognized by all Davisor Chart charts.The content of <attributes/> tag
determines the visual appearance and style of the image. In
particular, the chartType="column"
attribute declares that the data should be visualized as a column
chart.
The attributes width and height in the <image/> tag determine
the resulting image width and height in pixels,
respectively. Furthermore, since no image contentType is explicitly set,
the resulting image will be of the default Portable Network Graphics
(PNG) format.
Finally, the font attribute in the <axes/> tag defines that
all texts laid along chart axes should be drawn with 14 pixel high
Arial font.
Since no explicit fill paint information was given, Davisor Chart
will use colors from the default color palette to fill in
the columns of this column chart. Furthermore, since there was just
one data series, each column (data point) will be assigned a different
color. Should there have been two or more series, each series would
have been filled with different color, with all the columns belonging
to the same series sharing the same series color.
The image below shows the final result of the definitions given by the example XML file. By pressing the buttons below, you may now re-examine the example XML in more detail, or load the example case into Davisor Designer for further inspection.
|
| Chart created from example XML. |