Microsoft KB Archive/286319

= PRB: Office Chart Component May Not Automatically Apply a Timescale =

Article ID: 286319

Article Last Modified on 2/22/2007

-

APPLIES TO


 * Microsoft Office Web Components
 * Microsoft Office Web Components

-



This article was previously published under Q286319



SYMPTOMS
The Office Chart component does not automatically apply a timescale to your category axis when the category values contain dates.



CAUSE
Before the Office Chart component automatically applies a timescale to a category axis, it examines the values on the category axis to determine if they are dates. The Chart component examines only a subset of the category data; in general, if the first, middle and last category values represent dates, a timescale is applied.

Also, note that the timescale feature is supported only with Column, Bar, Line, Area and Stock charts. Other chart types do not support a timescale for categories.



RESOLUTION
There is no way to force a timescale for category values. If you are using one of the chart types that support a timescale but the timescale is not applied because of non-date category data, use one of the following workarounds:
 * Apply a different sort order to the category data.
 * Use a filter for the category data so that the non-date values are removed before you plot your chart.



STATUS
This behavior is by design.



Steps to Reproduce Behavior
  In any text editor, create a new HTML file named Timescale.htm, and paste the following code:   Dim c, oChart, oSeries CSpace.Clear Set oChart = CSpace.Charts.Add Set oSeries = oChart.SeriesCollection.Add Set c = CSpace.Constants oSeries.SetData c.chDimCategories, c.chDataLiteral, _ Array(&quot; &quot;, &quot;Jan-3&quot;, &quot;Jan-6&quot;, &quot;Jan-7&quot;, &quot; &quot;, &quot;Jan-12&quot;, &quot;Jan-13&quot;) oSeries.SetData c.chDimValues, c.chDataLiteral, _ Array(100, 200, 150, 200, 350, 450, 200)

NOTE: In the preceeding code, please change the classid according to the version of Office installed on your computer.  Start Internet Explorer, and browse to Timescale.htm. When the Web page is rendered, a column chart appears with no timescale.

Workaround
  In the sample code, change the following line: oSeries.SetData c.chDimCategories, c.chDataLiteral, _ Array(&quot; &quot;, &quot;Jan-3&quot;, &quot;Jan-6&quot;, &quot;Jan-7&quot;, &quot; &quot;, &quot;Jan-12&quot;, &quot;Jan-13&quot;) to: oSeries.SetData c.chDimCategories, c.chDataLiteral, _ Array(&quot;Jan-1&quot;, &quot;Jan-3&quot;, &quot;Jan-6&quot;, &quot;Jan-7 &quot;, &quot; &quot;, &quot;Jan-12 &quot;, &quot;Jan-13 &quot;) </li> In the browser, refresh the Web page. Notice that the column chart now has a timescale.</li></ol>

<div class="references_section">