locked
XAxis label format? RRS feed

  • Question

  • How do I control the format of the XAxis labeling?

    At issue is a chart that I can zoom to expand the data.

    While initially, my Axis numbers are (for example): 20 40 60 80 100
    if I zoom in, I'm getting Axis numbers like 35.99999995 37.99999992 39.99999995

    I'm kinda new at the charting (and C# in general), so any help would be GREATLY appreciated.

    Thursday, October 21, 2010 6:40 PM

Answers

  • Yea!  It worked! (but I did have to change it to chart1.ChartAreas["Default"].AxisX.LabelStyle = style1;
    • Marked as answer by Steve76063 Monday, October 25, 2010 2:01 PM
    Monday, October 25, 2010 2:01 PM

All replies

  • Hello Steve, well what you get is a normal behaviour. In order to change your Axis style you could write something like the following code:

    LabelStyle style1 = new LabelStyle();
    style1.Format = "#.##";


    C# Lover
    Friday, October 22, 2010 8:50 AM
  • Well, I stuck that piece of code in, but nothing changed...I suspect that being new to C#, I don't know just where to put it...any suggestions?
    Friday, October 22, 2010 10:17 PM
  • Well steve you need just need to set the LabelStyle to your axis that you need to format.

    e.g: chart1.Series["series1"].YAxis.LabelStyle = style1;


    C# Lover
    Saturday, October 23, 2010 2:56 AM
  • Yea!  It worked! (but I did have to change it to chart1.ChartAreas["Default"].AxisX.LabelStyle = style1;
    • Marked as answer by Steve76063 Monday, October 25, 2010 2:01 PM
    Monday, October 25, 2010 2:01 PM