0

Plots out of view when plotting using reversed y axes

Deepak Gopalakrishnan 9 months ago • updated 9 months ago 1

I modified the AxisExample - Reversed like below


<code>
public static PlotModel Reversed()
        {
            var plotModel1 = new PlotModel();
            plotModel1.Axes.Add(new LinearAxis
            {
                Position = AxisPosition.Left,
                StartPosition = 55,
                EndPosition = 0,
                MajorStep = 10,
                Key = "Y1"
            });
            plotModel1.Axes.Add(new LinearAxis
            {
                Position = AxisPosition.Right,
                StartPosition = 55,
                EndPosition = 0,
                MajorStep = 10,
                Key = "Y2"
            });
            var series1 = new LineSeries();
            series1.Color = OxyColors.Black;
            series1.YAxisKey = "Y2";
            series1.Points.Add(new DataPoint(10, 45));
            series1.Points.Add(new DataPoint(10, 30));
            series1.Points.Add(new DataPoint(21, 30));
            series1.Points.Add(new DataPoint(21, 15));
            series1.Points.Add(new DataPoint(31, 15));
            series1.Points.Add(new DataPoint(31, 0));
            plotModel1.Series.Add(series1);
            var series = new LineSeries();
            series.Color = OxyColors.Black;
            series.YAxisKey = "Y1";
            series.Points.Add(new DataPoint(12, 27));
            series.Points.Add(new DataPoint(12, 15));
            series.Points.Add(new DataPoint(31, 15));
            series.Points.Add(new DataPoint(31, 0));
            plotModel1.Series.Add(series);
            plotModel1.Axes.Add(new LinearAxis
            {
                Position = AxisPosition.Bottom,
                Minimum = 0,
                Maximum = 35,
                MajorStep = 10,
                MinorStep = 5,
            });
            return plotModel1;
        }
</code>


The resulting plot:



After zooming and panning (expected results): 




What is going wrong in my code? Not able to figure out.


Thanks

if I set 

<code>
EndPosition = 0,
StartPosition = 1,
</code>

It seems to work.

Not sure why 


StartPosition = 55,
EndPosition = 0,

Didnt work.