Chart2/ChartDateAxis

From Apache OpenOffice Wiki
< Chart2
Revision as of 16:52, 6 June 2011 by Iha (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Summary

Allow date axis with typical date intervals (days, months, years) for charts. This proposal is a change request to an existing proposal.

Rationale

Use cases

Data is often collected and displayed over time. When displaying a date axis the user expects to be able to set the tick marks on typical date intervals for example each month or each year. This proposal allows for those missing date axis with typical date intervals.

Alternatives considered

The already existing proposal does allow date axis only for category axis. That is an unnecessary restriction. From a users perspective it is desirable that the x axis in a scatter chart or the y value axis can also be a date axis. Further the former proposal does not allow the user to specify major and minor date intervals.

Proposed changes to the ODF Standard

Text changes/additions

Add a new section 11.x <chart:date-scale>:

 11.x <chart:date-scale>
 
 The <chart:date-scale> element specifies the scaling for a date axis.
 
 The <chart:date-scale> element is usable with the following element: <chart:axis> 11.8.
 
 The <chart:date-scale> element has the following attributes: chart:base-time-unit 19.x1, chart:major-interval-value 19.x2,
 chart:major-interval-unit 19.x3, chart:minor-interval-value 19.x4 and chart:minor-interval-unit 19.x5.

Add a new section 19.x1 chart:base-time-unit:

 19.x1 chart:base-time-unit
 
 The chart:base-time-unit attribute specifies the smallest time unit that is represented on a date axis.

Add a new section 19.x2 chart:major-interval-value:

 19.x2 chart:major-interval-value
 
 The chart:major-interval-value attribute together with the chart:major-interval-unit attribute specifies the size
 of the major interval on a date axis.

Add a new section 19.x3 chart:major-interval-unit:

 19.x3 chart:major-interval-unit
 
 The chart:major-interval-unit attribute together with the chart:major-interval-value attribute specifies the size
 of the major interval on a date axis.

Add a new section 19.x4 chart:minor-interval-value:

 19.x4 chart:minor-interval-value
 
 The chart:minor-interval-value attribute together with the chart:minor-interval-unit attribute specifies the size
 of the minor interval on a date axis.

Add a new section 19.x5 chart:minor-interval-unit:

 19.x5 chart:minor-interval-unit
 
 The chart:minor-interval-unit attribute together with the chart:minor-interval-value attribute specifies the size
 of the minor interval on a date axis.

Add a new section 19.x6 chart:axis-type:

 19.x6 chart:axis-type
 
 The chart:axis-type attribute specifies the type of an axis.
 * auto: The axis is a date axis if a sub element <chart:date-scale> is specified and the displayed data is of
   type date or date-time. Otherwise the type of the axis depends on its dimension and on the type of the chart
  (see chart:class 19.15.1).
 * date: The axis displays dates on a time scale. Major and minor intervals are chosen as specified by
   sub element <chart:date-scale>.
 * text: The axis displays texts at even intervals. The positions are given by indexes starting with 1.

Adapt the description for the different chart:class values in section 19.15.1: Add a new subsection 19.15.1.1 :

 19.15.1.1 x-coordinate determination for category charts
 Dependent on the type of the x-axis the x coordinates are determined differently:
 * chart:axis-type equals 'text':
 In case of a text axis the x-coordinates for a series are generated from the positions in the y-value sequence starting with 1.0.
 The first y value gets an x value 1.0. The second y value is associated with an x value of 2.0 and so forth.
 The <chart:categories> element can be used to define labels for the x-axis.   
 * chart:axis-type equals 'date':
 In case of a date axis the values given with attribute table:cell-range-address at element <chart:categories> are interpreted
 as dates and used as x-coordinates.
 * chart:axis-type equals 'auto':
 In case the x axis has a sub element <chart:date-scale> and a sub element <chart:categories> and the values given with attribute   
 table:cell-range-address at element <chart:categories> are of type date or date-time, the type to be used for the axis is 'date'.
 Otherwise it is 'text'.

For chart:class values chart:area, chart:bar, chart:gantt, chart:line and chart:stock replace this subsection:

 The accessory x-coordinates are generated from the positions in the y-value sequence starting with 1.0.
 The first y value gets an x value 1.0. The second y value is associated with an x value of 2.0 and so forth.
 The <chart:categories> element can be used to define labels for the x-axis.   

with new text:

 The accessory x-coordinates are determined as specified in section 19.15.1.1.

replace 19.595.2 table:cell-range-address for <chart:categories> with:

 19.595.2 table:cell-range-address for <chart:categories>
 The table:cell-range-address attribute specifies a list of ranges of cells.
 In case of a text axis the contained texts are used as category labels on the axis.
 In case of a date axis the contained values are used as dates if the chart type allows (see chart:class 19.15.1 and 19.15.1.1).

replace 11.9 <chart:categories> with:

 <chart:categories>
 The <chart:categories> element represents labels that are displayed on a category-axis.
 In case of a date axis it represents the date values to be used as coordinates (see chart:class 19.15.1 and 19.15.1.1).

Schema changes/additions

Add the new optional element <chart:date-scale> to <chart:axis> element:

  <define name="chart-axis">
    <element name="chart:axis">
        <ref name="chart-axis-attlist"/>
        <optional>
            <ref name="chart-title"/>
        </optional>
        <optional>
            <ref name="chart-date-scale"/>
        </optional>
        <optional>
            <ref name="chart-categories"/>
        </optional>
        <zeroOrMore>
            <ref name="chart-grid"/>
        </zeroOrMore>
    </element>
  </define>

Add the defines for the new element <chart:date-scale> and all its attributes:

  <define name="chart-date-scale">
    <element name="chart:date-scale">
        <ref name="chart-date-scale-attlist"/>
    </element>
  </define>
  <define name="chart-date-scale-attlist">
    <interleave>
        <optional>
            <attribute name="chart:base-time-unit">
                <ref name="chart-time-unit"/>
            </attribute>
        </optional>
        <optional>
            <group>
                <attribute name="chart:major-interval-value">
                    <ref name="positiveInteger"/>
                </attribute>
                <attribute name="chart:major-interval-unit">
                    <ref name="chart-time-unit"/>
                </attribute>
            </group>
        </optional>
        <optional>
            <group>
                <attribute name="chart:minor-interval-value">
                    <ref name="positiveInteger"/>
                </attribute>
                <attribute name="chart:minor-interval-unit">
                    <ref name="chart-time-unit"/>
                </attribute>
            </group>
        </optional>
    </interleave>
  </define>
  <define name="chart-time-unit">
    <choice>
        <value>days</value>
        <value>months</value>
        <value>years</value>
    </choice>
  </define>

Add a new attribute chart:axis-type to the <chart:axis> element:

  <define name="chart-axis-attlist">
    <interleave>
        <attribute name="chart:dimension">
            <ref name="chart-dimension"/>
        </attribute>
        <optional>
            <attribute name="chart:axis-type">
                <ref name="chart-axis-type"/>
            </attribute>
        </optional>
        <optional>
            <attribute name="chart:name">
                <ref name="string"/>
            </attribute>
        </optional>
        <optional>
            <attribute name="chart:style-name">
                <ref name="styleNameRef"/>
            </attribute>
        </optional>
    </interleave>
  </define>
  <define name="chart-axis-type">
    <choice>
        <value>auto</value>
        <value>text</value>
        <value>date</value>
    </choice>
  </define>

Impacts

Conformance

No impact.

Backwards compatibility

No impact.

Accessibility impact

No impact.

Personal tools