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

Oystein Bjorke 10 years ago 0
This discussion was imported from CodePlex

heromyth wrote at 2011-10-24 15:51:

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;

 

 


objo wrote at 2011-10-24 16:47:

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. 


heromyth wrote at 2011-10-25 08:33:

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.


objo wrote at 2011-10-25 09:43:

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