Problem changing plot padding and axis position in code....

Oystein Bjorke 10 lat temu 0
This discussion was imported from CodePlex

luisfrossi wrote at 2013-07-30 16:25:

Hello,

I got a program that I am using OxyPlot.

I need to add Plots dynamically to a StackPanel.

My problems are the following.

If i define the Plot Padding and Margin, it is not followed.

I need to use DateTimeaxis. If I define the axis Position to AxisPosition.None it create a linear axix and ignore my DateTimeAxis.

What i want to make is to place two plots with no space between them.

Any help on that?

PS: Some code:

Here I set the DateTimeAxis Position
                    dateTimeAxis1 = new DateTimeAxis
                    {
                        CalendarWeekRule = CalendarWeekRule.FirstFourDayWeek,
                        FirstDayOfWeek = DayOfWeek.Monday,
                        MajorGridlineStyle = LineStyle.Solid,
                        MinorGridlineStyle = LineStyle.Dot,
                        Minimum = DateTimeAxis.ToDouble(FirstDate),
                        Maximum = DateTimeAxis.ToDouble(FinalDate),
                        IsPanEnabled = false,
                        IsZoomEnabled = false
                    };
                    if (IsFirstDay)
                        dateTimeAxis1.Position = AxisPosition.Top;
                    else
                        dateTimeAxis1.Position = AxisPosition.None;
                    plotModel.Axes.Add(dateTimeAxis1);
Here I set the Plot Margin and Padding
                    myPlot = new OxyPlot.Wpf.Plot()
                    {
                        Height = 150,
                        IsRendering = true
                    };

                    myPlot.Padding = new Thickness(5, 0, 15, 0);
                    myPlot.PlotMargins = new Thickness(0, 0, 0, 0);