Strange behavior on zooming/moving

Oystein Bjorke vor 10 Jahren 0
This discussion was imported from CodePlex

pvyhlas wrote at 2014-04-29 16:25:

Hi,

When I right click on chart or scroll with wheel, charts automatically zooms to strange position, (0,0) + data.

Package version 2014.1.296.1

xaml code
<Window x:Class="OxyPlotTest.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:oxy="http://oxyplot.codeplex.com"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <oxy:Plot>
            <oxy:LineSeries x:Name="Test" Title="Test" ItemsSource="{Binding}" />
        </oxy:Plot>
    </Grid>
</Window>
code behind
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
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 OxyPlotTest
{

    public class Model
    {
        public double X { get; set; }
        public double Y { get; set; }


    }

    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        protected ObservableCollection<Model> TestData;

        public MainWindow()
        {
            TestData = new ObservableCollection<Model>();
            TestData.Add(new Model() { X = 150000, Y = 10000 });
            TestData.Add(new Model() { X = 150002, Y = 10000 });
            TestData.Add(new Model() { X = 150004, Y = 10000 });
            TestData.Add(new Model() { X = 150006, Y = 10000 });
            TestData.Add(new Model() { X = 150008, Y = 10000 });
            TestData.Add(new Model() { X = 150010, Y = 10000 });
            TestData.Add(new Model() { X = 150012, Y = 10000 });
            TestData.Add(new Model() { X = 150014, Y = 10000 });

            InitializeComponent();
            Test.DataContext = TestData;
            Test.Mapping = (x) => { var m = x as Model; return new OxyPlot.DataPoint(m.X, m.Y); };
        }
    }
}
Any advice how to change this behavior to keeping its display context?

Thanks.

pvyhlas wrote at 2014-05-06 21:49:

Solved by manually adding axes to plot.