Results 1 to 3 of 3

Thread: MSChart X Axis Labels

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Oct 2000
    Posts
    17

    Angry

    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
    Next i

    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!



  2. #2
    Fanatic Member
    Join Date
    Jan 2001
    Location
    Vietnam
    Posts
    613
    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

  3. #3
    New Member
    Join Date
    Apr 2007
    Posts
    10

    Re: MSChart X Axis Labels

    Hi TheBao,
    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 jvdpeet01@hotmail.com. 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)))
    End If
    Koersen(i, 1) = OpenK(i, 1)
    Next i

    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
    End With

    With chtPlot.Legend
    .Location.Visible = True
    .VtFont.Name = "Arial"
    .VtFont.Size = 8
    .Location.LocationType = VtChLocationTypeTop
    .VtFont.Effect = VtFontStyleBold
    End With

    'Set graph data
    frmGrafiekLITE.chtPlot.chartType = VtChChartType2dLine
    frmGrafiekLITE.chtPlot.ChartData = Koersen
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width