Results 1 to 10 of 10

Thread: [RESOLVED] MS Chart tick mark labels help

  1. #1

    Thread Starter
    Hyperactive Member Frabulator's Avatar
    Join Date
    Jan 2015
    Location
    USA
    Posts
    393

    Resolved [RESOLVED] MS Chart tick mark labels help

    I cant figure out where the setting is to specify the value for the label tick marks on the X axis. Could someone please point me in the right direction?

    Thanks
    ~Frab
    Oops, There it goes. Yep... my brain stopped...
    _________________________________

    Useful Things:

    How to link your VB.Net application to Excel

  2. #2
    Frenzied Member
    Join Date
    May 2014
    Location
    Central Europe
    Posts
    1,372

    Re: MS Chart tick mark labels help

    you mean the labels along the x axis? if bound to a datatable you set the .XValueMember for one of your series.

  3. #3

    Thread Starter
    Hyperactive Member Frabulator's Avatar
    Join Date
    Jan 2015
    Location
    USA
    Posts
    393

    Re: MS Chart tick mark labels help

    Here is the problem. I have the scale on the X axis not continuing to the end of the graph (please see image). I thought that maybe I had changed the X axis somewhere in the programming because the Y axis is fine. I checked the .XValueMembers for both Y and X and they are the same. What else could cause this?

    Name:  Capture.PNG
Views: 1102
Size:  2.5 KB
    Oops, There it goes. Yep... my brain stopped...
    _________________________________

    Useful Things:

    How to link your VB.Net application to Excel

  4. #4
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,582

    Re: MS Chart tick mark labels help

    How did you set up the chart.
    Your Y tick marks are on 100 unit boundaries, I wonder if your chart's X size is also based on being on a 100 boundary.
    The chart itself looks to be 300 wide, so 285 shows up where it is suppose to be on a 300 unit wide chart.

  5. #5

    Thread Starter
    Hyperactive Member Frabulator's Avatar
    Join Date
    Jan 2015
    Location
    USA
    Posts
    393

    Re: MS Chart tick mark labels help

    The chart is setup as 300x8000. Yes it is graphing correctly, but the 285 tick mark is bothering me. I would like it to be on the end of the graph and cant figure out why its not.

    I tried to add in 'Chart1.ChartAreas(0).AxisX.LabelStyle.IsEndLabelVisible = True' but to no avail.

    Best case I would prefer multiple tick marks like on the Y axis. I just cant figure out what setting I have/need to change to get this result.
    Oops, There it goes. Yep... my brain stopped...
    _________________________________

    Useful Things:

    How to link your VB.Net application to Excel

  6. #6
    Addicted Member
    Join Date
    Nov 2011
    Posts
    229

    Re: MS Chart tick mark labels help

    If you want to set the chart maximum and grid lines manually you could do the following at run time (form load event) or you could do it by modifying the chart axis properties at design time. Uncomment the MinorGrid.Interval property if you need another level of measurement.

    Code:
      With Chart1.ChartAreas(0).AxisX
    
                .Minimum = 0
                .Maximum = 300
                .MajorGrid.Interval = 5
                '.MinorGrid.Interval = 1
    
            End With

  7. #7

    Thread Starter
    Hyperactive Member Frabulator's Avatar
    Join Date
    Jan 2015
    Location
    USA
    Posts
    393

    Re: MS Chart tick mark labels help

    Quote Originally Posted by Mc_VB View Post
    If you want to set the chart maximum and grid lines manually you could do the following at run time (form load event) or you could do it by modifying the chart axis properties at design time. Uncomment the MinorGrid.Interval property if you need another level of measurement.
    I have previously done that. I currently have the graph set as the following:

    Code:
    Chart1.ChartAreas(0).AxisX.MajorGrid.Interval = Chart1.ChartAreas(0).AxisX.Maximum
    Chart1.ChartAreas(0).AxisY.MajorGrid.Interval = Chart1.ChartAreas(0).AxisY.Maximum / 4
    This results in the lines inside of the graph to be placed at the corresponding intervals. However I am curious about the placement of the X axis labels.
    Last edited by Frabulator; Mar 30th, 2018 at 04:45 PM.
    Oops, There it goes. Yep... my brain stopped...
    _________________________________

    Useful Things:

    How to link your VB.Net application to Excel

  8. #8
    Addicted Member
    Join Date
    Nov 2011
    Posts
    229

    Re: MS Chart tick mark labels help

    If I wanted my labels to align with the grid marks on my last post for example I would add corresponding tick marks and then a label that aligned with those tick marks

    Code:
    With Chart1.ChartAreas(0).AxisX
    
                .Minimum = 0
                .Maximum = 300
                .MajorGrid.Interval = 5
                .MajorTickMark.Enabled = True
                .MajorTickMark.Interval = 5
                .LabelStyle.Enabled = True
                .LabelStyle.Interval = 5
    
            End With
    Last edited by Mc_VB; Mar 30th, 2018 at 05:05 PM. Reason: removed reference to minor grid

  9. #9

    Thread Starter
    Hyperactive Member Frabulator's Avatar
    Join Date
    Jan 2015
    Location
    USA
    Posts
    393

    Re: MS Chart tick mark labels help

    Quote Originally Posted by Mc_VB View Post
    If I wanted my labels to align with the grid marks on my last post for example I would add corresponding tick marks and then a label that aligned with those tick marks

    Code:
    With Chart1.ChartAreas(0).AxisX
    
                .Minimum = 0
                .Maximum = 300
                .MajorGrid.Interval = 5
                .MajorTickMark.Enabled = True
                .MajorTickMark.Interval = 5
                .LabelStyle.Enabled = True
                .LabelStyle.Interval = 5
    
            End With

    That did it! Thank you very much !
    Oops, There it goes. Yep... my brain stopped...
    _________________________________

    Useful Things:

    How to link your VB.Net application to Excel

  10. #10
    Addicted Member
    Join Date
    Nov 2011
    Posts
    229

    Re: [RESOLVED] MS Chart tick mark labels help

    If you need to zoom and scroll try this in the form load

    Code:
            Chart1.ChartAreas(0).CursorX.IsUserEnabled = True
            Chart1.ChartAreas(0).CursorX.IsUserSelectionEnabled = True
            Chart1.ChartAreas(0).AxisX.ScaleView.Zoomable = True
            Chart1.ChartAreas(0).AxisX.ScrollBar.IsPositionedInside = True
            Chart1.ChartAreas(0).AxisX.ScaleView.Zoom(0, 300)

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