Jan 9th, 2001, 12:58 PM
I'm having trouble manipulating MSChart X Axis Labels. First, I would like to have the labels immediately below the tick mark, and thus the graph would draw from that gridline. Secondly, I would like my X axis labels to read down vertically. I have tried:
For i = 1 To MSChartLine.Plot.Axis(1).Labels.count
MSChart1.plot.Axis(VtChAxisIdX, 1).Labels.Item(i).TextLayout.Orientation = VtOrientationDown
But to no avail, the labels.count reflects only one (1) label, yet I have about 41, and they show up!
Any help on either problem will be greatly appreciated!
Jan 11th, 2001, 01:28 AM
If the MSChart width is small then the X label will change to vertical by itself.
Don't use LabelCount but use RowCount
Hope this helps
PS: if it does not email me I send u sample code
Mar 27th, 2012, 01:28 PM
Re: MSChart X Axis Labels
I would like to receive sample code of an MSChart line graph with code for the x-axis labels. I use the following code, but instead of the correct labels I gete blsck bar under the x-axis and the default R- labels are kept and partly overwritten by the black bar.
What is wrong with my code? My email address is firstname.lastname@example.org. Thanks in advance.
Here is my code:
Private Sub Command5_Click()
Dim Koersen() As Variant, i As Integer
ReDim Koersen(0 To NumRegels(1) + 1, 0 To 1) As Variant
'Set column labels.
Koersen(0, 1) = "Open"
' Set data.
For i = 1 To UBound(Koersen, 1)
If Left(Datum(i, 1), 4) <> Left(Datum(i - 1, 1), 4) Then
Koersen(i, 0) = " " & RTrim(CStr(Left(Datum(i, 1), 4)))
ElseIf Left(Right(Datum(i, 1), 4), 2) <> Left(Right(Datum(i - 1, 1), 4), 2) Then
Koersen(i, 0) = " " & RTrim(CStr(Left(Right(Datum(i, 1), 4), 2)))
Koersen(i, 1) = OpenK(i, 1)
With frmGrafiekLITE.chtPlot ' chtPlot is de name of MSChart1
' Shows 2D graph with 5 columns and NumRegels(1) + 1 rows.
.chartType = VtChChartType2dLine ' Set chart type.
.TitleText = "Dagkoersen"
.Title.VtFont.Size = 16
.Plot.Axis(VtChAxisIdY).AxisTitle = "Slotkoers"
.Plot.Axis(VtChAxisIdX).AxisTitle = "Datum"
.ColumnCount = 4
.RowCount = NumRegels(1)
.ShowLegend = True
.ColumnLabelCount = 4
.Plot.AutoLayout = True
.ChartData = Koersen ' Assign Koersen to chart
.Location.Visible = True
.VtFont.Name = "Arial"
.VtFont.Size = 8
.Location.LocationType = VtChLocationTypeTop
.VtFont.Effect = VtFontStyleBold
'Set graph data
frmGrafiekLITE.chtPlot.chartType = VtChChartType2dLine
frmGrafiekLITE.chtPlot.ChartData = Koersen
Click Here to Expand Forum to Full Width
Survey posted by VBForums.