0

I have been tying to set the min and max values of y axis by using properties like ActualMinimum and ActualMaximum,but i doesn't work even I set the MinimumPadding and MaximumPadding to 0. I also tried the Zoom method of axis, it did not work. Sorry that I cannot upload a pic...

Could someone please guide me in this regard ? Any help is very much appreciated. Thanks !

Laur Ivan
  • 4,117
  • 3
  • 38
  • 62
keven
  • 11
  • 1
  • 2

1 Answers1

6

Please use the properties AbsoluteMaximum and AbsoluteMinimum to limit the axes to a specific value:

plotModel.Axes.Add(new LinearAxis
        {
            Position = AxisPosition.Left,
            AbsoluteMaximum = 5.5,
            AbsoluteMinimum = 0,
        });

In my opinion the properties ActualMinimum and ActualMaximum are used to limit the axes to an initial value but you are able to zoom out later.

  • Thanks!It really works!But I am stil confused about the Zoom method.Why it doesn't work? – keven Jul 15 '15 at 14:11
  • Please check if you point to the right Axes[index]. Please try plot1.Model.Axes[1].Zoom(10000,11000). I guess your Axes[0] is the Abscissa (x) not the Ordinate (y). So your zoom doesn't work. Also always call PlotModel.InvalidatePlot(true) outside a constructor to make changes happen on the plot. And please accept answer if it helped you ;). – Sebastian Richter Jul 15 '15 at 14:43
  • Sorry,that was a typing mistake.And I have figured out where the problem was.When I created the OxyPlot object ,I set the PlotType to Cartesian,other than XY,which affected the scale of X axis and Y axis.Thank you again! – keven Jul 16 '15 at 04:47