UK Dates on the X-Axis

B

bLUE

hi. I am entering UK dates into the X-Axis such that:

Dim objDates(2) as object
objDates(0) = "23/04/03"
objDates(1) = "15/09/03"
objDates(2) = "16/12/03"

and setting the data as:

OWC10.ChSeries.SetData(OWC10.ChartDimensionsEnum.chDimCategories, -1,
objDates)

This all works fine, the chart is displaying the points in order BUT
when you hover the points, the display is US date, and the x-axis
markings are in also in US dates..

What can I do to fix this? my locale time settings are set to UK as
well?

Thanks.. any help is much appreciated.
 
T

Thao Moua [ms]

Though the category data are recognized and treated as
date values, Chart does not apply the appropriate date
format right away. You need to run the follow code to
apply the date format.

set c=webchart.constants
webchart.charts(0).axes
(c.chaxispositionbottom).numberformat="short date"

Thao Moua
OWC Webchart Support

This posting is provided "AS IS" with no warranties, and
confers no rights. Use of included script samples are
subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
-----Original Message-----
hi. I am entering UK dates into the X-Axis such that:

Dim objDates(2) as object
objDates(0) = "23/04/03"
objDates(1) = "15/09/03"
objDates(2) = "16/12/03"

and setting the data as:

OWC10.ChSeries.SetData
(OWC10.ChartDimensionsEnum.chDimCategories, -1,
 
B

bLUE

Hi Thao

I added the line of code you suggested:

objChartSpace.Charts(0).Axes(OWC10.ChartAxisPositionEnum.chAxisPositionBottom).NumberFormat
= "short date"

The points of the graph get plotted using UK dates which is correct.
But the date scaling on the x-axis is in american format. So where the
points range from 09/01/03(jan) to 12/12/03.. the scaling on the
x-axis does the american version such that it makes the scale range
from 01/09/03(september) to 12/12/03

any ideas with this ?

Thanks
 
B

bLUE

Hi again

I have pasted my code in. What I am trying to do is... calculate the
interval between the first date and last date in the record set and
scale the x-axis accordingly.

so for example.. if the dates span only 30days.. then you scale the
x-axis by days. If the interval is.. say over 90 days..then scale by
months




Private Sub SetLineChartTimeScale(ByVal objDataTable As
DataTable, ByRef objChartSpace As
AxMicrosoft.Office.Interop.OWC.AxChartSpace)

'objChartSpace.Charts(0).Axes(OWC10.ChartAxisPositionEnum.chAxisPositionBottom).NumberFormat
= "short date"
objChartSpace.Charts(0).Axes(OWC10.ChartAxisPositionEnum.chAxisPositionBottom).NumberFormat
= "[$-F800]dddd, mmmm dd, yyyy"

'--------------------------------------------------------------------------
' Work out the span of the data
'--------------------------------------------------------------------------
Dim dteFirst As DateTime
Dim dteLast As DateTime
clsHistogram.GetDatasetSpanDates(Me.Isbasic, objDataTable,
dteFirst, dteLast)

'--------------------------------------------------------------------------
' Calculate the difference between the two dates
'--------------------------------------------------------------------------
Dim intInterval As Long
intInterval = DateDiff(DateInterval.Day, dteFirst,
dteLast)

'--------------------------------------------------------------------------
' Depending on the Interval scale the axis
'--------------------------------------------------------------------------
Dim objLabelTickUnitType As
Microsoft.Office.Interop.OWC.ChartAxisUnitTypeEnum
Dim objMarkUnitType As
Microsoft.Office.Interop.OWC.ChartAxisUnitTypeEnum

'--------------------------------------------------------------------------
' Set the max/min values
'--------------------------------------------------------------------------
'objChartSpace.Charts(0).Axes(0).Scaling.Maximum =
dteLast.ToLocalTime.ToOADate
'objChartSpace.Charts(0).Axes(0).Scaling.Minimum =
dteFirst.ToLocalTime.ToOADate

If intInterval <= 31 Then

'--------------------------------------------------------------------------
' If the data spans less than a month scale by days
'--------------------------------------------------------------------------
objLabelTickUnitType =
OWC10.ChartAxisUnitTypeEnum.chAxisUnitDay
objMarkUnitType =
OWC10.ChartAxisUnitTypeEnum.chAxisUnitDay

ElseIf intInterval > 31 And intInterval < 210 Then

'--------------------------------------------------------------------------
' If the data spans more than a month and less than
half a year scale by weeks
'--------------------------------------------------------------------------
objLabelTickUnitType =
OWC10.ChartAxisUnitTypeEnum.chAxisUnitWeek
objMarkUnitType =
OWC10.ChartAxisUnitTypeEnum.chAxisUnitWeek


ElseIf intInterval < 750 And intInterval > 180 Then

'--------------------------------------------------------------------------
' If the data spans 2 years allow it be scaled in
months
'--------------------------------------------------------------------------
objLabelTickUnitType =
OWC10.ChartAxisUnitTypeEnum.chAxisUnitMonth
objMarkUnitType =
OWC10.ChartAxisUnitTypeEnum.chAxisUnitMonth

Else

'--------------------------------------------------------------------------
' Anything larger scale by years
'--------------------------------------------------------------------------
objLabelTickUnitType =
OWC10.ChartAxisUnitTypeEnum.chAxisUnitYear
objMarkUnitType =
OWC10.ChartAxisUnitTypeEnum.chAxisUnitYear

End If

If intInterval > 0 Then
'--------------------------------------------------------------------------
' Set the scale of the axis
'--------------------------------------------------------------------------
objChartSpace.Charts(0).Axes(OWC10.ChartAxisPositionEnum.chAxisPositionCategory).TickLabelUnitType
= objLabelTickUnitType
objChartSpace.Charts(0).Axes(OWC10.ChartAxisPositionEnum.chAxisPositionCategory).TickMarkUnitType
= objMarkUnitType

'--------------------------------------------------------------------------
' Set the label ticks to show each singular readings
'--------------------------------------------------------------------------
objChartSpace.Charts(0).Axes(OWC10.ChartAxisPositionEnum.chAxisPositionCategory).GroupingUnitType
= OWC10.ChartAxisUnitTypeEnum.chAxisUnitDay
objChartSpace.Charts(0).Axes(OWC10.ChartAxisPositionEnum.chAxisPositionCategory).GroupingUnit
= 1
End If

End Sub




any help would be apprecaited. THanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top