S
Sputnik
Below is an example (based upon an example). If you save this as an
..htm file and load it into IE (you may need to change the clsid id -
see article http://support.microsoft.com/kb/289288/).
Click on the button and you will see that the dates have been correctly
formatted as specified in the script i.e.mm-dd-yyyy. If you select yes
on the message box that is displayed then the grouping type is set to
chAxisGroupingNone. When this is done the NumberFormat is ignored.
Here is the code:
<html>
<body>
<p align="Left"/>
<button id="btnChart1" style="width:30%">TimeScale With Missing
Dates</button><br/><br/>
<object classid="clsid:0002E551-0000-0000-C000-000000000046"
id="SSheet" width="30%" height="75%">
</object>
<object classid="clsid:0002E556-0000-0000-C000-000000000046"
id="CSpace" width="65%" height="75%">
</object>
</body>
<script language="VBScript">
'
' This example is based upon the example from microsoft
(http://support.microsoft.com/kb/289288/)
'
Dim c
Set c = CSpace.Constants
Function BuildWorksheet1()
'Builds a worksheet with dates in A2:A5 and numeric values
representing
'sales figures in B2:B5.
Dim oSheet
Set oSheet = SSheet.Worksheets(1)
oSheet.Cells.Clear
oSheet.Range("A1:B1").Value = Array("Date", "Sale")
oSheet.Range("A2:B2").Value = Array(#1/1/2001#, 3000)
oSheet.Range("A3:B3").Value = Array(#3/5/2001#, 1850)
oSheet.Range("A4:B4").Value = Array(#3/23/2001#, 2790)
oSheet.Range("A5:B5").Value = Array(#6/7/2001#, 4925)
oSheet.Range("A2:A5").NumberFormat = "mmm d, yyyy"
End Function
Function btnChart1_OnClick()
BuildWorksheet1
'Bind the Chart component to the spreadsheet. Categories are in
A2:A5 and
'values are in B2:B5.
CSpace.Clear
Set CSpace.DataSource = SSheet
CSpace.SetData c.chDimCategories, c.chDataBound, "A2:A5"
CSpace.SetData c.chDimValues, c.chDataBound, "B2:B5"
CSpace.Charts(0).Axes(chAxisPositionCategory).NumberFormat =
"mm-dd-yyyy"
'Prompt to disable timescale functionality.
Dim RetVal
RetVal = MsgBox("Disable time scale functionality?", vbYesNo)
If RetVal = vbYes Then
'We want a continuous timescale axes so set the grouping to
none
CSpace.Charts(0).Axes(chAxisPositionCategory).GroupingType =
c.chAxisGroupingNone
CSpace.Charts(0).Axes(chAxisPositionCategory).NumberFormat =
"mm-dd-yyyy"
End If
End Function
</script>
</html>
As you can see setting the grouping to none effectively ignores the
formatting. Any ideas?
Thanks
Ian
..htm file and load it into IE (you may need to change the clsid id -
see article http://support.microsoft.com/kb/289288/).
Click on the button and you will see that the dates have been correctly
formatted as specified in the script i.e.mm-dd-yyyy. If you select yes
on the message box that is displayed then the grouping type is set to
chAxisGroupingNone. When this is done the NumberFormat is ignored.
Here is the code:
<html>
<body>
<p align="Left"/>
<button id="btnChart1" style="width:30%">TimeScale With Missing
Dates</button><br/><br/>
<object classid="clsid:0002E551-0000-0000-C000-000000000046"
id="SSheet" width="30%" height="75%">
</object>
<object classid="clsid:0002E556-0000-0000-C000-000000000046"
id="CSpace" width="65%" height="75%">
</object>
</body>
<script language="VBScript">
'
' This example is based upon the example from microsoft
(http://support.microsoft.com/kb/289288/)
'
Dim c
Set c = CSpace.Constants
Function BuildWorksheet1()
'Builds a worksheet with dates in A2:A5 and numeric values
representing
'sales figures in B2:B5.
Dim oSheet
Set oSheet = SSheet.Worksheets(1)
oSheet.Cells.Clear
oSheet.Range("A1:B1").Value = Array("Date", "Sale")
oSheet.Range("A2:B2").Value = Array(#1/1/2001#, 3000)
oSheet.Range("A3:B3").Value = Array(#3/5/2001#, 1850)
oSheet.Range("A4:B4").Value = Array(#3/23/2001#, 2790)
oSheet.Range("A5:B5").Value = Array(#6/7/2001#, 4925)
oSheet.Range("A2:A5").NumberFormat = "mmm d, yyyy"
End Function
Function btnChart1_OnClick()
BuildWorksheet1
'Bind the Chart component to the spreadsheet. Categories are in
A2:A5 and
'values are in B2:B5.
CSpace.Clear
Set CSpace.DataSource = SSheet
CSpace.SetData c.chDimCategories, c.chDataBound, "A2:A5"
CSpace.SetData c.chDimValues, c.chDataBound, "B2:B5"
CSpace.Charts(0).Axes(chAxisPositionCategory).NumberFormat =
"mm-dd-yyyy"
'Prompt to disable timescale functionality.
Dim RetVal
RetVal = MsgBox("Disable time scale functionality?", vbYesNo)
If RetVal = vbYes Then
'We want a continuous timescale axes so set the grouping to
none
CSpace.Charts(0).Axes(chAxisPositionCategory).GroupingType =
c.chAxisGroupingNone
CSpace.Charts(0).Axes(chAxisPositionCategory).NumberFormat =
"mm-dd-yyyy"
End If
End Function
</script>
</html>
As you can see setting the grouping to none effectively ignores the
formatting. Any ideas?
Thanks
Ian