Wednesday, January 28, 2009

XML Schema for Charting - a first implementation

<?xml version="1.0"?>

<xs:schema xmlns:xs="">
<xs:element name="LineChart" type="line_chart"/>

<xs:complexType name="line_chart">
<xs:element name="LineChartInfo" type="chart_info" />
<xs:element name="Points" type="points_" />

<xs:complexType name="chart_info">
<xs:element name="ChartHead" type="xs:string"/>
<xs:element name="width" type="chart_measure"/>
<xs:element name="height" type="chart_measure"/>
<xs:element name="xSpace" type="xs:integer"/>

<xs:complexType name="points_">
<xs:element name="Point" type="point_" minOccurs="2" maxOccurs="unbounded"/>

<xs:complexType name="point_">
<xs:element name="Label" type="xs:string"/>
<xs:element name="Action" type="xs:string"/> <!-- ENUM -->
<xs:element name="x" type="xs:integer"/>
<xs:element name="y" type="xs:decimal"/>

<xs:simpleType name="chart_measure">
<xs:restriction base="xs:integer">
<xs:minInclusive value="100"/>

This is just a start, my idea is to first provide information about the chart (a line chart in this test), that should be useful to the xml stylesheet transformation (for example: width and height to set in the svg, head to titled the chart, xspace tell us how much pixel separate every x point).
Then every Point element set x, y for each point and its label.
Soon a new version and the xsl to test it =). And then of course more extensive explanation on this and the older post.
So.. stay tune again !