Results 1 to 6 of 6
  1. #1
    Paul H's Avatar
    Paul H is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591

    Scaling a Chart Axis

    I have two, nearly identical charts.

    The X axis on Chart 1 is spread over a date/time range.
    Example: 09/01 12 am, 09/01 8 am, 09/01 4 pm, 09/02 12 am etc.
    This chart automatically changes it's major tick marks depending on the range selected. One week has a tick mark and label for each day, one Month has a tick mark for each week, 6 months has a tick mark for each month.

    The axis on Chart 2 is spread over a formatted text field combining date and shift.
    Example: 09/01 Shift A, 09/01 Shift B, 09/01 Shift C, 09/02 Shift A etc.

    This chart does not automatically adjust tick marks and labels which results in an illegible blur when choosing a large date range.



    This charts has a different set of options.
    • Number of categories between tick mark labels
    • Number of categories between tick

    I've determined I have to come up with a formula to change these via code. I can come up with the formula, but I can't find the property I need to set. Can you point me towards these properties or come up with something much simpler that I haven't thought of.

    Followup note. Chart 1 is an X/Y scatter chart. Chart 2 is a line chart. When I convert it to an XY Scatter chart the scale adjusts automatically, but the labels on the X axis change to row numbers.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,972
    Here is example code behind a report in my db setting y axis scale and units for a line graph:
    Code:
    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    'Plot Vibratory graph
    Dim MinDD As Double
    Dim MaxDD As Double
    MinDD = DMin("Den", "GraphVibratory")
    MaxDD = DMax("Den", "GraphVibratory")
    With Me.gphDensity
    If MinDD > 0 Then
        .Axes(xlValue).MinimumScale = MinDD
        If Me!Metric = True Then
            MaxDD = Int(MaxDD / 100) * 100 + 100
            MinDD = MaxDD - 1000
            .Axes(xlValue).MaximumScale = MinDD
            .Axes(xlValue).MinimumScale = MinDD
            .Axes(xlValue).MajorUnit = 200
            .Axes(xlValue).MinorUnit = 40
        Else
            MaxDD = Int(MaxDD / 5) * 5 + 5
            MinDD = MaxDD - 50
            .Axes(xlValue).MaximumScale = MaxDD
            .Axes(xlValue).MinimumScale = MinDD
            .Axes(xlValue).MajorUnit = 10
            .Axes(xlValue).MinorUnit = 2
        End If
        .Axes(xlValue, xlPrimary).HasTitle = True
        If Me!Metric = True Then
            .Axes(xlValue, xlPrimary).AxisTitle.Text = "Max. Dry Density, Kg/cu.m"
        End If
        .Axes(xlCategory, xlPrimary).HasTitle = True
        If Me!Metric = True Then
            .Axes(xlCategory, xlPrimary).AxisTitle.Text = "Percent Passing 4.75 mm Sieve"
        End If
    End If
    End With
    End Sub
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Paul H's Avatar
    Paul H is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591
    I have something very much like that for my Y axis, but that does not work on line chart X axis.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,972
    Don't think can program the X axis on line chart. I think I have for X/Y Scatter. Don't have that file with me. Remind me on Wednesday if I don't get back before then.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Paul H's Avatar
    Paul H is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591
    I hate taking no for an answer, but this has dropped to the level of curiosity at this point.

    Have a good weekend. See you Wednesday.

    Paul

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,972
    This is excerpt of my code for an XY Scatter that sets both axes.
    .Axes(xlCategory).MinimumScale = MinAC
    .Axes(xlCategory).MaximumScale = MaxAC
    .Axes(xlValue).MinimumScale = MinUWT
    .Axes(xlValue).MaximumScale = MaxUWT
    .Axes(xlValue).MinorUnit = MnrUWT
    .Axes(xlValue).MajorUnit = MajUWT
    .Axes(xlValue, xlPrimary).HasTitle = True
    .Axes(xlValue, xlPrimary).AxisTitle.Text = "Unit Weight, " & IIf(booMetric = True, "kg/cu.m", "pcf")
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Y Axis Scale Problem on XY Scatter Chart
    By Paul H in forum Access
    Replies: 1
    Last Post: 01-15-2013, 06:14 PM
  2. Replies: 5
    Last Post: 01-15-2013, 01:15 PM
  3. Chart axis change with .Chartype changes
    By alangea in forum Programming
    Replies: 2
    Last Post: 05-20-2012, 12:41 PM
  4. Scatter Chart not Showing X-axis Values
    By ward0749 in forum Forms
    Replies: 4
    Last Post: 03-20-2012, 06:37 AM
  5. Perplexing scatter chart x-axis problem
    By whatwouldmattdo in forum Queries
    Replies: 3
    Last Post: 11-28-2011, 09:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums