2.4. Different types of X axis.

Different graphs can be specified by changing the attribute value of the xAxisType attribute on the xygr element. Possible values are: auto (the default), withZero, shifted, log or dateTime, the latter being a little special. Taking each of these values in turn

auto leaves it to the stylesheet to determine the extent and start values.

withZero ensures that the axis contains the zero value.

shifted enables a sensible first value. E.g. if your X values range from 320 to 1000, then 300 would be a sensible 'zero' value, i.e. offset or shifted by 300.

dateTime. This is one I waited for. I wanted to plot integer values against dates, ranging from December 2009 to Feb 2010. This is implemented using a subset of XSLT 2.0 dateTime formatting strings. this table identifies the specifiers. The subset used here includes only the set [YMDHms].

The value of the dateTime attribute has to be full date time in the format shown (in the example). However if we are not not interested in all the parts of the date-time we can tell the stylesheet to display only part of it in the format string attached to the dateTime value of the xAxisType attribute.

So, with an entry in the source XML such as

<point x="2010-01-22T00:00:00" y="15"/>

which shows only the date (the hours, minutes and seconds are required, but not required) then the format specifier would be

<xygr xmlns="http://graph2svg.googlecode.com"
		pointType="circle" colorScheme="cold"
		axesPos="left-bottom"
	
  xAxisType="dateTime~[Y01]-[M]-[D]."

Note the tilda (~) between the dateTime identifier and the format specifier. This then results in the X axis being marked with a two digit year, a two digit month and a two digit date (the latter two being default values)

In this way, quite complex dates can be used with a graph. A simple example is shown below

Example 17. A dateTime example

<xygr xmlns="http://graph2svg.googlecode.com"
		pointType="circle" colorScheme="cold"
		axesPos="left-bottom"
  xAxisType="dateTime~[Y01]-[M]-[D]."> 

	<title>Test 15, dateTime</title>

	<curve>
		<point x="2010-01-22T00:00:00" y="15"/>
		<point x="2010-01-23T00:00:00" y="12"/>
		<point x="2010-01-24T00:00:00" y="10"/>
		<point x="2010-01-27T00:00:00" y="13"/>
		<point x="2010-01-29T00:00:00" y="14"/>
	</curve>

</xygr>  

This produces a graphic with the dates shown as 10-1-21 etc