What's the replation among PlotType.Cartesian, PlotMargins and AxisTitle

Oct 24, 2011 at 1:51 PM

For the example code  belown, it's OK when dragging with right mouse button.

1) Uncomment "Here 2" or "Here 2", the same dragging will lead a strange behavior;

2) Uncomment "Here 2" or "Here 2", comment "Here 1", the same dragging will be OK;

So,  is there a bug for PlotType.Cartesian and right mouse button dragging?

Here is the example code:

 

var pm = new PlotModel("Test")
            {
                PlotType = PlotType.Cartesian,                      // Here 1
                Background = OxyColors.White
            };

            //pm.PlotMargins = new OxyThickness(40, 40, 40, 40);    // Here 2

            LinearAxis la = new LinearAxis();
            la.Title = "Pressure";
            la.Position = AxisPosition.Left;

            pm.Axes.Add(la);

            DateTimeAxis dateTimeAxis = new DateTimeAxis();
            //dateTimeAxis.Title = "Time";                          // Here 3
            dateTimeAxis.StringFormat = "yyyy-MM-dd HH:mm:ss";

            DateTime dt = DateTime.Now;
            dateTimeAxis.Maximum = DateTimeAxis.ToDouble(dt.AddMinutes(15));
            dateTimeAxis.Minimum = DateTimeAxis.ToDouble(dt.Subtract(new TimeSpan(0, 15, 0)));
            dateTimeAxis.CalendarWeekRule = CalendarWeekRule.FirstFourDayWeek;

            dateTimeAxis.Position = AxisPosition.Bottom;
            pm.Axes.Add(dateTimeAxis);

            plot1.Model = pm;

 

 

Coordinator
Oct 24, 2011 at 2:47 PM

Yes, you are right there is a bug when panning cartesian axes, it should hopefully not be too difficult to fix (it was working properly before).

ps. Are you sure you want to use a cartesian coordinate system with the datetime axis? The way it is implemented means that 1 unit on the pressure axis will be the same length as 1 day on the time axis. 

Oct 25, 2011 at 6:33 AM
objo wrote:

Yes, you are right there is a bug when panning cartesian axes, it should hopefully not be too difficult to fix (it was working properly before).

ps. Are you sure you want to use a cartesian coordinate system with the datetime axis? The way it is implemented means that 1 unit on the pressure axis will be the same length as 1 day on the time axis. 

Of course not, I just happenly found this bug.

Coordinator
Oct 25, 2011 at 7:43 AM

the problem is related to the automatic adjustment of plot margins. Try to set AutoAdjustPlotMargins to false until we have solved this problem.