当前位置: 首页>>代码示例>>C#>>正文


C# PlotModel.InvalidatePlot方法代码示例

本文整理汇总了C#中OxyPlot.PlotModel.InvalidatePlot方法的典型用法代码示例。如果您正苦于以下问题:C# PlotModel.InvalidatePlot方法的具体用法?C# PlotModel.InvalidatePlot怎么用?C# PlotModel.InvalidatePlot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OxyPlot.PlotModel的用法示例。


在下文中一共展示了PlotModel.InvalidatePlot方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MouseEvents

        public static PlotModel MouseEvents()
        {
            var model = new PlotModel { Title = "Mouse events", Subtitle = "Left click and drag" };
            var yaxis = new LinearAxis { Position = AxisPosition.Left, Minimum = -1, Maximum = 1 };
            var xaxis = new LinearAxis { Position = AxisPosition.Bottom, Minimum = -1, Maximum = 1 };
            model.Axes.Add(yaxis);
            model.Axes.Add(xaxis);

            LineSeries s1 = null;

            // Subscribe to the mouse down event on the line series
            model.MouseDown += (s, e) =>
            {
                // only handle the left mouse button (right button can still be used to pan)
                if (e.ChangedButton == OxyMouseButton.Left)
                {
                    // Add a line series
                    s1 = new LineSeries
                    {
                        Title = "LineSeries" + (model.Series.Count + 1),
                        MarkerType = MarkerType.None,
                        StrokeThickness = 2
                    };
                    s1.Points.Add(xaxis.InverseTransform(e.Position.X, e.Position.Y, yaxis));
                    model.Series.Add(s1);
                    model.InvalidatePlot(false);
                    e.Handled = true;
                }
            };

            model.MouseMove += (s, e) =>
            {
                if (s1 != null)
                {
                    s1.Points.Add(xaxis.InverseTransform(e.Position.X, e.Position.Y, yaxis));
                    model.InvalidatePlot(false);
                    e.Handled = true;
                }
            };

            model.MouseUp += (s, e) =>
            {
                if (s1 != null)
                {
                    s1 = null;
                    e.Handled = true;
                }
            };
            return model;
        }
开发者ID:Celderon,项目名称:oxyplot,代码行数:50,代码来源:MouseEventExamples.cs

示例2: Window4

        public Window4()
        {
            InitializeComponent();
            this.PlotModel = new PlotModel();
            this.PlotModel.Series.Add(new FunctionSeries());
            DataContext = this;
            var worker = new BackgroundWorker { WorkerSupportsCancellation = true };
            double x = 0;
            worker.DoWork += (s, e) =>
            {
                while (!worker.CancellationPending)
                {
                    lock (this.PlotModel.SyncRoot)
                    {
                        this.PlotModel.Title = "Plot updated: " + DateTime.Now;
                        this.PlotModel.Series[0] = new FunctionSeries(Math.Sin, x, x + 4, 0.01);
                    }
                    x += 0.1;
                    PlotModel.InvalidatePlot(true);
                    Thread.Sleep(100);
                }
            };

            worker.RunWorkerAsync();
            this.Closed += (s, e) => worker.CancelAsync();
        }
开发者ID:Celderon,项目名称:oxyplot,代码行数:26,代码来源:Window4.xaml.cs

示例3: generateSongPlotFull

        void generateSongPlotFull(PlotModel model, PlaybackInfo info)
        {
            var songpoints = (model.Series[0] as ScatterSeries).ItemsSource as List<ScatterPoint>;
            songpoints.Clear();
            model.InvalidatePlot(true);

            var keys = new int[info.Messages.Keys.Count];
            int i = 0;
            foreach (var k in info.Messages.Keys)
            {
                keys[i++] = k;
            }

            for (i = 0; i < keys.Length - 1; i++)
            {

                foreach (PlaybackMessage message in info.Messages[keys[i]])
                {
                    if (message.Message == PlaybackMessage.PlaybackMessageType.Start)
                    {
                        double duration = Math.Log(message.Duration + 1, 2) * 2;
                        songpoints.Add(new ScatterPoint(keys[i], message.Pitch % 12, duration, message.Pitch / 12));
                    }
                }
            }

            if (model.Axes.Count > 2)
            {
                model.Axes[2].IsAxisVisible = false;
                model.Axes[2].Maximum = 14;
                model.Axes[2].Minimum = -2;
            }

            model.InvalidatePlot(true);
        }
开发者ID:stefan-j,项目名称:GeneticMIDI,代码行数:35,代码来源:TrackSelector.xaml.cs

示例4: MouseDownEventHitTestResult

        public static PlotModel MouseDownEventHitTestResult()
        {
            var model = new PlotModel { Title = "MouseDown HitTestResult", Subtitle = "Reports the index of the nearest point." };

            var s1 = new LineSeries();
            s1.Points.Add(new DataPoint(0, 10));
            s1.Points.Add(new DataPoint(10, 40));
            s1.Points.Add(new DataPoint(40, 20));
            s1.Points.Add(new DataPoint(60, 30));
            model.Series.Add(s1);
            s1.MouseDown += (s, e) =>
                {
                    model.Subtitle = "Index of nearest point in LineSeries: " + Math.Round(e.HitTestResult.Index);
                    model.InvalidatePlot(false);
                };

            var s2 = new ScatterSeries();
            s2.Points.Add(new ScatterPoint(0, 15));
            s2.Points.Add(new ScatterPoint(10, 45));
            s2.Points.Add(new ScatterPoint(40, 25));
            s2.Points.Add(new ScatterPoint(60, 35));
            model.Series.Add(s2);
            s2.MouseDown += (s, e) =>
                {
                    model.Subtitle = "Index of nearest point in ScatterSeries: " + (int)e.HitTestResult.Index;
                    model.InvalidatePlot(false);
                };

            return model;
        }
开发者ID:Celderon,项目名称:oxyplot,代码行数:30,代码来源:MouseEventExamples.cs

示例5: Draw

        public static void Draw(PlotModel IncomePlot,
            ObservableCollection<Transaction> transactions)
        {
            ClearGraph(IncomePlot);

            AddAxis(IncomePlot, transactions);

            AddSeries(IncomePlot, transactions);

            IncomePlot.InvalidatePlot(true);
        }
开发者ID:twodawg,项目名称:Budgeter5000,代码行数:11,代码来源:DrawGraph.cs

示例6: TrackerChangedEvent

 public static PlotModel TrackerChangedEvent()
 {
     var model = new PlotModel { Title = "Handling the TrackerChanged event", Subtitle = "Press the left mouse button to test the tracker." };
     model.Series.Add(new FunctionSeries(Math.Sin, 0, 10, 100));
     model.TrackerChanged += (s, e) =>
     {
         model.Subtitle = e.HitResult != null ? "Tracker item index = " + e.HitResult.Index : "Not tracking";
         model.InvalidatePlot(false);
     };
     return model;
 }
开发者ID:Celderon,项目名称:oxyplot,代码行数:11,代码来源:TrackerExamples.cs

示例7: ClickingOnAnAnnotation

        public static Example ClickingOnAnAnnotation()
        {
            var plotModel = new PlotModel { Title = "Clicking on an annotation", Subtitle = "Click on the rectangles" };

            plotModel.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom });
            plotModel.Axes.Add(new LinearAxis { Position = AxisPosition.Left });

            var annotation1 = new RectangleAnnotation { Fill = OxyColors.Green, Text = "RectangleAnnotation 1", MinimumX = 25, MaximumX = 75, MinimumY = 20, MaximumY = 40 };
            plotModel.Annotations.Add(annotation1);

            var annotation2 = new RectangleAnnotation { Fill = OxyColors.SkyBlue, Text = "RectangleAnnotation 2", MinimumX = 25, MaximumX = 75, MinimumY = 60, MaximumY = 80 };
            plotModel.Annotations.Add(annotation2);

            EventHandler<OxyMouseDownEventArgs> handleMouseClick = (s, e) =>
            {
                plotModel.Subtitle = "You clicked " + ((RectangleAnnotation)s).Text;
                plotModel.InvalidatePlot(false);
            };

            annotation1.MouseDown += handleMouseClick;
            annotation2.MouseDown += handleMouseClick;

            var controller = new PlotController();
            var handleClick = new DelegatePlotCommand<OxyMouseDownEventArgs>(
                (v, c, e) =>
                {
                    var args = new HitTestArguments(e.Position, 10);
                    var firstHit = v.ActualModel.HitTest(args).FirstOrDefault(x => x.Element is RectangleAnnotation);
                    if (firstHit != null)
                    {
                        e.Handled = true;
                        plotModel.Subtitle = "You clicked " + ((RectangleAnnotation)firstHit.Element).Text;
                        plotModel.InvalidatePlot(false);
                    }
                });
            controller.Bind(new OxyMouseDownGesture(OxyMouseButton.Left), handleClick);

            return new Example(plotModel, controller);
        }
开发者ID:huoxudong125,项目名称:oxyplot,代码行数:39,代码来源:PlotControllerExamples.cs

示例8: AnnotationLayers

        public static PlotModel AnnotationLayers()
        {
            var model = new PlotModel { Title = "AnnotationLayers" };

            var a1 = new RectangleAnnotation { MinimumX = 10, MaximumX = 20, MinimumY = -1, MaximumY = 1, Layer = AnnotationLayer.BelowAxes };
            var a2 = new RectangleAnnotation { MinimumX = 30, MaximumX = 40, MinimumY = -1, MaximumY = 1, Layer = AnnotationLayer.BelowSeries };
            var a3 = new RectangleAnnotation { MinimumX = 50, MaximumX = 60, MinimumY = -1, MaximumY = 1, Layer = AnnotationLayer.AboveSeries };
            model.Annotations.Add(a1);
            model.Annotations.Add(a2);
            model.Annotations.Add(a3);
            var s1 = new FunctionSeries(Math.Sin, 0, 100, 0.01);
            model.Series.Add(s1);
            a1.MouseDown += (s, e) =>
            {
                model.Subtitle = "Clicked annotation below axes";
                model.InvalidatePlot(true);
                e.Handled = true;
            };
            a2.MouseDown += (s, e) =>
            {
                model.Subtitle = "Clicked annotation below series";
                model.InvalidatePlot(true);
                e.Handled = true;
            };
            a3.MouseDown += (s, e) =>
            {
                model.Subtitle = "Clicked annotation above series";
                model.InvalidatePlot(true);
                e.Handled = true;
            };
            s1.MouseDown += (s, e) =>
            {
                model.Subtitle = "Clicked series";
                model.InvalidatePlot(true);
                e.Handled = true;
            };

            return model;
        }
开发者ID:huoxudong125,项目名称:oxyplot,代码行数:39,代码来源:Issues.cs

示例9: AddAnnotations

        public static PlotModel AddAnnotations()
        {
            var model = new PlotModel { Title = "Add arrow annotations", Subtitle = "Press and drag the left mouse button" };
            var xaxis = new LinearAxis { Position = AxisPosition.Bottom };
            var yaxis = new LinearAxis { Position = AxisPosition.Left };
            model.Axes.Add(xaxis);
            model.Axes.Add(yaxis);
            model.Series.Add(new FunctionSeries(x => Math.Sin(x / 4) * Math.Acos(Math.Sin(x)), 0, Math.PI * 8, 2000, "sin(x/4)*acos(sin(x))"));

            ArrowAnnotation tmp = null;

            // Add handlers to the PlotModel's mouse events
            model.MouseDown += (s, e) =>
            {
                if (e.ChangedButton == OxyMouseButton.Left)
                {
                    // Create a new arrow annotation
                    tmp = new ArrowAnnotation();
                    tmp.StartPoint = tmp.EndPoint = xaxis.InverseTransform(e.Position.X, e.Position.Y, yaxis);
                    model.Annotations.Add(tmp);
                    e.Handled = true;
                }
            };

            // Handle mouse movements (note: this is only called when the mousedown event was handled)
            model.MouseMove += (s, e) =>
            {
                if (tmp != null)
                {
                    // Modify the end point
                    tmp.EndPoint = xaxis.InverseTransform(e.Position.X, e.Position.Y, yaxis);
                    tmp.Text = string.Format("Y = {0:0.###}", tmp.EndPoint.Y);

                    // Redraw the plot
                    model.InvalidatePlot(false);
                    e.Handled = true;
                }
            };

            model.MouseUp += (s, e) =>
                {
                    if (tmp != null)
                    {
                        tmp = null;
                        e.Handled = true;
                    }
                };

            return model;
        }
开发者ID:huoxudong125,项目名称:oxyplot,代码行数:50,代码来源:MouseEventExamples.cs

示例10: MainWindow

        public MainWindow()
        {
            ThePlotModel = new PlotModel("Plot");
            ObsFunctionList = new ObservableCollection<FunctionList>();

            SetupPlot();

            XLogarithmCheck = false;
            YLogarithmCheck = false;

            DataContext = this;
            InitializeComponent();
            ItemList.ItemsSource = ObsFunctionList;
            ThePlotModel.InvalidatePlot(true);
        }
开发者ID:TIPLPA,项目名称:PLPA,代码行数:15,代码来源:MainWindow.xaml.cs

示例11: AddSeriesByMouseDownEvent

        public static PlotModel AddSeriesByMouseDownEvent()
        {
            var model = new PlotModel { Title = "MouseDown", Subtitle = "Left click to add series.", LegendSymbolLength = 40 };

            model.MouseDown += (s, e) =>
            {
                if (e.ChangedButton == OxyMouseButton.Left)
                {
                    double a = model.Series.Count + 1;
                    model.Series.Add(new FunctionSeries(x => Math.Sin(a * x), 0, 10, 1000));
                    model.InvalidatePlot(true);
                    e.Handled = true;
                }
            };

            return model;
        }
开发者ID:huoxudong125,项目名称:oxyplot,代码行数:17,代码来源:MouseEventExamples.cs

示例12: MouseHandlingExample

        public static Example MouseHandlingExample()
        {
            var model = new PlotModel { Title = "Mouse handling example" };
            var series = new ScatterSeries();
            model.Series.Add(series);

            // Create a command that adds points to the scatter series
            var command = new DelegatePlotCommand<OxyMouseEventArgs>(
                (v, c, a) =>
                {
                    var point = series.InverseTransform(a.Position);
                    series.Points.Add(new ScatterPoint(point.X, point.Y));
                    model.InvalidatePlot(true);
                });

            var controller = new PlotController();
            controller.BindMouseDown(OxyMouseButton.Left, command);

            return new Example(model, controller);
        }
开发者ID:Celderon,项目名称:oxyplot,代码行数:20,代码来源:PlotControllerExamples.cs

示例13: ClickingOnAnAnnotation

        public static PlotModel ClickingOnAnAnnotation()
        {
            var plotModel = new PlotModel { Title = "Clicking on an annotation", Subtitle = "Click on the rectangles" };

            plotModel.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom });
            plotModel.Axes.Add(new LinearAxis { Position = AxisPosition.Left });

            var annotation1 = new RectangleAnnotation { Fill = OxyColors.Green, Text = "RectangleAnnotation 1", MinimumX = 25, MaximumX = 75, MinimumY = 20, MaximumY = 40 };
            plotModel.Annotations.Add(annotation1);

            var annotation2 = new RectangleAnnotation { Fill = OxyColors.SkyBlue, Text = "RectangleAnnotation 2", MinimumX = 25, MaximumX = 75, MinimumY = 60, MaximumY = 80 };
            plotModel.Annotations.Add(annotation2);

            EventHandler<OxyMouseDownEventArgs> handleMouseClick = (s, e) =>
            {
                plotModel.Subtitle = "You clicked " + ((RectangleAnnotation)s).Text;
                plotModel.InvalidatePlot(false);
            };

            annotation1.MouseDown += handleMouseClick;
            annotation2.MouseDown += handleMouseClick;

            return plotModel;
        }
开发者ID:Celderon,项目名称:oxyplot,代码行数:24,代码来源:MouseEventExamples.cs

示例14: TouchSeries

        public static PlotModel TouchSeries()
        {
            var model = new PlotModel { Title = "Touch on a LineSeries" };
            var series = new LineSeries();
            series.Points.Add(new DataPoint(0, 0));
            series.Points.Add(new DataPoint(10, 10));
            model.Series.Add(series);

            series.TouchStarted += (s, e) =>
            {
                model.Subtitle = "The touch gesture started on the LineSeries";
                model.InvalidatePlot(false);
                e.Handled = true;
            };

            series.TouchDelta += (s, e) =>
            {
                series.Points.Add(series.InverseTransform(e.Position));
                model.InvalidatePlot(false);
            };

            series.TouchCompleted += (s, e) =>
            {
                model.Subtitle = "The touch gesture completed";
                model.InvalidatePlot(false);
                e.Handled = true;
            };

            return model;
        }
开发者ID:Celderon,项目名称:oxyplot,代码行数:30,代码来源:MouseEventExamples.cs

示例15: RectangleAnnotationClick

        public static PlotModel RectangleAnnotationClick()
        {
            var plotModel = new PlotModel { Title = "RectangleAnnotation click" };

            plotModel.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom });
            plotModel.Axes.Add(new LinearAxis { Position = AxisPosition.Left });

            var annotation = new RectangleAnnotation() { MinimumX = 10, MaximumX = 60, MinimumY = 10, MaximumY = 20 };
            plotModel.Annotations.Add(annotation);

            int i = 0;
            annotation.MouseDown += (s, e) =>
            {
                annotation.Text = "Clicked " + (++i) + " times.";
                plotModel.InvalidatePlot(false);
            };

            return plotModel;
        }
开发者ID:Celderon,项目名称:oxyplot,代码行数:19,代码来源:MouseEventExamples.cs


注:本文中的OxyPlot.PlotModel.InvalidatePlot方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。