Skip to content

When panning with AreaSeries, the area is displayed strangely #2104

Description

@SADASHIMA

Steps to reproduce

1.Create WPF Application, And code this
MainWindow.xaml

<Window x:Class="OxyPlotAreaSeriesProbrem.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:OxyPlotAreaSeriesProbrem"
        xmlns:oxy="http://oxyplot.org/wpf"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="450">
    <Grid>
        <oxy:PlotView x:Name="ThisPlot" Background="Transparent">
        </oxy:PlotView>
    </Grid>
</Window>

MainWindow.xaml.cs

using OxyPlot.Axes;
using OxyPlot.Series;
using OxyPlot;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace OxyPlotAreaSeriesProbrem
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();

            ThisPlot.Model = new PlotModel();
            ThisPlot.Model.PlotType = PlotType.Cartesian;
            ThisPlot.Model.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom, MajorStep = 500.0, MinorStep = 500.0, MajorGridlineStyle = LineStyle.Solid, MajorGridlineColor = OxyColors.Gray, MajorGridlineThickness = 1 });
            ThisPlot.Model.Axes.Add(new LinearAxis { Position = AxisPosition.Left, MajorStep = 500.0, MinorStep = 500.0, MajorGridlineStyle = LineStyle.Solid, MajorGridlineColor = OxyColors.Gray, MajorGridlineThickness = 1 });
            
            var workOutlineSeries = new AreaSeries()
            {
                StrokeThickness = 4,
                LineStyle = LineStyle.Solid,
                Color = OxyColors.Red,
                Color2 = OxyColors.Transparent,
                Fill = OxyColors.LightPink,
                Selectable = false,
            };
            var sqearOutlineSeries = new AreaSeries()
            {
                StrokeThickness = 2,
                LineStyle = LineStyle.Solid,
                Color = OxyColors.LimeGreen,
                Color2 = OxyColors.Transparent,
                Fill = OxyColors.Transparent,
                Selectable = false,
            };
            DataPoint[] work = new DataPoint[]{
                new DataPoint(2254,2740),
                new DataPoint(5028,2873),
                new DataPoint(5709,986),
                new DataPoint(2751,1477),
                new DataPoint(2254,2740),
            };

            workOutlineSeries.Points.AddRange(work);

            DataPoint[] sqear = new DataPoint[]
            {
                new DataPoint (2254,986),
                new DataPoint (2254,2873),
                new DataPoint (5709,2873),
                new DataPoint (5709,986),
                new DataPoint (2254,986),
            };

            sqearOutlineSeries.Points.AddRange(sqear);

            ThisPlot.Model.Series.Add(workOutlineSeries);
            ThisPlot.Model.Series.Add(sqearOutlineSeries);

            ThisPlot.Model.ResetAllAxes();

            ThisPlot.Model.InvalidatePlot(true);
        }
    }
}
  1. Pan until the top right point passes beyond the right side of the plot area.

Platform:
.NET version:windows-8.0
Oxyplot package version:2.2.0

Expected behaviour

The display of the area remains unchanged.

Actual behaviour

The area display is strange. Also, the green line at the bottom disappears.
AreaSerisProbrem

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions