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


C# OxyPlot.PlotModel类代码示例

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


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

示例1: Example1

        // [Example("DateTime Minimum bug")]
        public static PlotModel Example1()
        {
            var tmp = new PlotModel("Test");
            tmp.Axes.Add(new LinearAxis(AxisPosition.Left) { MajorGridlineStyle = LineStyle.Solid, MinorGridlineStyle = LineStyle.Dot, TickStyle = TickStyle.Outside });
            DateTime dt = new DateTime(2010, 1, 1);
            tmp.Axes.Add(new DateTimeAxis(dt, dt.AddDays(1), AxisPosition.Bottom, null, null, DateTimeIntervalType.Hours)
            {
                MajorGridlineStyle = LineStyle.Solid,
                Angle = 90,
                StringFormat = "HH:mm",
                MajorStep = 1.0 / 24 / 2, // 1/24 = 1 hour, 1/24/2 = 30 minutes
                IsZoomEnabled = true,
                MaximumPadding = 0,
                MinimumPadding = 0,
                TickStyle = TickStyle.None
            });

            var ls = new LineSeries("Line1") { DataFieldX = "X", DataFieldY = "Y" };
            List<Item> ii = new List<Item>();

            for (int i = 0; i < 24; i++)
                ii.Add(new Item { X = dt.AddHours(i), Y = i * i });
            ls.ItemsSource = ii;
            tmp.Series.Add(ls);
            return tmp;
        }
开发者ID:jgodinez,项目名称:OxyPlot.2DGraphLib.MonoTouch,代码行数:27,代码来源:DateTimeAxisExamples.cs

示例2: Main

        /// <summary>
        /// Defines the entry point of the application.
        /// </summary>
        private static void Main()
        {
            Application.Init();

            var window = new Window("GtkSharpDemo");
            var plotModel = new PlotModel
                         {
                             Title = "Trigonometric functions",
                             Subtitle = "Example using the FunctionSeries",
                             PlotType = PlotType.Cartesian,
                             Background = OxyColors.White
                         };
            plotModel.Series.Add(new FunctionSeries(Math.Sin, -10, 10, 0.1, "sin(x)") { Color = OxyColors.Black });
            plotModel.Series.Add(new FunctionSeries(Math.Cos, -10, 10, 0.1, "cos(x)") { Color = OxyColors.Green });
            plotModel.Series.Add(new FunctionSeries(t => 5 * Math.Cos(t), t => 5 * Math.Sin(t), 0, 2 * Math.PI, 0.1, "cos(t),sin(t)") { Color = OxyColors.Yellow });
            
            var plotView = new OxyPlot.GtkSharp.PlotView { Model = plotModel };
            plotView.SetSizeRequest(400, 400);
            plotView.Visible = true;

            window.SetSizeRequest(600, 600);
            window.Add(plotView);
            window.Focus = plotView;
            window.Show();
            window.DeleteEvent += (s, a) =>
                {
                    Application.Quit();
                    a.RetVal = true;
                };

            Application.Run();
        }
开发者ID:Celderon,项目名称:oxyplot,代码行数:35,代码来源:Program.cs

示例3: MainWindow

        public MainWindow()
        {
            this.InitializeComponent();

            // Create some data
            this.Items = new Collection<Item>
                            {
                                new Item {Label = "Apples", Value1 = 37, Value2 = 12, Value3 = 19},
                                new Item {Label = "Pears", Value1 = 7, Value2 = 21, Value3 = 9},
                                new Item {Label = "Bananas", Value1 = 23, Value2 = 2, Value3 = 29}
                            };

            // Create the plot model
            var tmp = new PlotModel("Column series") { LegendPlacement = LegendPlacement.Outside, LegendPosition = LegendPosition.RightTop, LegendOrientation = LegendOrientation.Vertical };

            // Add the axes, note that MinimumPadding and AbsoluteMinimum should be set on the value axis.
            tmp.Axes.Add(new CategoryAxis { ItemsSource = this.Items, LabelField = "Label" });
            tmp.Axes.Add(new LinearAxis(AxisPosition.Left) { MinimumPadding = 0, AbsoluteMinimum = 0 });

            // Add the series, note that the the BarSeries are using the same ItemsSource as the CategoryAxis.
            tmp.Series.Add(new ColumnSeries { Title = "2009", ItemsSource = this.Items, ValueField = "Value1" });
            tmp.Series.Add(new ColumnSeries { Title = "2010", ItemsSource = this.Items, ValueField = "Value2" });
            tmp.Series.Add(new ColumnSeries { Title = "2011", ItemsSource = this.Items, ValueField = "Value3" });

            this.Model1 = tmp;

            this.DataContext = this;
        }
开发者ID:aleksanderkobylak,项目名称:oxyplot,代码行数:28,代码来源:MainWindow.xaml.cs

示例4: PolarGraphWindow

        public PolarGraphWindow()
        {
            InitializeComponent();
            GraphModel = new PlotModel();
            chartCanvas.InvalidatePlot();
            //GraphModel.PlotType = PlotType.Cartesian;
            GraphModel.PlotMargins = new OxyThickness(60, 20, 4, 40);
            GraphModel.Axes.Add(new LinearAxis
            {
                MajorGridlineStyle = LineStyle.Solid,
                MinorGridlineStyle = LineStyle.Solid,
                Position = AxisPosition.Left,
                MinorTickSize = 0,
                //Minimum = -5,
                //Maximum = 5,
                //Unit = "rad",

                Title = "θ"
            });
            GraphModel.Axes.Add(new LinearAxis
            {
                MajorGridlineStyle = LineStyle.Solid,
                MinorGridlineStyle = LineStyle.Solid,
                Position = AxisPosition.Bottom,
                MinorTickSize = 0,
                //Minimum = -12,
                //Maximum = 12,
                Title = "ρ"
            });


            txtOperation.ItemsSource = Funcs;
        }
开发者ID:zdimension,项目名称:IMPression,代码行数:33,代码来源:PolarGraphWindow.xaml.cs

示例5: AddActiveSeries

 private void AddActiveSeries(PlotModel model)
 {
     foreach (var series in seriesManager.GetActive())
     {
         model.Series.Add(series);
     }
 }
开发者ID:romannort,项目名称:Dsp,代码行数:7,代码来源:MainWindow.xaml.cs

示例6: RangeColorAxis

        private static PlotModel RangeColorAxis(AxisPosition position)
        {
            int n = 1000;
            var model = new PlotModel
            {
                Title = string.Format("ScatterSeries and RangeColorAxis (n={0})", n),
                Background = OxyColors.LightGray
            };

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

            var rca = new RangeColorAxis { Position = position, Maximum = 2, Minimum = -2 };
            rca.AddRange(0, 0.5, OxyColors.Blue);
            rca.AddRange(-0.2, -0.1, OxyColors.Red);
            model.Axes.Add(rca);

            var s1 = new ScatterSeries { MarkerType = MarkerType.Square, MarkerSize = 6, };

            var random = new Random(13);
            for (int i = 0; i < n; i++)
            {
                double x = (random.NextDouble() * 2.2) - 1.1;
                s1.Points.Add(new ScatterPoint(x, random.NextDouble()) { Value = x });
            }

            model.Series.Add(s1);
            return model;
        }
开发者ID:huoxudong125,项目名称:oxyplot,代码行数:29,代码来源:RangeColorAxisExamples.cs

示例7: DontShowMinorTicks

 public static PlotModel DontShowMinorTicks()
 {
     var model = new PlotModel { Title = "MinorTickSize = 0" };
     model.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom, MinorTickSize = 0, MajorGridlineStyle = LineStyle.Solid, MinorGridlineStyle = LineStyle.Solid });
     model.Axes.Add(new LinearAxis { Position = AxisPosition.Left, MinorTickSize = 0, MajorGridlineStyle = LineStyle.Solid, MinorGridlineStyle = LineStyle.Solid });
     return model;
 }
开发者ID:Celderon,项目名称:oxyplot,代码行数:7,代码来源:Issues.cs

示例8: BarSeries

        public static PlotModel BarSeries()
        {
            var model = new PlotModel
                            {
                                Title = "BarSeries",
                                LegendPlacement = LegendPlacement.Outside,
                                LegendPosition = LegendPosition.BottomCenter,
                                LegendOrientation = LegendOrientation.Horizontal,
                                LegendBorderThickness = 0
                            };

            var s1 = new BarSeries { Title = "Series 1", StrokeColor = OxyColors.Black, StrokeThickness = 1 };
            s1.Items.Add(new BarItem { Value = 25 });
            s1.Items.Add(new BarItem { Value = 137 });
            s1.Items.Add(new BarItem { Value = 18 });
            s1.Items.Add(new BarItem { Value = 40 });

            var s2 = new BarSeries { Title = "Series 2", StrokeColor = OxyColors.Black, StrokeThickness = 1 };
            s2.Items.Add(new BarItem { Value = 12 });
            s2.Items.Add(new BarItem { Value = 14 });
            s2.Items.Add(new BarItem { Value = 120 });
            s2.Items.Add(new BarItem { Value = 26 });

            var categoryAxis = new CategoryAxis { Position = AxisPosition.Left };
            categoryAxis.Labels.Add("Category A");
            categoryAxis.Labels.Add("Category B");
            categoryAxis.Labels.Add("Category C");
            categoryAxis.Labels.Add("Category D");
            var valueAxis = new LinearAxis { Position = AxisPosition.Bottom, MinimumPadding = 0, MaximumPadding = 0.06, AbsoluteMinimum = 0 };
            model.Series.Add(s1);
            model.Series.Add(s2);
            model.Axes.Add(categoryAxis);
            model.Axes.Add(valueAxis);
            return model;
        }
开发者ID:3r1k0n,项目名称:documentation-examples,代码行数:35,代码来源:BarSeriesExamples.cs

示例9: Window1

 public Window1()
 {
     InitializeComponent();
     DataContext = this;
     Model = new PlotModel("Test 1");
     Model.Series.Add(new FunctionSeries(Math.Cos, 0, 10, 0.01));
 }
开发者ID:aleksanderkobylak,项目名称:oxyplot,代码行数:7,代码来源:Window1.xaml.cs

示例10: Graph1

 public static PlotModel Graph1()
 {
     var pm = new PlotModel { Title = "Q1 2003 Calls by Region", PlotAreaBorderThickness = new OxyThickness(0) };
     var categoryAxis = new CategoryAxis
             {
                 AxislineStyle = LineStyle.Solid,
                 TickStyle = TickStyle.None
             };
     categoryAxis.Labels.AddRange(new[] { "North", "East", "South", "West" });
     pm.Axes.Add(categoryAxis);
     pm.Axes.Add(
         new LinearAxis
         {
             Position = AxisPosition.Left,
             Minimum = 0,
             Maximum = 6000,
             MajorStep = 1000,
             MinorStep = 1000,
             AxislineStyle = LineStyle.Solid,
             TickStyle = TickStyle.Outside,
             StringFormat = "#,0"
         });
     var series = new ColumnSeries { FillColor = OxyColors.Black };
     series.Items.Add(new ColumnItem { Value = 3000 });
     series.Items.Add(new ColumnItem { Value = 4500 });
     series.Items.Add(new ColumnItem { Value = 2100 });
     series.Items.Add(new ColumnItem { Value = 4800 });
     pm.Series.Add(series);
     return pm;
 }
开发者ID:Cheesebaron,项目名称:oxyplot,代码行数:30,代码来源:ShowMeTheNumbersExamples.cs

示例11: TitleAndSubtitle

 public static PlotModel TitleAndSubtitle()
 {
     var model = new PlotModel { Title = "Title", Subtitle = "Subtitle" };
     model.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom });
     model.Axes.Add(new LinearAxis { Position = AxisPosition.Left });
     return model;
 }
开发者ID:benjaminrupp,项目名称:oxyplot,代码行数:7,代码来源:PlotModelExamples.cs

示例12: SetUpModel

 public void SetUpModel(PlotModel PlotModel, int fanObjectId, string Title = "", string SubTitle = "")
 {
     PlotModel.Title = Title + fanObjectId;
     PlotModel.SubtitleColor = OxyColors.LightGreen;
     PlotModel.Subtitle = SubTitle;
     PlotModel.LegendTitle = "Легенда";
     PlotModel.LegendOrientation = LegendOrientation.Horizontal;
     PlotModel.LegendPlacement = LegendPlacement.Outside;
     PlotModel.LegendPosition = LegendPosition.TopRight;
     PlotModel.LegendBackground = OxyColor.FromAColor(200, OxyColors.White);
     PlotModel.LegendBorder = OxyColors.Black;
     PlotModel.MouseDown += (s, e) =>
     {
         try
         {
             if (e.IsControlDown)
             {
                 DataPoint date = (DataPoint)e.HitTestResult.Item;
                 IoC.Resolve<MainVm>().CurrentView =
                     IoC.Resolve<OnPlotClickVm>(new ConstructorArgument("fanObjectId", fanObjectId),
                                                new ConstructorArgument("date",
                                                                        DateTimeAxis.ToDateTime(date.X)),
                                                new ConstructorArgument("prevView",
                                                                        IoC.Resolve<MainVm>().CurrentView));
             }
         }
         catch (Exception)
         {
             return;
         }
     };
 }
开发者ID:sbondini,项目名称:MineClient,代码行数:32,代码来源:PlotService.cs

示例13: MainWindow

        public MainWindow()
        {
            this.InitializeComponent();

            // http://www.nationsonline.org/oneworld/world_population.htm
            // http://en.wikipedia.org/wiki/Continent

            var plotModel = new PlotModel { Title = "World population by continent" };
            var pieSeries = new PieSeries();
            pieSeries.Slices.Add(new PieSlice("Africa", 1030) { IsExploded = true });
            pieSeries.Slices.Add(new PieSlice("Americas", 929) { IsExploded = true });
            pieSeries.Slices.Add(new PieSlice("Asia", 4157));
            pieSeries.Slices.Add(new PieSlice("Europe", 739) { IsExploded = true });
            pieSeries.Slices.Add(new PieSlice("Oceania", 35) { IsExploded = true });
            pieSeries.InnerDiameter = 0.2;
            pieSeries.ExplodedDistance = 0;
            pieSeries.Stroke = OxyColors.Black;
            pieSeries.StrokeThickness = 1.0;
            pieSeries.AngleSpan = 360;
            pieSeries.StartAngle = 0;
            plotModel.Series.Add(pieSeries);

            this.PieModel = plotModel;
            this.DataContext = this;
        }
开发者ID:benjaminrupp,项目名称:oxyplot,代码行数:25,代码来源:MainWindow.xaml.cs

示例14: TimeSpanaxisPlotModel

        public static PlotModel TimeSpanaxisPlotModel()
        {
            var start = new TimeSpan(0, 0, 0, 0);
            var end = new TimeSpan(0, 24, 0, 0);
            double increment = 3600;

            // Create a random data collection
            var r = new Random(7);
            var data = new Collection<TimeValue>();
            var current = start;
            while (current <= end)
            {
                data.Add(new TimeValue { Time = current, Value = r.NextDouble() });
                current = current.Add(new TimeSpan(0, 0, (int)increment));
            }

            var plotModel1 = new PlotModel { Title = "TimeSpan axis" };
            var timeSpanAxis1 = new TimeSpanAxis { Position = AxisPosition.Bottom, StringFormat = "h:mm" };
            plotModel1.Axes.Add(timeSpanAxis1);
            var linearAxis1 = new LinearAxis { Position = AxisPosition.Left };
            plotModel1.Axes.Add(linearAxis1);
            var lineSeries1 = new LineSeries
            {
                Color = OxyColor.FromArgb(255, 78, 154, 6),
                MarkerFill = OxyColor.FromArgb(255, 78, 154, 6),
                MarkerStroke = OxyColors.ForestGreen,
                MarkerType = MarkerType.Plus,
                StrokeThickness = 1,
                DataFieldX = "Time",
                DataFieldY = "Value",
                ItemsSource = data
            };
            plotModel1.Series.Add(lineSeries1);
            return plotModel1;
        }
开发者ID:Celderon,项目名称:oxyplot,代码行数:35,代码来源:TimeSpanAxisExamples.cs

示例15: LinearAxis

 public static PlotModel LinearAxis()
 {
     var model = new PlotModel { Title = "LinearAxis" };
     model.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom, Minimum = -1, Maximum = 1 });
     model.Axes.Add(new LinearAxis { Position = AxisPosition.Left, Minimum = -10, Maximum = 10 });
     return model;
 }
开发者ID:3r1k0n,项目名称:documentation-examples,代码行数:7,代码来源:LinearAxisExamples.cs


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