G
gregg100
I have the following html page, in which I need to display category labels in
the format hh:mm.
In order to do so, I currently need to add an extra character to at least
one of the category values to get it to work, such as an exclamation point,
or a tic.
for example: categories(0) = "!11:22"
The chart below currently does display.
I would like not to have to add the extra character.
If I remove the extra character, then the chart does not display.
Is there a way to display text in the format "hh:mm" for a category label?
<HTML>
<object id=ChartSpace1 classid=CLSID:0002E55D-0000-0000-C000-000000000046
style="width:100%;height:350"></object>
<script language=vbs>
Sub Window_OnLoad()
Dim categories(3)
Dim values(3)
Dim chConstants
' Create an array of strings representing the categories.
' The first category has a leading tic mark - without a character
' of some sort in one of the category values, the chart will not display
' The chart object cannot handle a string in the format xx:yy
categories(0) = "!11:22"
categories(1) = "11:33"
categories(2) = "11:44"
categories(3) = "11:45"
' Clear the contents of the chart workspace. This removes
' any old charts that may already exist and leaves the chart workspace
' completely empty. One chart object is then added.
ChartSpace1.Clear
ChartSpace1.Charts.Add
Set chConstants = ChartSpace1.Constants
ChartSpace1.Charts(0).Type = chConstants.chChartTypeSmoothLine
' Add one series to the chart.
ChartSpace1.Charts(0).SeriesCollection.Add
' Series one contains sales growth data for 1998.
' Set the series caption (the text that appears in the legend).
ChartSpace1.Charts(0).SeriesCollection(0).Caption = "10-Jun-1998"
' Set the categories for the first series (this collection is zero-based)
ChartSpace1.Charts(0).SeriesCollection(0).SetData
chConstants.chDimCategories, chConstants.chDataLiteral, categories
values(0) = 0.2
values(1) = 0.06
values(2) = 0.17
values(3) = 0.13
ChartSpace1.Charts(0).SeriesCollection(0).SetData
chConstants.chDimValues, chConstants.chDataLiteral, values
' Make the chart legend visible, format the left value axis as percentage,
' and specify that value gridlines are at 10% intervals.
ChartSpace1.Charts(0).HasLegend = True
ChartSpace1.Charts(0).Axes(chConstants.chAxisPositionLeft).NumberFormat
= "0%"
ChartSpace1.Charts(0).Axes(chConstants.chAxisPositionLeft).MajorUnit = 0.1
End Sub
</script>
</HTML>
the format hh:mm.
In order to do so, I currently need to add an extra character to at least
one of the category values to get it to work, such as an exclamation point,
or a tic.
for example: categories(0) = "!11:22"
The chart below currently does display.
I would like not to have to add the extra character.
If I remove the extra character, then the chart does not display.
Is there a way to display text in the format "hh:mm" for a category label?
<HTML>
<object id=ChartSpace1 classid=CLSID:0002E55D-0000-0000-C000-000000000046
style="width:100%;height:350"></object>
<script language=vbs>
Sub Window_OnLoad()
Dim categories(3)
Dim values(3)
Dim chConstants
' Create an array of strings representing the categories.
' The first category has a leading tic mark - without a character
' of some sort in one of the category values, the chart will not display
' The chart object cannot handle a string in the format xx:yy
categories(0) = "!11:22"
categories(1) = "11:33"
categories(2) = "11:44"
categories(3) = "11:45"
' Clear the contents of the chart workspace. This removes
' any old charts that may already exist and leaves the chart workspace
' completely empty. One chart object is then added.
ChartSpace1.Clear
ChartSpace1.Charts.Add
Set chConstants = ChartSpace1.Constants
ChartSpace1.Charts(0).Type = chConstants.chChartTypeSmoothLine
' Add one series to the chart.
ChartSpace1.Charts(0).SeriesCollection.Add
' Series one contains sales growth data for 1998.
' Set the series caption (the text that appears in the legend).
ChartSpace1.Charts(0).SeriesCollection(0).Caption = "10-Jun-1998"
' Set the categories for the first series (this collection is zero-based)
ChartSpace1.Charts(0).SeriesCollection(0).SetData
chConstants.chDimCategories, chConstants.chDataLiteral, categories
values(0) = 0.2
values(1) = 0.06
values(2) = 0.17
values(3) = 0.13
ChartSpace1.Charts(0).SeriesCollection(0).SetData
chConstants.chDimValues, chConstants.chDataLiteral, values
' Make the chart legend visible, format the left value axis as percentage,
' and specify that value gridlines are at 10% intervals.
ChartSpace1.Charts(0).HasLegend = True
ChartSpace1.Charts(0).Axes(chConstants.chAxisPositionLeft).NumberFormat
= "0%"
ChartSpace1.Charts(0).Axes(chConstants.chAxisPositionLeft).MajorUnit = 0.1
End Sub
</script>
</HTML>