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


C# LinearAxis.InverseTransform方法代码示例

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


在下文中一共展示了LinearAxis.InverseTransform方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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


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