Page 1 of 1

Setting Minimum and Maximum Values

Posted: Wed Sep 14, 2011 8:31 am
by 15660116
Hi,

I am manually setting the minimum and maximum x and y scales for a point chart.
Points1.Chart.Axes.Right.AutomaticMaximum = False
Points1.Chart.Axes.Bottom.AutomaticMaximum = False
Points1.Chart.Axes.Left.AutomaticMaximum = False
Points1.Chart.Axes.Top.AutomaticMaximum = False
Points1.Chart.Axes.Right.AutomaticMinimum = False
Points1.Chart.Axes.Bottom.AutomaticMinimum = False
Points1.Chart.Axes.Left.AutomaticMinimum = False
Points1.Chart.Axes.Top.AutomaticMinimum = False
Points1.Chart.Axes.Top.Maximum = XMax
Points1.Chart.Axes.Top.Minimum = XMin
Points1.Chart.Axes.Left.Maximum = YMax
Points1.Chart.Axes.Left.Minimum = YMin
Points1.Chart.Axes.Right.Maximum = YMax
Points1.Chart.Axes.Right.Minimum = YMin

The chart calculates an offset for each axes. The result is offset x and y scales. Is there some way to overcome this?

I want the scale to plot exactly how I specify.

I did have this working previously, but something must have changed when I upgraded the tchart.

Re: Setting Minimum and Maximum Values

Posted: Wed Sep 14, 2011 8:36 am
by 15660116
I have also tried setting the following values:

Points1.Chart.Axes.Bottom.MaximumOffset = 0
Points1.Chart.Axes.Bottom.MinimumOffset = 0
Points1.Chart.Axes.Top.MaximumOffset = 0
Points1.Chart.Axes.Top.MinimumOffset = 0
Points1.Chart.Axes.Left.MaximumOffset = 0
Points1.Chart.Axes.Left.MinimumOffset = 0
Points1.Chart.Axes.Right.MaximumOffset = 0
Points1.Chart.Axes.Right.MinimumOffset = 0

Re: Setting Minimum and Maximum Values

Posted: Wed Sep 14, 2011 9:53 am
by 10050769
Hello lilo,

I have made simple project to try to reproduce your problem, but it doesn't appear in it, so I can scale the axes how I want:

Code: Select all

 private void InitializeChart()
        {
            tChart1.Aspect.View3D = false;
            Series1 = new Points(tChart1.Chart);
            Series1.FillSampleValues();
            Series1.HorizAxis = HorizontalAxis.Both;
            Series1.VertAxis = VerticalAxis.Both;
                     
             tChart1.Axes.Bottom.Automatic=false;
             tChart1.Axes.Left.Automatic=false;
             tChart1.Axes.Top.Automatic = false;
             tChart1.Axes.Right.Automatic = false;


             tChart1.Axes.Bottom.Maximum = Series1.MaxXValue();
             tChart1.Axes.Bottom.Minimum = Series1.MinXValue();
             tChart1.Axes.Left.Maximum= Series1.MaxYValue();
             tChart1.Axes.Left.Minimum = Series1.MinYValue();

             tChart1.Axes.Top.Maximum = Series1.MaxXValue();
             tChart1.Axes.Top.Minimum = Series1.MinXValue();
             tChart1.Axes.Right.Maximum = Series1.MaxYValue();
             tChart1.Axes.Right.Minimum = Series1.MinYValue();

        }
Can you please, tell us if previous code works as you want? If it doesn't work as you want, explain us exactly which is the problem.

Thanks,

Re: Setting Minimum and Maximum Values

Posted: Wed Sep 14, 2011 10:21 am
by 15660116
I am able to fix the problem by setting:
Points1.Chart.Axes.Bottom.Labels.RoundFirstLabel = True
Points1.Chart.Axes.Right.Labels.RoundFirstLabel = True
Points1.Chart.Axes.Left.Labels.RoundFirstLabel = True
Points1.Chart.Axes.Top.Labels.RoundFirstLabel = True

I will try your code later.

Re: Setting Minimum and Maximum Values

Posted: Wed Sep 14, 2011 11:05 am
by 10050769
Hello lilo,

I am glad that you can find a solution for your problem.

Thanks,