Specifying XML Data in Relational Form

The LocalRelationalData element is structured like a relational table. The definition of the element is as follows.


<!ELEMENT LocalRelationalData (Row+, (ColumnKeyCount?, RowKeyCount?))>

The LocalRelationalData element represents a relational table. The definition of a Row element is as follows.


<!ELEMENT Row EMPTY> <!ATTLIST Row columnKey CDATA #REQUIRED rowKey CDATA #REQUIRED dataValue CDATA #REQUIRED >

Each Row element represents a row in the relational table. Each row will be a cell in the local data source grid. The values of the columnKey and the rowKey attributes identify the cell in the grid. These values come from key columns in the relational table.

The dataValue attribute specifies the data value to store in the cell that the other attributes specify. The dataValue comes from a fact column in the relational table. It should be numeric, because graphs display numeric data only.

The optional ColumnKeyCount and RowKeyCount elements specify the number of columns and rows that the grid in the local data source will need. If you include these elements, the ColumnKeyCount should be the number of unique values that you have for the columnKey attribute, and the RowKeyCount should be the number of unique values that you have for the rowKey attribute. The ColumnKeyCount and RowKeyCount elements are structured as follows.


<!ELEMENT ColumnKeyCount (#PCDATA)> <!ELEMENT RowKeyCount (#PCDATA)>

Example: Data in a LocalRelationalData element

The following figure shows a graph that has Quota and Sales data for January and February of 2002. This graph has a time axis, where the time values appear along the horizontal axis of the graph.

xml data

The following table shows a relational table that is the source of the data for this graph. This table has four rows, and each row has three key columns and one fact column. The Product key column is VCR for all rows and will not be included in the XML. The measure key column has two rows for Quota and then two rows for Sales. The Month column alternates between January and February. The last column is the fact column.

VCR 2002-01-01 Quota 8000
VCR 2002-01-01 Sales 7921
VCR 2002-02-01 Quota 6000
VCR 2002-02-01 Sales 6732

The following table shows the grid of data for the graph. The grid has one column for January and one for February. It has one row for Quota and one row for Sales. When the graph reads the LocalRelationalData from the XML, it constructs this grid as the local data source for the graph.

empty cell 2002-01-01 2002-02-01
Quota 8000 6000
Sales 7921 6732

 

The following example shows the LocalRelationalData element for this relational table. This XML includes column key and row key counts.


<LocalRelationalData timeAxis="true" dateFormat="YYYY-MM-DD"> <Row columnKey = "2002-01-01" rowKey = "Quota" dataValue = "8000" /> <Row columnKey = "2002-01-01" rowKey = "Sales" dataValue = "7921" /> <Row columnKey = "2002-02-01" rowKey = "Quota" dataValue = "6000" /> <Row columnKey = "2002-02-01" rowKey = "Sales" dataValue = "6732" /> <!-- The next two lines are optional --> <ColumnKeyCount>2</ColumnKeyCount> <RowKeyCount>2</RowKeyCount> <!-- End of optional lines --> </LocalRelationalData>

Specifying Graph Data Through the setTabularData Method
Handling Problems in Graph Data
Data Requirements for Different Kinds of Graphs