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


C# LinearAxis.Zoom方法代码示例

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


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

示例1: CreateAxisForPlotModel

 private LinearAxis CreateAxisForPlotModel(double minVal, double maxVal, string title, bool isXAxis)
 {
     var axis = new LinearAxis();
     const double offset = 0.1;
     double range = maxVal - minVal;
     axis.AbsoluteMinimum = minVal - offset * range;
     axis.AbsoluteMaximum = maxVal + offset * range;
     axis.Position = isXAxis ? AxisPosition.Bottom : AxisPosition.Left;
     axis.Title = title;
     axis.Zoom(axis.AbsoluteMinimum, axis.AbsoluteMaximum);
     axis.IsZoomEnabled = false;
     axis.MajorGridlineStyle = LineStyle.Solid;
     axis.MinorGridlineStyle = LineStyle.Dot;
     return axis;
 }
开发者ID:malcolmcarvalho,项目名称:TrimCurve,代码行数:15,代码来源:GreenFLOATOxyplotModel.cs

示例2: MainWindow

        public MainWindow()
        {
            this.InitializeComponent();
            this.DataContext = this;

            this.Model1 = new PlotModel("Model 1");
            this.Model2 = new PlotModel("Model 2");
            var axis1 = new LinearAxis(AxisPosition.Bottom);
            var axis2 = new LinearAxis(AxisPosition.Bottom);
            this.Model1.Axes.Add(axis1);
            this.Model2.Axes.Add(axis2);
            this.Model1.Series.Add(new FunctionSeries(Math.Sin, 0, 10, 1000));
            this.Model2.Series.Add(new FunctionSeries(x => Math.Sin(x) / x, 0, 10, 1000));

            bool isInternalChange = false;
            axis1.AxisChanged += (s, e) =>
                {
                    if (isInternalChange)
                    {
                        return;
                    }

                    isInternalChange = true;
                    axis2.Zoom(axis1.ActualMinimum, axis1.ActualMaximum);
                    this.Model2.InvalidatePlot(false);
                    isInternalChange = false;
                };

            axis2.AxisChanged += (s, e) =>
            {
                if (isInternalChange)
                {
                    return;
                }

                isInternalChange = true;
                axis1.Zoom(axis2.ActualMinimum, axis2.ActualMaximum);
                this.Model1.InvalidatePlot(false);
                isInternalChange = false;
            };
        }
开发者ID:aleksanderkobylak,项目名称:oxyplot,代码行数:41,代码来源:MainWindow.xaml.cs

示例3: AdjustYExtent

        /// <summary>
        /// Adjusts the Y extent.
        /// </summary>
        /// <param name="series">Series.</param>
        /// <param name="xaxis">Xaxis.</param>
        /// <param name="yaxis">Yaxis.</param>
        private static void AdjustYExtent(CandleStickSeries series, DateTimeAxis xaxis, LinearAxis yaxis)
        {
            var xmin = xaxis.ActualMinimum;
            var xmax = xaxis.ActualMaximum;

            var istart = series.FindByX(xmin);
            var iend = series.FindByX(xmax, istart);

            var ymin = double.MaxValue;
            var ymax = double.MinValue;
            for (int i = istart; i <= iend; i++)
            {
                var bar = series.Items[i];
                ymin = Math.Min(ymin, bar.Low);
                ymax = Math.Max(ymax, bar.High);
            }

            var extent = ymax - ymin;
            var margin = extent * 0.10;

            yaxis.Zoom(ymin - margin, ymax + margin);
        }
开发者ID:huoxudong125,项目名称:oxyplot,代码行数:28,代码来源:CandleStickSeriesExamples.cs

示例4: CreatePlotModel

    private PlotModel CreatePlotModel() {

      timeAxis.Position = AxisPosition.Bottom;
      timeAxis.MajorGridlineStyle = LineStyle.Solid;
      timeAxis.MajorGridlineThickness = 1;
      timeAxis.MajorGridlineColor = OxyColor.FromRgb(192, 192, 192);
      timeAxis.MinorGridlineStyle = LineStyle.Solid;
      timeAxis.MinorGridlineThickness = 1;
      timeAxis.MinorGridlineColor = OxyColor.FromRgb(232, 232, 232);
      timeAxis.StartPosition = 1;
      timeAxis.EndPosition = 0;
      timeAxis.MinimumPadding = 0;
      timeAxis.MaximumPadding = 0;
      timeAxis.AbsoluteMinimum = 0;
      timeAxis.Minimum = 0;
      timeAxis.AbsoluteMaximum = 24 * 60 * 60;
      timeAxis.Zoom(
        settings.GetValue("plotPanel.MinTimeSpan", 0.0f),
        settings.GetValue("plotPanel.MaxTimeSpan", 10.0f * 60));
      timeAxis.StringFormat = "h:mm";

      var units = new Dictionary<SensorType, string>();
      units.Add(SensorType.Voltage, "V");
      units.Add(SensorType.Clock, "MHz");
      units.Add(SensorType.Temperature, "°C");
      units.Add(SensorType.Load, "%");
      units.Add(SensorType.Fan, "RPM");
      units.Add(SensorType.Flow, "L/h");
      units.Add(SensorType.Control, "%");
      units.Add(SensorType.Level, "%");
      units.Add(SensorType.Factor, "1");
      units.Add(SensorType.Power, "W");
      units.Add(SensorType.Data, "GB");

      foreach (SensorType type in Enum.GetValues(typeof(SensorType))) {
        var axis = new LinearAxis();
        axis.Position = AxisPosition.Left;
        axis.MajorGridlineStyle = LineStyle.Solid;
        axis.MajorGridlineThickness = 1;
        axis.MajorGridlineColor = timeAxis.MajorGridlineColor;
        axis.MinorGridlineStyle = LineStyle.Solid;
        axis.MinorGridlineThickness = 1;
        axis.MinorGridlineColor = timeAxis.MinorGridlineColor;
        axis.AxislineStyle = LineStyle.Solid;
        axis.Title = type.ToString();
        axis.Key = type.ToString();

        axis.Zoom(
          settings.GetValue("plotPanel.Min" + axis.Key, float.NaN),
          settings.GetValue("plotPanel.Max" + axis.Key, float.NaN));

        if (units.ContainsKey(type))
          axis.Unit = units[type];
        axes.Add(type, axis);
      }

      var model = new PlotModel();
      model.Axes.Add(timeAxis);
      foreach (var axis in axes.Values)
        model.Axes.Add(axis);
      model.PlotMargins = new OxyThickness(0);
      model.IsLegendVisible = false;

      return model;
    }
开发者ID:AndrewTPohlmann,项目名称:open-hardware-monitor,代码行数:65,代码来源:PlotPanel.cs


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