// [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;
        }
示例#2
1
        /// <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();
        }
示例#3
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="thePlot"></param>
 /// <param name="writeDebug"></param>
 /// <param name="dataSource"></param>
 /// <remarks></remarks>
 public clsPlotContainer(
     OxyPlot.PlotModel thePlot,
     bool writeDebug = false, string dataSource = "") : base(writeDebug, dataSource)
 {
     Plot         = thePlot;
     FontSizeBase = DEFAULT_BASE_FONT_SIZE;
 }
示例#4
0
 public static PlotModel TitlePadding0()
 {
     var model = new PlotModel { Title = "TitlePadding = 0", Subtitle = "This controls the distance between the titles and the plot area. The default value is 6", TitlePadding = 0 };
     model.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom });
     model.Axes.Add(new LinearAxis { Position = AxisPosition.Left });
     return model;
 }
示例#5
0
        public PlotViewModel(Models.PlotModel plotModel)
        {
            _uiVisualizerService = ServiceLocator.Default.ResolveType <IUIVisualizerService>();
            _logService          = ServiceLocator.Default.ResolveType <ILoggingService>();
            _kserv       = ServiceLocator.Default.ResolveType <IKmotionService>();
            _plotService = ServiceLocator.Default.ResolveType <IAvailablePlotsService>();
            Messages     = new List <string[]>(1024);
            _dataLog     = new List <string[]>(20000);

            OxyPlotModel = new OxyPlot.PlotModel();
            PlotModel    = plotModel;

            StartStopCommand = new TaskCommand <bool>(OnStartStopCommandExecuteAsync, OnStartStopCommandCanExecute);
            Clear            = new TaskCommand(OnClearExecute);
            ZeroCommand      = new TaskCommand(OnZeroCommandExecuteAsync, OnZeroCommandCanExecute);
            SaveCommand      = new TaskCommand(OnSaveCommandExecuteAsync, OnSaveCommandCanExecute);
            LoadCommand      = new TaskCommand(OnLoadCommandExecuteAsync, OnLoadCommandCanExecute);
            ConfigCommand    = new TaskCommand(OnConfigCommandExecuteAsync, OnConfigCommandCanExecute);
            ExportPngCommand = new TaskCommand(OnExportPngCommandExecute);

            // this instance is created on the UI thread
            //_context = SynchronizationContext.Current;

            _userInterfaceDispatcher = Dispatcher.CurrentDispatcher;
            _cancelSource            = new CancellationTokenSource();

            //syncing plots
            _plotService.AvailablePlots.Add(OxyPlotModel);

            //messages strings or hex dump of memory
            FromHex = false;
        }
示例#6
0
 /// <summary>
 /// Creates the model.
 /// </summary>
 /// <returns>A PlotModel.</returns>
 private PlotModel CreateModel()
 {
     var model = new PlotModel
     {
         Title = "Polar plot",
         Subtitle = "Archimedean spiral with equation r(θ) = θ for 0 < θ < 6π",
         PlotType = PlotType.Polar,
         PlotMargins = new OxyThickness(20, 20, 4, 40),
         PlotAreaBorderThickness = new OxyThickness(0)
     };
     model.Axes.Add(
         new AngleAxis
         {
             Minimum = 0,
             Maximum = this.MaxAngle,
             MajorStep = this.MajorStep,
             MinorStep = this.MinorStep,
             FormatAsFractions = true,
             FractionUnit = Math.PI,
             FractionUnitSymbol = "π"
         });
     model.Axes.Add(new MagnitudeAxis());
     model.Series.Add(new FunctionSeries(t => t, t => t, 0, Math.PI * 6, 0.01));
     return model;
 }
示例#7
0
        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;
        }
示例#8
0
 public Model() 
 {
    plotModel = SetUpModel();
    plotModel.KeyDown += plotModel_KeyDown;
    timer.Elapsed += timer_Elapsed;
    timer.Start();
 }
示例#9
0
 public static PlotModel TitlesCenteredWithinView()
 {
     var model = new PlotModel { Title = "Title", Subtitle = "Subtitle", TitleHorizontalAlignment = TitleHorizontalAlignment.CenteredWithinView };
     model.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom });
     model.Axes.Add(new LinearAxis { Position = AxisPosition.Left });
     return model;
 }
        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;
        }
        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;
        }
示例#12
0
 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;
         }
     };
 }
示例#13
0
        public CStepRespPlot(PlotView _plotBodeMag)
        {
            m_plotBodeMag = _plotBodeMag;
            // Mag
            m_plotBodeMag.Dock                 = System.Windows.Forms.DockStyle.Bottom;
            m_plotBodeMag.Location             = new System.Drawing.Point(0, 0);
            m_plotBodeMag.Name                 = "StepRespPlot";
            m_plotBodeMag.PanCursor            = System.Windows.Forms.Cursors.Hand;
            m_plotBodeMag.Size                 = new System.Drawing.Size(200, 120);
            m_plotBodeMag.TabIndex             = 0;
            m_plotBodeMag.Text                 = "StepRespPlot";
            m_plotBodeMag.ZoomHorizontalCursor = System.Windows.Forms.Cursors.SizeWE;
            m_plotBodeMag.ZoomRectangleCursor  = System.Windows.Forms.Cursors.SizeNWSE;
            m_plotBodeMag.ZoomVerticalCursor   = System.Windows.Forms.Cursors.SizeNS;

            m_PlotModelBodeMag       = new OxyPlot.PlotModel();
            m_PlotModelBodeMag.Title = "Step Response";

            m_PlotModelBodeMag.Axes.Add(new LinearAxis {
                Position = AxisPosition.Bottom, Maximum = 0, Minimum = 1e-3
            });                                                                                                         //X
            m_PlotModelBodeMag.Axes.Add(new LinearAxis {
                Position = AxisPosition.Left, Maximum = 5, Minimum = -5
            });                                                                                                     //Y

            seriesBodeMag            = new LineSeries();
            seriesBodeMag.Title      = "(output)";// legend
            seriesBodeMag.MarkerType = MarkerType.None;
            seriesBodeMag.Points.Add(new DataPoint(0, 0));
            seriesBodeMag.Points.Add(new DataPoint(1, 10));
            seriesBodeMag.Background = OxyColors.White;

            m_PlotModelBodeMag.Series.Add(seriesBodeMag);
        }
        /// <summary>
        /// Construct a new instance of the class.
        /// </summary>
        /// <param name="title">The plot title.</param>
        /// <param name="results">The data to plot.</param>
        public Plot(string title, List <List <double> > results)
        {
            // set up plot model
            var plotModel = new OxyPlot.PlotModel();

            plotModel.Title = title;

            // set up axes and colors
            plotModel.Axes.Add(new OxyPlot.Axes.LinearAxis()
            {
                Position = OxyPlot.Axes.AxisPosition.Left, Title = "Error"
            });
            plotModel.Axes.Add(new OxyPlot.Axes.LinearAxis()
            {
                Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "Epochs"
            });
            var colors = new OxyPlot.OxyColor[] { OxyPlot.OxyColors.Blue, OxyPlot.OxyColors.Green, OxyPlot.OxyColors.Red, OxyPlot.OxyColors.Black };

            // set up lines
            for (int i = 0; i < results.Count; i++)
            {
                var lineSeries = new OxyPlot.Series.LineSeries();
                lineSeries.ItemsSource = results[i].Select((value, index) => new OxyPlot.DataPoint(index, value));
                lineSeries.Title       = string.Format("KFold {0}/{1}", i + 1, results.Count);
                //lineSeries.Color = colors[i];
                plotModel.Series.Add(lineSeries);
            }

            var plotView = new OxyPlot.Wpf.PlotView();

            plotView.Model = plotModel;

            Title   = title;
            Content = plotView;
        }
示例#15
0
 public static PlotModel PlotMargins()
 {
     var model = new PlotModel { Title = "PlotMargins = (100,20,100,50)", PlotMargins = new OxyThickness(100, 20, 100, 50) };
     model.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom });
     model.Axes.Add(new LinearAxis { Position = AxisPosition.Left });
     return model;
 }
        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;
        }
示例#17
0
 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;
 }
示例#18
0
 public static PlotModel TitlePadding100()
 {
     var model = new PlotModel { Title = "TitlePadding = 100", TitlePadding = 100 };
     model.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom });
     model.Axes.Add(new LinearAxis { Position = AxisPosition.Left });
     return model;
 }
示例#19
0
 private void AddActiveSeries(PlotModel model)
 {
     foreach (var series in seriesManager.GetActive())
     {
         model.Series.Add(series);
     }
 }
示例#20
0
        private PlotModel CreateModel(DateTime start, DateTime end, double increment)
        {
            var tmp = new PlotModel { Title = "DateTime axis (PlotModel)" };
            tmp.Axes.Add(new DateTimeAxis { Position = AxisPosition.Bottom });
            tmp.Axes.Add(new LinearAxis { Position = AxisPosition.Left });

            // Create a random data collection
            var r = new Random(13);
            this.Data = new Collection<DateValue>();
            var date = start;
            while (date <= end)
            {
                this.Data.Add(new DateValue { Date = date, Value = r.NextDouble() });
                date = date.AddSeconds(increment);
            }

            // Create a line series
            var s1 = new LineSeries
                         {
                             StrokeThickness = 1,
                             MarkerSize = 3,
                             ItemsSource = this.Data,
                             DataFieldX = "Date",
                             DataFieldY = "Value",
                             MarkerStroke = OxyColors.ForestGreen,
                             MarkerType = MarkerType.Plus
                         };

            tmp.Series.Add(s1);
            return tmp;
        }
示例#21
0
 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;
 }
        /// <summary>
        /// Creates a model showing normal distributions.
        /// </summary>
        /// <returns>A PlotModel.</returns>
        private static PlotModel CreateNormalDistributionModel()
        {
            // http://en.wikipedia.org/wiki/Normal_distribution
            var plot = new PlotModel
            {
                Title = "Normal distribution",
                Subtitle = "Probability density function"
            };

            plot.Axes.Add(new LinearAxis
            {
                Position = AxisPosition.Left,
                Minimum = -0.05,
                Maximum = 1.05,
                MajorStep = 0.2,
                MinorStep = 0.05,
                TickStyle = TickStyle.Inside
            });
            plot.Axes.Add(new LinearAxis
            {
                Position = AxisPosition.Bottom,
                Minimum = -5.25,
                Maximum = 5.25,
                MajorStep = 1,
                MinorStep = 0.25,
                TickStyle = TickStyle.Inside
            });
            plot.Series.Add(CreateNormalDistributionSeries(-5, 5, 0, 0.2));
            plot.Series.Add(CreateNormalDistributionSeries(-5, 5, 0, 1));
            plot.Series.Add(CreateNormalDistributionSeries(-5, 5, 0, 5));
            plot.Series.Add(CreateNormalDistributionSeries(-5, 5, -2, 0.5));
            return plot;
        }
        public static Example LargeDataSetNarrow()
        {
            var pm = new PlotModel { Title = "Large Data Set (narrow window)" };

            var timeSpanAxis1 = new DateTimeAxis { Position = AxisPosition.Bottom };
            pm.Axes.Add(timeSpanAxis1);
            var linearAxis1 = new LinearAxis { Position = AxisPosition.Left };
            pm.Axes.Add(linearAxis1);
            var n = 1000000;
            var items = HighLowItemGenerator.MRProcess(n).ToArray();
            var series = new CandleStickSeries
                             {
                                 Color = OxyColors.Black,
                                 IncreasingColor = OxyColors.DarkGreen,
                                 DecreasingColor = OxyColors.Red,
                                 TrackerFormatString =
                                     "High: {2:0.00}\nLow: {3:0.00}\nOpen: {4:0.00}\nClose: {5:0.00}",
                                 ItemsSource = items
                             };

            timeSpanAxis1.Minimum = items[0].X;
            timeSpanAxis1.Maximum = items[29].X;

            linearAxis1.Minimum = items.Take(30).Select(x => x.Low).Min();
            linearAxis1.Maximum = items.Take(30).Select(x => x.High).Max();

            pm.Series.Add(series);

            timeSpanAxis1.AxisChanged += (sender, e) => AdjustYExtent(series, timeSpanAxis1, linearAxis1);

            var controller = new PlotController();
            controller.UnbindAll();
            controller.BindMouseDown(OxyMouseButton.Left, PlotCommands.PanAt);
            return new Example(pm, controller);
        }
示例#24
0
 public static PlotModel GridLinesBothDifferentColors()
 {
     var plotModel1 = new PlotModel
     {
         Title = "Major grid lines in front of minor",
         Subtitle = "Minor grid lines should be below major grid lines"
     };
     var leftAxis = new LinearAxis
     {
         MajorGridlineStyle = LineStyle.Solid,
         MajorGridlineColor = OxyColors.Black,
         MajorGridlineThickness = 4,
         MinorGridlineStyle = LineStyle.Solid,
         MinorGridlineColor = OxyColors.LightBlue,
         MinorGridlineThickness = 4,
     };
     plotModel1.Axes.Add(leftAxis);
     var bottomAxis = new LinearAxis
     {
         Position = AxisPosition.Bottom,
         MajorGridlineStyle = LineStyle.Solid,
         MajorGridlineColor = OxyColors.Black,
         MajorGridlineThickness = 4,
         MinorGridlineStyle = LineStyle.Solid,
         MinorGridlineColor = OxyColors.LightBlue,
         MinorGridlineThickness = 4,
     };
     plotModel1.Axes.Add(bottomAxis);
     return plotModel1;
 }
        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;
        }
示例#26
0
        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;
        }
示例#27
0
 public Window1()
 {
     InitializeComponent();
     DataContext = this;
     Model = new PlotModel("Test 1");
     Model.Series.Add(new FunctionSeries(Math.Cos, 0, 10, 0.01));
 }
 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;
 }
示例#29
0
 public static PlotModel CustomArrowAxis()
 {
     var model = new PlotModel { PlotAreaBorderThickness = new OxyThickness(0), PlotMargins = new OxyThickness(60, 60, 60, 60) };
     model.Axes.Add(new ArrowAxis { Position = AxisPosition.Bottom, AxislineStyle = LineStyle.Solid });
     model.Axes.Add(new ArrowAxis { Position = AxisPosition.Left, AxislineStyle = LineStyle.Solid });
     return model;
 }
        public static PlotModel IntervalBarSeries()
        {
            var model = new PlotModel { Title = "IntervalBarSeries", LegendPlacement = LegendPlacement.Outside };

            var s1 = new IntervalBarSeries { Title = "IntervalBarSeries 1" };
            s1.Items.Add(new IntervalBarItem { Start = 6, End = 8 });
            s1.Items.Add(new IntervalBarItem { Start = 4, End = 8 });
            s1.Items.Add(new IntervalBarItem { Start = 5, End = 11 });
            s1.Items.Add(new IntervalBarItem { Start = 4, End = 12 });
            model.Series.Add(s1);
            var s2 = new IntervalBarSeries { Title = "IntervalBarSeries 2" };
            s2.Items.Add(new IntervalBarItem { Start = 8, End = 9 });
            s2.Items.Add(new IntervalBarItem { Start = 8, End = 10 });
            s2.Items.Add(new IntervalBarItem { Start = 11, End = 12 });
            s2.Items.Add(new IntervalBarItem { Start = 12, End = 12.5 });
            model.Series.Add(s2);

            var categoryAxis = new CategoryAxis { Position = AxisPosition.Left };
            categoryAxis.Labels.Add("Activity A");
            categoryAxis.Labels.Add("Activity B");
            categoryAxis.Labels.Add("Activity C");
            categoryAxis.Labels.Add("Activity D");
            var valueAxis = new LinearAxis { Position = AxisPosition.Bottom, MinimumPadding = 0.1, MaximumPadding = 0.1 };
            model.Axes.Add(categoryAxis);
            model.Axes.Add(valueAxis);
            return model;
        }
 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;
 }
示例#32
0
        public MainWindow(List<double> trainErrors, List<double> cvErrors) : this()
        {
            _model = new PlotModel("ANN errors") { LegendSymbolLength = 24 };
            var s1 = new LineSeries("train error")
            {
                Color = OxyColors.SkyBlue,
                MarkerType = MarkerType.Circle,
                MarkerSize = 6,
                MarkerStroke = OxyColors.White,
                MarkerFill = OxyColors.SkyBlue,
                MarkerStrokeThickness = 1.5
            };
            for (int i = 0; i < trainErrors.Count; i++)
                s1.Points.Add(new DataPoint(i * 10000, trainErrors[i]));
            _model.Series.Add(s1);

            var s2 = new LineSeries("cv error")
            {
                Color = OxyColors.Teal,
                MarkerType = MarkerType.Diamond,
                MarkerSize = 6,
                MarkerStroke = OxyColors.White,
                MarkerFill = OxyColors.Teal,
                MarkerStrokeThickness = 1.5
            };
            for (int i = 0; i < cvErrors.Count; i++)
                s2.Points.Add(new DataPoint(i * 10000, cvErrors[i]));
            _model.Series.Add(s2);
            this.DataContext = _model;
        }
示例#33
0
 private void FillGraph(OxyPlot.PlotModel plotModel)
 {
     foreach (MatchPair matchPair in matchPairs)
     {
         AddGraphLine(plotModel, matchPair);
     }
 }
示例#34
0
 public static PlotModel BackgroundUndefined()
 {
     var model = new PlotModel { Title = "Background = Undefined", Background = OxyColors.Undefined };
     model.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom });
     model.Axes.Add(new LinearAxis { Position = AxisPosition.Left });
     return model;
 }
示例#35
0
        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;
        }
示例#36
0
        public override void Render(OxyPlot.IRenderContext rc, OxyPlot.PlotModel model, AxisLayer axisLayer, int pass)
        {
            base.Render(rc, model, axisLayer, pass);
            if (model.Series.Count == 0)
            {
                return;
            }

            var      field = rc.GetType().GetField("g", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
            object   o     = field.GetValue(rc);
            Graphics g     = (Graphics)o;



            LineSeries series = model.Series.First(s => { if (s is LineSeries)
                                                          {
                                                              return(true);
                                                          }
                                                          else
                                                          {
                                                              return(false);
                                                          } }) as LineSeries;

            for (int i = 0; i < series.Points.Count; i++)
            {
                ScreenPoint sp  = series.Transform(series.Points[i]);
                int         key = (int)series.Points[i].X;
                if (IsCloudVisble && Cloud.Count > 0 && (Cloud[key]) != "9999")
                {
                    if (Cloud[key] != null)
                    {
                        using (Font f = new System.Drawing.Font(_PrivateFontCollection.Families[1], 12F))
                        {
                            float x = (float)sp.X;
                            float y = (float)model.Height - 50;
                            DrawText(g, new ScreenPoint(x, y), Cloud[key],
                                     OxyColor.FromRgb(CloudColor.R, CloudColor.G, CloudColor.B), f, 0F,
                                     HorizontalAlignment.Center, VerticalAlignment.Middle);
                        }
                    }
                }

                if (IsWindVisible && WindSpeeds.Count > 0 && (WindSpeeds[key]) != "9999" /* && (WindSpeeds[key]) != "0"*/)
                {
                    if (WindDirs[key] != null)
                    {
                        using (Font f = new System.Drawing.Font(_PrivateFontCollection.Families[0], 30F))
                        {
                            float x = (float)sp.X;
                            float y = (float)model.Height - 50;
                            DrawText(g, new ScreenPoint(x, y), WindSpeeds[key],
                                     OxyColor.FromRgb(WindColor.R, WindColor.G, WindColor.B), f, float.Parse(WindDirs[key]),
                                     HorizontalAlignment.Left, VerticalAlignment.Bottom, -15, 15);
                        }
                    }
                }
            }
        }
示例#37
0
        /*public static OxyPlot.PlotModel ZeroCrossing()
         * {
         *  var plotmodel = new OxyPlot.PlotModel();
         *  plotmodel.PlotAreaBorderThickness = new OxyPlot.OxyThickness(0.0);
         *  plotmodel.PlotMargins = new OxyPlot.OxyThickness(10);
         *  var linearAxis = new OxyPlot.Axes.LinearAxis();
         *  linearAxis.Maximum = 40;
         *  linearAxis.Minimum = -40;
         *  linearAxis.PositionAtZeroCrossing = true;
         *  linearAxis.TickStyle = OxyPlot.Axes.TickStyle.Crossing;
         *  plotmodel.Axes.Add(linearAxis);
         *  var secondLinearAxis = new OxyPlot.Axes.LinearAxis();
         *  secondLinearAxis.Maximum = 40;
         *  secondLinearAxis.Minimum = -40;
         *  secondLinearAxis.PositionAtZeroCrossing = true;
         *  secondLinearAxis.TickStyle = OxyPlot.Axes.TickStyle.Crossing;
         *  secondLinearAxis.Position = OxyPlot.Axes.AxisPosition.Bottom;
         *  plotmodel.Axes.Add(secondLinearAxis);
         *  return plotmodel;
         * }*/

        public static OxyPlot.PlotModel ZeroCrossing()
        {
            var plotmodel = new OxyPlot.PlotModel();

            plotmodel.Title = "Progress";
            var linearAxis1 = new OxyPlot.Axes.LinearAxis();

            linearAxis1.MajorGridlineStyle = OxyPlot.LineStyle.Solid;
            linearAxis1.MinorGridlineStyle = OxyPlot.LineStyle.Dot;
            plotmodel.Axes.Add(linearAxis1);
            var linearAxis2 = new OxyPlot.Axes.LinearAxis();

            linearAxis2.Position = OxyPlot.Axes.AxisPosition.Bottom;
            plotmodel.Axes.Add(linearAxis2);

            /*var startDate = DateTime.Now.AddDays(-10);
             * var endDate = DateTime.Now;
             *
             * var minVal = Convert.ToDouble(startDate);
             * var maxVal = Convert.ToDouble(endDate);
             *
             *
             *
             * var DateAxis = new DateTimeAxis {Position = OxyPlot.Axes.AxisPosition.Bottom, Minimum = minVal, Maximum = maxVal , StringFormat = "dd" };
             *
             *
             *
             *
             * plotmodel.Axes.Add(DateAxis);
             *  /*OxyPlot.Axes.Position = OxyPlot.AxisPosition.Bottom,
             *  Minimum = minValue,
             *  Maximum = maxValue,*/


            var series1 = new OxyPlot.Series.LineSeries
            {
                MarkerType   = MarkerType.Circle,
                MarkerSize   = 5,
                MarkerStroke = OxyColors.White
            };

            series1.Points.Add(new DataPoint(0.3, 6.4));
            series1.Points.Add(new DataPoint(1.6, 2.7));
            series1.Points.Add(new DataPoint(2.0, 4.6));
            series1.Points.Add(new DataPoint(3.1, 2.3));
            series1.Points.Add(new DataPoint(4.5, 7.5));
            series1.Points.Add(new DataPoint(6.7, 6.1));
            series1.Points.Add(new DataPoint(8.4, 8.9));

            plotmodel.Series.Add(series1);

            return(plotmodel);
        }
示例#38
0
        private void AddGraphLine(OxyPlot.PlotModel plotModel, MatchPair matchPair)
        {
            var lineSeries = new LineSeries();

            lineSeries.Title = matchPair.Track1.Name + " <-> " + matchPair.Track2.Name;
            lineSeries.TrackerFormatString = "{0}\n{1}: {2}\n{3}: {4}"; // bugfix https://github.com/oxyplot/oxyplot/issues/265
            matchPair.Matches.OrderBy(match => match.Track1Time).ToList()
            .ForEach(match => lineSeries.Points.Add(new DataPoint(
                                                        DateTimeAxis.ToDouble(match.Track1.Offset + match.Track1Time),
                                                        DateTimeAxis.ToDouble((match.Track1.Offset + match.Track1Time) - (match.Track2.Offset + match.Track2Time)))));
            plotModel.Series.Add(lineSeries);
        }
示例#39
0
            public void PodajDaneDoWykresu2(List <double> X, List <List <double> > Y, List <Process> procesy)//Lista X i Y podana jako parametr metody
            {
                this.PlotModel = new OxyPlot.PlotModel();
                //Usunięcie ustawionych parametrów z poprzedniego uruchomienia metody
                plotModel.Series = new System.Collections.ObjectModel.Collection <OxyPlot.Series.Series> {
                };
                punktySeriiTab   = new OxyPlot.Series.LineSeries[Y.Count()];//Ile jest List w zmiennej Y
                plotModel.Axes   = new System.Collections.ObjectModel.Collection <OxyPlot.Axes.Axis> {
                };
                Random random = new Random();

                //Graficzne ustawienia wykresów
                for (int n = 0; n < Y.Count(); n++)
                {
                    punktySeriiTab[n] = new OxyPlot.Series.LineSeries
                    {
                        MarkerType   = ksztaltPunktowWykresu[n % 5],                                             //oznaczenie punktów
                        MarkerSize   = 4,                                                                        //wielkość punktów
                        MarkerStroke = OxyPlot.OxyColor.FromUInt32((uint)random.Next(0, 16777215) + 4278190080), //Kolor obramowania punktów wykresu / kolory losowane funkcją random
                        Title        = procesy[n].ProcessName.ToString()                                         //tytuł serii
                    };
                }
                //Uzupełnianie danych
                for (int i = 0; i < Y.Count(); i++)
                {
                    for (int n = 0; n < Y[i].Count(); n++)                                  //uzupełniam tylko dla włączonych
                    {
                        punktySeriiTab[i].Points.Add(new OxyPlot.DataPoint(X[n], Y[i][n])); //dodanie wszystkich serii do wykresu
                    }
                }
                for (int i = 0; i < Y.Count(); i++)
                {
                    plotModel.Series.Add(punktySeriiTab[i]);
                }
                //Opis i parametry osi wykresu
                var xAxis = new OxyPlot.Axes.LinearAxis(OxyPlot.Axes.AxisPosition.Bottom, "czas [s]")
                {
                    MajorGridlineStyle =
                        OxyPlot.LineStyle.Solid,
                    MinorGridlineStyle = OxyPlot.LineStyle.Dot
                };

                plotModel.Axes.Add(xAxis);
                var yAxis = new OxyPlot.Axes.LinearAxis(OxyPlot.Axes.AxisPosition.Left, "% udziału czasu")
                {
                    MajorGridlineStyle =
                        OxyPlot.LineStyle.Solid,
                    MinorGridlineStyle = OxyPlot.LineStyle.Dot
                };

                plotModel.Axes.Add(yAxis);
            }
示例#40
0
 public void Stop()
 {
     Time         = new TimeSpan(00, 00, 00);
     stop_pressed = true;
     //customEventStop(stop_pressed);
     position = 0;
     line6    = new OxyPlot.Series.LineSeries();
     line7    = new OxyPlot.Series.LineSeries();
     line8    = new OxyPlot.Series.LineSeries();
     plot6    = new OxyPlot.PlotModel();
     plot7    = new OxyPlot.PlotModel();
     plot8    = new OxyPlot.PlotModel();
 }
示例#41
0
        public MonFileVM(PDCore.ToshibaImport.MonFile File)
        {
            plotModelT = new OxyPlot.PlotModel();
            plotModelP = new OxyPlot.PlotModel();
            plotModelS = new OxyPlot.PlotModel();


            SetUpModel();
            if (File.Steps.Count > 0)
            {
                LoadData(File);
            }
        }
示例#42
0
文件: SPD.xaml.cs 项目: kujawskip/SPD
        private void SavePlot(OxyPlot.PlotModel PlotKey, string path = "")
        {
            SaveFileDialog sfd = new SaveFileDialog
            {
                Filter   = "PNG|*.png",
                FileName = path == ""?DateTime.Now.ToString("yy-MM-dd") + DateTime.Now.GetHashCode() + ".png":path
            };
            var b = path == ""?sfd.ShowDialog():true;

            if (!b.HasValue || !b.Value)
            {
                return;
            }
            using (var stream = File.Create(sfd.FileName))
            {
                PngExporter.Export(PlotKey, stream, 600, 400, OxyColor.FromArgb(255, 255, 255, 255));
            }
        }
示例#43
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            var plotModel     = new OxyPlot.PlotModel();
            var timeSpanAxis1 = new TimeSpanAxis();

            timeSpanAxis1.Title    = "Time";
            timeSpanAxis1.Position = AxisPosition.Bottom;
            plotModel.Axes.Add(timeSpanAxis1);
            var timeSpanAxis2 = new MsecTimeSpanAxis();

            timeSpanAxis2.Title              = "Offset";
            timeSpanAxis2.StringFormat       = "m:ss:msec";
            timeSpanAxis2.MajorGridlineStyle = LineStyle.Automatic;
            timeSpanAxis2.MinorGridlineStyle = LineStyle.Automatic;
            plotModel.Axes.Add(timeSpanAxis2);
            FillGraph(plotModel);
            plotModel.IsLegendVisible = false;
            plotter.Model             = plotModel;
        }
示例#44
0
        private void SetUpPlot(string valType)
        {
            PlotModel = new OxyPlot.PlotModel
            {
                Title                   = ParametersFactory.GetName(valType),
                TitlePadding            = 0,
                Padding                 = new OxyThickness(1, 10, 1, 0),
                PlotAreaBorderThickness = 1,
                PlotAreaBorderColor     = OxyColor.FromAColor(64, OxyColors.Black),
                LegendOrientation       = LegendOrientation.Vertical,
                LegendBackground        = OxyColor.FromAColor(128, OxyColors.White),
                LegendItemSpacing       = 0,
                LegendColumnSpacing     = 0,
                LegendPlacement         = LegendPlacement.Outside,
            };

            var valueAxis = new LinearAxis(AxisPosition.Left)
            {
                AbsoluteMaximum    = ParametersFactory.GetMaxValue(valType),
                AbsoluteMinimum    = ParametersFactory.GetMinValue(valType),
                MinimumPadding     = 0.05,
                MaximumPadding     = 0.05,
                MajorGridlineStyle = LineStyle.Solid,
                MinorGridlineStyle = LineStyle.Dot,
                Title = ParametersFactory.GetName(valType),
            };

            string unit = ParametersFactory.GetUnit(valType);

            if (unit.Length > 0)
            {
                valueAxis.Unit = unit;
                valueAxis.TitleFormatString = "{0}, {1}";
            }

            PlotModel.Annotations.Add(timePickerAnnotation);
            PlotModel.Axes.Add(dateAxis);
            PlotModel.Axes.Add(valueAxis);
        }
示例#45
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            //this.RequestWindowFeature(WindowFeatures.NoTitle);
            this.Title = "prueba";

            var        model = new OxyPlot.PlotModel();
            LineSeries ts    = new LineSeries();

            ts.Points.Add(new DataPoint(0, 0));
            ts.Points.Add(new DataPoint(1, 1));
            ts.Points.Add(new DataPoint(1, 2));
            ts.Points.Add(new DataPoint(2, 2));
            ts.Points.Add(new DataPoint(2, 3));
            ts.Points.Add(new DataPoint(3, 4));
            model.Series.Add(ts);

            this.SetContentView(Resource.Layout.PlotActivity);
            var plotView = this.FindViewById <PlotView>(Resource.Id.plotview);

            plotView.Model = model;
        }
示例#46
0
        private void SetUpPlot(string valType, RealDataSource realSource)
        {
            PlotModel = new OxyPlot.PlotModel
            {
                Title                   = ParametersFactory.GetName(valType),
                Subtitle                = "данные от " + realSource.Name,
                TitlePadding            = 0,
                Padding                 = new OxyThickness(1, 10, 1, 0),
                PlotAreaBorderThickness = 1,
                PlotAreaBorderColor     = OxyColor.FromAColor(64, OxyColors.Black),
            };

            var valueAxis = new LinearAxis(AxisPosition.Left)
            {
                AbsoluteMinimum    = 0,
                MinimumPadding     = 0,
                MaximumPadding     = 0.05,
                MajorGridlineStyle = LineStyle.Solid,
                MinorGridlineStyle = LineStyle.Dot
            };

            PlotModel.Axes.Add(valueAxis);
        }
示例#47
0
        public void DrawChart()
        {
            var             dbMgr     = Util.GetDatabaseMgr();
            List <TblEntry> entryList = dbMgr.GetEntriesForGraph();

            // Draw Chart
            OxyPlot.PlotModel plotModel = new OxyPlot.PlotModel();
            plotModel.PlotType = OxyPlot.PlotType.XY;
            plotModel.Title    = "";

            var categoryAxis = new CategoryAxis
            {
                Position = AxisPosition.Bottom
            };

            for (int i = 0; i < entryList.Count; i++)
            {
                var Points = new List <ColumnItem>
                {
                    new ColumnItem(Util.Effect(entryList[i].Rate, entryList[i].CompoundingType) * 100, i),
                };

                Android.Graphics.Color color = Util.BAR_COLORS[i % Util.BAR_COLORS.Length];
                var barArray = new ColumnSeries();
                barArray.ItemsSource = Points;
                barArray.FillColor   = OxyColor.FromRgb(color.R, color.G, color.B);
                plotModel.Series.Add(barArray);

                categoryAxis.Labels.Add("");
            }

            plotModel.Axes.Add(categoryAxis);
            var plotview = view.FindViewById <OxyPlot.XamarinAndroid.PlotView>(Resource.Id.plotview);

            plotview.Model = plotModel;
        }
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     OxyPlot.PlotModel plotModel1 = new OxyPlot.PlotModel();
     this.splitContainer1 = new System.Windows.Forms.SplitContainer();
     this.treeView1       = new System.Windows.Forms.TreeView();
     this.plot1           = new OxyPlot.WindowsForms.PlotView();
     ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
     this.splitContainer1.Panel1.SuspendLayout();
     this.splitContainer1.Panel2.SuspendLayout();
     this.splitContainer1.SuspendLayout();
     this.SuspendLayout();
     //
     // splitContainer1
     //
     this.splitContainer1.Dock     = System.Windows.Forms.DockStyle.Fill;
     this.splitContainer1.Location = new System.Drawing.Point(0, 0);
     this.splitContainer1.Name     = "splitContainer1";
     //
     // splitContainer1.Panel1
     //
     this.splitContainer1.Panel1.Controls.Add(this.treeView1);
     //
     // splitContainer1.Panel2
     //
     this.splitContainer1.Panel2.Controls.Add(this.plot1);
     this.splitContainer1.Size             = new System.Drawing.Size(943, 554);
     this.splitContainer1.SplitterDistance = 314;
     this.splitContainer1.TabIndex         = 0;
     //
     // treeView1
     //
     this.treeView1.Dock     = System.Windows.Forms.DockStyle.Fill;
     this.treeView1.Location = new System.Drawing.Point(0, 0);
     this.treeView1.Name     = "treeView1";
     this.treeView1.Size     = new System.Drawing.Size(314, 554);
     this.treeView1.TabIndex = 1;
     //
     // plot1
     //
     this.plot1.Dock                    = System.Windows.Forms.DockStyle.Fill;
     this.plot1.Location                = new System.Drawing.Point(0, 0);
     plotModel1.AxisTierDistance        = 4D;
     plotModel1.Background              = OxyColors.Transparent;
     plotModel1.Culture                 = null;
     plotModel1.DefaultColors           = null;
     plotModel1.DefaultFont             = "Segoe UI";
     plotModel1.DefaultFontSize         = 12D;
     plotModel1.IsLegendVisible         = true;
     plotModel1.LegendBackground        = OxyColors.Undefined;
     plotModel1.LegendBorder            = OxyColors.Undefined;
     plotModel1.LegendBorderThickness   = 1D;
     plotModel1.LegendColumnSpacing     = 0D;
     plotModel1.LegendFont              = null;
     plotModel1.LegendFontSize          = 12D;
     plotModel1.LegendFontWeight        = 400D;
     plotModel1.LegendItemAlignment     = OxyPlot.HorizontalAlignment.Left;
     plotModel1.LegendItemOrder         = OxyPlot.LegendItemOrder.Normal;
     plotModel1.LegendItemSpacing       = 24D;
     plotModel1.LegendMargin            = 8D;
     plotModel1.LegendMaxWidth          = double.NaN;
     plotModel1.LegendOrientation       = OxyPlot.LegendOrientation.Vertical;
     plotModel1.LegendPadding           = 8D;
     plotModel1.LegendPlacement         = OxyPlot.LegendPlacement.Inside;
     plotModel1.LegendPosition          = OxyPlot.LegendPosition.RightTop;
     plotModel1.LegendSymbolLength      = 16D;
     plotModel1.LegendSymbolMargin      = 4D;
     plotModel1.LegendSymbolPlacement   = OxyPlot.LegendSymbolPlacement.Left;
     plotModel1.LegendTextColor         = OxyColors.Undefined;
     plotModel1.LegendTitle             = null;
     plotModel1.LegendTitleColor        = OxyColors.Undefined;
     plotModel1.LegendTitleFont         = null;
     plotModel1.LegendTitleFontSize     = 12D;
     plotModel1.LegendTitleFontWeight   = 700D;
     plotModel1.PlotAreaBackground      = OxyColors.Undefined;
     plotModel1.PlotAreaBorderColor     = OxyColors.Undefined;
     plotModel1.PlotAreaBorderThickness = new OxyThickness(1);
     plotModel1.PlotType                = OxyPlot.PlotType.XY;
     plotModel1.SelectionColor          = OxyColors.Undefined;
     plotModel1.Subtitle                = null;
     plotModel1.SubtitleColor           = OxyColors.Undefined;
     plotModel1.SubtitleFont            = null;
     plotModel1.SubtitleFontSize        = 14D;
     plotModel1.SubtitleFontWeight      = 400D;
     plotModel1.TextColor               = OxyColors.Undefined;
     plotModel1.Title                   = null;
     plotModel1.TitleColor              = OxyColors.Undefined;
     plotModel1.TitleFont               = null;
     plotModel1.TitleFontSize           = 18D;
     plotModel1.TitleFontWeight         = 700D;
     plotModel1.TitlePadding            = 6D;
     this.plot1.Model                   = plotModel1;
     this.plot1.Name                    = "plot1";
     this.plot1.PanCursor               = System.Windows.Forms.Cursors.Hand;
     this.plot1.Size                    = new System.Drawing.Size(625, 554);
     this.plot1.TabIndex                = 0;
     this.plot1.Text                    = "plot1";
     this.plot1.ZoomHorizontalCursor    = System.Windows.Forms.Cursors.SizeWE;
     this.plot1.ZoomRectangleCursor     = System.Windows.Forms.Cursors.SizeNWSE;
     this.plot1.ZoomVerticalCursor      = System.Windows.Forms.Cursors.SizeNS;
     //
     // MainForm
     //
     this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     this.AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Font;
     this.ClientSize          = new System.Drawing.Size(943, 554);
     this.Controls.Add(this.splitContainer1);
     this.Name = "MainForm";
     this.Text = "OxyPlot.WindowsForms Example Browser";
     this.splitContainer1.Panel1.ResumeLayout(false);
     this.splitContainer1.Panel2.ResumeLayout(false);
     ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
     this.splitContainer1.ResumeLayout(false);
     this.ResumeLayout(false);
 }
示例#49
0
        public CbodePlot(PlotView _plotBodeMag, PlotView _plotBodePh)
        {
            m_plotBodeMag = _plotBodeMag;
            m_plotBodePh  = _plotBodePh;
            // Mag
            m_plotBodeMag.Dock                 = System.Windows.Forms.DockStyle.Bottom;
            m_plotBodeMag.Location             = new System.Drawing.Point(0, 0);
            m_plotBodeMag.Name                 = "BodeMag";
            m_plotBodeMag.PanCursor            = System.Windows.Forms.Cursors.Hand;
            m_plotBodeMag.Size                 = new System.Drawing.Size(100, 120);
            m_plotBodeMag.TabIndex             = 0;
            m_plotBodeMag.Text                 = "BodeMag";
            m_plotBodeMag.ZoomHorizontalCursor = System.Windows.Forms.Cursors.SizeWE;
            m_plotBodeMag.ZoomRectangleCursor  = System.Windows.Forms.Cursors.SizeNWSE;
            m_plotBodeMag.ZoomVerticalCursor   = System.Windows.Forms.Cursors.SizeNS;

            m_PlotModelBodeMag = new OxyPlot.PlotModel();
            //m_PlotModelBodeMag.Title = "Magnitude";

            m_PlotModelBodeMag.Axes.Add(new OxyPlot.Axes.LogarithmicAxis {
                Position = AxisPosition.Bottom, Maximum = 100, Minimum = 0
            });                                                                                                                          //X
            m_PlotModelBodeMag.Axes.Add(new LinearAxis {
                Position = AxisPosition.Left, Maximum = 40, Minimum = 0
            });                                                                                                     //Y

            seriesBodeMag            = new LineSeries();
            seriesBodeMag.Title      = "dB";// legend
            seriesBodeMag.MarkerType = MarkerType.None;
            seriesBodeMag.Points.Add(new DataPoint(0, 0));
            seriesBodeMag.Points.Add(new DataPoint(1, 10));
            seriesBodeMag.Background = OxyColors.White;

            m_PlotModelBodeMag.Series.Add(seriesBodeMag);
            // Phase
            m_plotBodePh.Dock                 = System.Windows.Forms.DockStyle.Bottom;
            m_plotBodePh.Location             = new System.Drawing.Point(0, 0);
            m_plotBodePh.Name                 = "BodePh";
            m_plotBodePh.PanCursor            = System.Windows.Forms.Cursors.Hand;
            m_plotBodePh.Size                 = new System.Drawing.Size(100, 120);
            m_plotBodePh.TabIndex             = 0;
            m_plotBodePh.Text                 = "BodePh";
            m_plotBodePh.ZoomHorizontalCursor = System.Windows.Forms.Cursors.SizeWE;
            m_plotBodePh.ZoomRectangleCursor  = System.Windows.Forms.Cursors.SizeNWSE;
            m_plotBodePh.ZoomVerticalCursor   = System.Windows.Forms.Cursors.SizeNS;


            m_PlotModelBodePh = new OxyPlot.PlotModel();
            //m_PlotModelBodePh.Title = "Phase";

            m_PlotModelBodePh.Axes.Add(new OxyPlot.Axes.LogarithmicAxis {
                Position = AxisPosition.Bottom, Maximum = 100, Minimum = 0
            });                                                                                                                         //X
            m_PlotModelBodePh.Axes.Add(new LinearAxis {
                Position = AxisPosition.Left, Maximum = 40, Minimum = 0
            });                                                                                                    //Y

            seriesBodePh            = new LineSeries();
            seriesBodePh.Title      = "Deg";// legend
            seriesBodePh.MarkerType = MarkerType.None;
            //seriesBodePh.Points.Add(new DataPoint(0, -0.5));
            //seriesBodePh.Points.Add(new DataPoint(1, -10));
            seriesBodePh.Background = OxyColors.White;

            m_PlotModelBodePh.Series.Add(seriesBodePh);
        }
示例#50
0
 public override void AddToModel(OxyPlot.PlotModel model)
 {
     base.AddToModel(model);
 }
示例#51
0
        public void InitializeChart(int index)
        {
            if (index < 0)
            {
                return;
            }

            var             dbMgr     = Util.GetDatabaseMgr();
            List <TblStats> statsList = dbMgr.GetStats(statsTypesList[index].FieldID);

            // Draw Bar Chart
            OxyPlot.PlotModel plotModel = new OxyPlot.PlotModel();
            plotModel.PlotType = OxyPlot.PlotType.XY;
            plotModel.Title    = "";

            /*
             * var categoryAxis = new CategoryAxis
             * {
             * Position = AxisPosition.Bottom
             * };
             *
             * for (int i = 0; i < statsList.Count; i++)
             * {
             * var Points = new List<ColumnItem>
             * {
             * new ColumnItem(statsList[i].Value, i),
             * };
             *
             * Android.Graphics.Color color = Util.BAR_COLORS[i % Util.BAR_COLORS.Length];
             * var barArray = new ColumnSeries();
             * barArray.ItemsSource = Points;
             * barArray.FillColor = OxyColor.FromRgb(color.R, color.G, color.B);
             * plotModel.Series.Add(barArray);
             *
             * categoryAxis.Labels.Add(statsList[i].Year.ToString());
             * }
             *
             * plotModel.Axes.Add(categoryAxis);
             * var plotview = view.FindViewById<OxyPlot.XamarinAndroid.PlotView>(Resource.Id.plotview);
             * plotview.Model = plotModel;*/
            var categoryAxis = new CategoryAxis
            {
                Position = AxisPosition.Bottom
            };
            var Points = new List <DataPoint> ();

            statsList.Sort(delegate(TblStats x, TblStats y)
            {
                if (x.Year == y.Year && x.Month == y.Month)
                {
                    return(0);
                }
                else if (x.Year < y.Year)
                {
                    return(-1);
                }
                else if (x.Year > y.Year)
                {
                    return(1);
                }
                else if (x.Month < y.Month)
                {
                    return(-1);
                }
                else if (x.Month > y.Month)
                {
                    return(1);
                }

                return(0);
            });

            for (int i = 0; i < statsList.Count; i++)
            {
                Points.Add(new DataPoint(i, statsList[i].Value));
                List <TblStats> statsEqual = statsList.FindAll(delegate(TblStats stat)
                {
                    return(stat.Year == statsList[i].Year);
                });

                int    nCount    = (statsEqual == null) ? 0 : statsEqual.Count;
                String axisLabel = (nCount > 1) ? (statsList [i].Year.ToString() + "." + statsList [i].Month.ToString()) : statsList [i].Year.ToString();
                categoryAxis.Labels.Add(axisLabel);
            }

            Android.Graphics.Color color = Android.Graphics.Color.Black;
            var lineSeries = new LineSeries();

            lineSeries.ItemsSource = Points;
            lineSeries.Color       = OxyColor.FromRgb(color.R, color.G, color.B);
            plotModel.Series.Add(lineSeries);

            var plotviewline = view.FindViewById <OxyPlot.XamarinAndroid.PlotView>(Resource.Id.plotview);

            plotModel.Axes.Add(categoryAxis);
            plotviewline.Model = plotModel;
        }
示例#52
0
        public static PlotModel GetModel(IBarChartDataContainer <DateTime, decimal> data, Statistics.TimeStepType timeStep)
        {
            OxyPlot.PlotModel plot = new OxyPlot.PlotModel();

            //ColumnSeries barSeries = new ColumnSeries { Title = "Balance", StrokeColor = OxyColors.Black, FillColor = OxyColors.White, StrokeThickness = 1};
            //data.BarChartData.ToList().ForEach(x => barSeries.Items.Add(new ColumnItem { Value = ((double)x.TotalValue)}));

            ColumnSeries barSeries2 = new ColumnSeries {
                Title = "Income", StrokeColor = OxyColors.Black, FillColor = OxyColors.Green.ChangeSaturation(0.4)
            };

            data.BarChartData.ToList().ForEach(x => barSeries2.Items.Add(new ColumnItem {
                Value = (double)x.PosValue
            }));

            ColumnSeries barSeries3 = new ColumnSeries {
                Title = "Expenses", StrokeColor = OxyColors.Black, FillColor = OxyColors.Red.ChangeSaturation(0.4)
            };

            data.BarChartData.OrderBy(x => x.Label).ToList().ForEach(x => barSeries3.Items.Add(new ColumnItem {
                Value = -(double)x.NegValue
            }));


            plot.Series.Add(barSeries2);
            plot.Series.Add(barSeries3);
            //plot.Series.Add(barSeries);

            string dataFormat = "dd.MM.yyyy";

            if (timeStep == Statistics.TimeStepType.Month)
            {
                dataFormat = "MM.yyyy";
            }
            else if (timeStep == Statistics.TimeStepType.Hour)
            {
                dataFormat = "hh dd.MM.yyyy";
            }

            var categoryAxis = new CategoryAxis {
                Position = AxisPosition.Bottom, GapWidth = 0, TickStyle = TickStyle.Outside
            };

            int barCount   = data.BarChartData.Count;
            int labelShift = barCount / 10 + 1;

            for (int i = 0; i < barCount; ++i)
            {
                categoryAxis.Labels.Add(i % labelShift == 0 ? data.BarChartData[i].Label.ToString(dataFormat) : string.Empty);
            }

            //data.BarChartData.ToList().ForEach(x => categoryAxis.Labels.Add(x.Label.ToString(dataFormat)));



            plot.Axes.Add(categoryAxis);

            plot.Axes.Add(new LinearAxis()
            {
                Position = AxisPosition.Left, MajorGridlineStyle = LineStyle.Solid, MinorGridlineStyle = LineStyle.Solid, MaximumPadding = 0.2
            });

            return(plot);
        }
示例#53
0
        Control Overview(TimeInterval m)
        {
            var model = new OxyPlot.PlotModel()
            {
                Title           = "Overview",
                Background      = OxyColors.White,
                DefaultFont     = "Arial",
                DefaultFontSize = 10.0
            };

            model.Axes.Add(new DateTimeAxis
            {
                Position           = AxisPosition.Left,
                MajorGridlineStyle = LineStyle.Solid,
                MajorStep          = 1,
                MinorStep          = 1.0 / 4.0,
                Minimum            = DateTimeAxis.ToDouble(m.Begin.AddDays(-1)),
                Maximum            = DateTimeAxis.ToDouble(m.End),
                StringFormat       = "ddd dd.MM.",
            });

            model.Axes.Add(new TimeSpanAxis
            {
                Position           = AxisPosition.Bottom,
                MajorGridlineStyle = LineStyle.Solid,
                MinorGridlineStyle = LineStyle.Dot,
                Minimum            = TimeSpan.Zero.TotalSeconds,
                Maximum            = TimeSpan.FromDays(1).TotalSeconds,
                StringFormat       = "h:mm",
            });

            var bars = Summarize(input.Range(m));

            var activity = new OxyPlot.Series.RectangleBarSeries()
            {
                TrackerFormatString = "{2} - {3}",
                StrokeThickness     = 0
            };

            foreach (var i in bars)
            {
                foreach (var t in i.TimeInterval.SplitToDays())
                {
                    var refDay = t.Begin.Date;
                    var y0     = DateTimeAxis.ToDouble(refDay);
                    var x0     = (t.Begin - refDay).TotalSeconds;
                    var x1     = (t.End - refDay).TotalSeconds;
                    activity.Items.Add(new OxyPlot.Series.RectangleBarItem(x0, y0 - daySep, x1, y0 + daySep)
                    {
                        Color = OxyPlot.OxyColor.FromUInt32((uint)(i.IsActive ? activeColor : idleColor).ToArgb())
                    });
                }
            }

            model.Series.Add(activity);

            /*
             * var keys = new OxyPlot.Series.ScatterSeries()
             * {
             *  MarkerType = MarkerType.Circle,
             *
             * };
             *
             * foreach (var i in input.Range(m))
             * {
             *  if (i.KeyDown > 0)
             *  {
             *      keys.Points.Add(new OxyPlot.Series.ScatterPoint(
             *          i.TimeInterval.Begin.ToLocalTime().TimeOfDay.TotalSeconds,
             *          i.TimeInterval.Begin.ToLocalTime().Date.ToOADate()));
             *  }
             * }
             *
             * model.Series.Add(keys);
             */

            var plotView = new OxyPlot.WindowsForms.PlotView
            {
                Model = model
            };

            return(plotView);
        }
示例#54
0
        Control Activity(TimeInterval m)
        {
            var model = new OxyPlot.PlotModel()
            {
                Title           = "Activity",
                Background      = OxyColors.White,
                DefaultFont     = "Arial",
                DefaultFontSize = 10.0
            };

            model.Axes.Add(new DateTimeAxis
            {
                Position           = AxisPosition.Bottom,
                MajorGridlineStyle = LineStyle.Solid,
                MinorGridlineStyle = LineStyle.Dot,
                Minimum            = DateTimeAxis.ToDouble(m.Begin),
                Maximum            = DateTimeAxis.ToDouble(m.End),
                StringFormat       = "HH:mm"
            });

            var keyboardAxis = new OxyPlot.Axes.LinearAxis
            {
                Key      = "keyboard",
                Title    = "Keyboard",
                Position = AxisPosition.Left,
                Minimum  = 0,
                Maximum  = 60e3 * m.Duration.TotalDays
            };

            model.Axes.Add(keyboardAxis);

            var mouseAxis = new OxyPlot.Axes.LinearAxis
            {
                Key      = "mouse",
                Title    = "Mouse",
                Position = AxisPosition.Right,
                Minimum  = 0,
                Maximum  = 7000e3 * m.Duration.TotalDays
            };

            model.Axes.Add(mouseAxis);

            var keystrokes = new OxyPlot.Series.LineSeries
            {
                Title    = "keystrokes",
                YAxisKey = keyboardAxis.Key
            };

            model.Series.Add(keystrokes);

            var mouse = new OxyPlot.Series.LineSeries
            {
                Title    = "mouse",
                YAxisKey = mouseAxis.Key
            };

            model.Series.Add(mouse);

            var    data           = input.Range(m);
            int    totalKeyDown   = 0;
            double totalMouseMove = 0;

            foreach (var i in data)
            {
                totalKeyDown   += i.KeyDown;
                totalMouseMove += i.MouseMove;
                keystrokes.Points.Add(new OxyPlot.DataPoint(DateTimeAxis.ToDouble(i.Begin), totalKeyDown));
                mouse.Points.Add(new OxyPlot.DataPoint(DateTimeAxis.ToDouble(i.Begin), totalMouseMove));
            }

            return(new OxyPlot.WindowsForms.PlotView
            {
                Model = model
            });
        }
示例#55
0
        private void LoadChart(string symbol, CandleInterval interval)
        {
            CurrentLoadedSymbol = symbol;
            CurrentInterval     = interval;
            //client.SetApiCredentials("118180a6a91e29425c90c2e2afe349aa71", "e36a6307025c4b4fb1b20a4a00c4c9ef");
            client.SetApiCredentials(Key, Secret);


            //get min trade size
            var markets = client.GetSymbols();

            if (markets.Data != null)
            {
                var market = markets.Data.FirstOrDefault(l => l.Symbol == symbol);
                CurrentMinTradeSize = market.MinTradeSize;
            }


            //get high low data
            var summary = client.GetSymbolSummary(symbol);

            if (summary.Data != null)
            {
                CurrentPriceHigh = summary.Data.High;
                CurrentPriceLow  = summary.Data.Low;
            }

            //get balance for currency
            var balance = client.GetBalance(symbol.Substring(0, 3));

            if (balance.Data != null)
            {
                AccountBalance = balance.Data.Available.ToString() + " " + balance.Data.Currency;
            }

            //get order history
            var orderhistory = client.GetOrderBook(symbol);

            if (orderhistory.Data != null)
            {
                OrderBook = orderhistory.Data;
            }

            //get closed orders
            var d = client.GetClosedOrders(symbol);

            if (d.Data != null)
            {
                ClosedOrders = new ObservableCollection <BittrexOrderV3>(d.Data);
            }

            //get open orders
            var o = client.GetOpenOrders(symbol);

            if (o.Data != null)
            {
                OpenOrders = new ObservableCollection <BittrexOrderV3>(o.Data);
            }

            //var balance = client.GetBalance(CurrentLoadedSymbol);
            //if (balance.Data != null)
            //{
            //    AccountBalance = balance.Data.Total.ToString();
            //}
            //else
            //{
            //    AccountBalance = "0.00";
            //}

            string intervalstring = "";

            if (interval == CandleInterval.Day1)
            {
                intervalstring = "DAY_1";
            }
            else if (interval == CandleInterval.Hour1)
            {
                intervalstring = "HOUR_1";
            }
            else if (interval == CandleInterval.Minute1)
            {
                intervalstring = "MINUTE_1";
            }
            else if (interval == CandleInterval.Minutes5)
            {
                intervalstring = "MINUTE_5";
            }

            var coincandledatajson = CallRestMethod("https://api.bittrex.com/v3/markets/" + symbol + "/candles/" + intervalstring + "/recent");
            var coincandledata     = JsonConvert.DeserializeObject <CandleData[]>(coincandledatajson);

            coinsCb.SelectedItem = symbol; //defualt


            foreach (CandleData candle in coincandledata)
            {
                candle.Time = candle.StartsAt.DateTime;
            }

            if (plotmodel != null)
            {
                plotmodel.Series.Clear();
            }

            OxyPlot.PlotModel model = new OxyPlot.PlotModel();
            //x
            model.Axes.Add(new DateTimeAxis
            {
                //StringFormat = "hh:mm",
                Title             = "Time",
                AxislineColor     = OxyColors.White,
                TitleColor        = OxyColors.White,
                TicklineColor     = OxyColors.White,
                TextColor         = OxyColors.White,
                MinorIntervalType = DateTimeIntervalType.Auto,

                Position = AxisPosition.Bottom,
            });
            XAxis = model.Axes[0];

            //y
            model.Axes.Add(new LinearAxis()
            {
                Title = "Market Price",

                Position      = AxisPosition.Left,
                AxislineColor = OxyColors.White,
                TitleColor    = OxyColors.White,
                TicklineColor = OxyColors.White,
                TextColor     = OxyColors.White,
            });
            YAxis = model.Axes[1];


            //create plot model and add the line series
            CandleStickSeries data = new CandleStickSeries()
            {
                Title = symbol
            };

            data.DataFieldClose      = "Close";
            data.DataFieldHigh       = "High";
            data.DataFieldLow        = "Low";
            data.DataFieldOpen       = "Open";
            data.DataFieldX          = "Time";
            data.Color               = OxyColors.DarkGray;
            data.IncreasingColor     = OxyColors.Green;
            data.DecreasingColor     = OxyColors.Red;
            data.ItemsSource         = coincandledata;
            data.TrackerFormatString = "Date: {2}\nOpen: {5:0.00000}\nHigh: {3:0.00000}\nLow: {4:0.00000}\nClose: {6:0.00000}";



            plotmodel = model;
            model.PlotAreaBorderColor = OxyColors.White;
            model.LegendTextColor     = OxyColors.YellowGreen;
            model.Series.Add(data);
            model.Background = OxyColors.Black;
            model.MouseUp   += Model_MouseUp;;
            model.MouseDown += Model_MouseDown;;

            plotview.Model = model;

            if (LimitLineSeries != null)
            {
                DrawLimitLine(OrderSide.Buy, LimitLineSeries);
            }
        }
示例#56
0
        //bool showXAxis = true, showYAxix = true, isZoomable = true, isMovable = true;
        //IPlotType chart;
        //public bool ShowXAxis
        //{
        //    get => showXAxis;
        //    set
        //    {
        //        if (showXAxis == value) return;
        //        showXAxis = value;
        //    }
        //}
        //public bool ShowYAxix
        //{
        //    get => showYAxix;
        //    set
        //    {
        //        if (showYAxix == value) return;
        //        showYAxix = value;
        //    }
        //}
        //public bool IsZoomable
        //{
        //    get => isZoomable;
        //    set
        //    {
        //        if (isZoomable == value) return;
        //        isZoomable = value;
        //    }
        //}
        //public bool IsMovable
        //{
        //    get => isMovable;
        //    set
        //    {
        //        if (isMovable == value) return;
        //        isMovable = value;
        //    }
        //}

        public async Task Add(PlotModel plotModel)
        {
            this.oxyplotModel       = new OxyPlot.PlotModel();
            this.oxyplotModel.Title = plotModel.Title;
            foreach (var chart in plotModel.Series)
            {
                if (chart is TwoColorArea) //it should be placed before Area if clause
                {
                    var twoColorAreaSeries = new TwoColorAreaSeries
                    {
                        Color  = ChartColor.CastToOxyColor(((TwoColorArea)chart).Color),
                        Color2 = ChartColor.CastToOxyColor(((TwoColorArea)chart).Color2),
                        Limit  = ((TwoColorArea)chart).Limit
                    };
                    foreach (var item in ((TwoColorArea)chart).Data)
                    {
                        twoColorAreaSeries.Points.Add(item);
                    }
                    this.oxyplotModel.Series.Add(twoColorAreaSeries);
                }
                else if (chart is Area)
                {
                    var areaSeries = new AreaSeries();
                    foreach (var point in ((Area)chart).Data)
                    {
                        areaSeries.Points.Add(point);
                    }
                    this.oxyplotModel.Series.Add(areaSeries);
                }
                else if (chart is TwoColorLine)//it should be placed before line if clause
                {
                    var twoColorLineSeries = new TwoColorLineSeries
                    {
                        Color  = ChartColor.CastToOxyColor(((TwoColorLine)chart).Color),
                        Color2 = ChartColor.CastToOxyColor(((TwoColorLine)chart).Color2),
                        Limit  = ((TwoColorLine)chart).Limit
                    };
                    foreach (var item in ((TwoColorLine)chart).Data)
                    {
                        twoColorLineSeries.Points.Add(item);
                    }
                    this.oxyplotModel.Series.Add(twoColorLineSeries);
                }
                else if (chart is Line)
                {
                    var lineSeries = new LineSeries
                    {
                        MarkerType   = MarkerType.Circle,
                        MarkerSize   = 4,
                        MarkerStroke = OxyColors.White
                    };

                    foreach (var point in ((Line)chart).Data)
                    {
                        lineSeries.Points.Add(point);
                    }
                    this.oxyplotModel.Series.Add(lineSeries);
                }
                else if (chart is Pie)
                {
                    var pieSeries = new PieSeries();
                    foreach (var slice in ((Pie)chart).Data)
                    {
                        pieSeries.Slices.Add(slice);
                    }
                    this.oxyplotModel.Series.Add(pieSeries);
                }
                else if (chart is Bar)
                {
                    var barSeries = new BarSeries();
                    foreach (var item in ((Bar)chart).Data)
                    {
                        barSeries.Items.Add(item);
                    }
                    this.oxyplotModel.Series.Add(barSeries);
                }
                else if (chart is ErrorColumn)
                {
                    var errorColumn = new ErrorColumnSeries();
                    foreach (ErrorColumnItem item in ((ErrorColumn)chart).Data)
                    {
                        errorColumn.Items.Add((OxyPlot.Series.ErrorColumnItem)item);
                    }
                    this.oxyplotModel.Series.Add(errorColumn);
                }
                else if (chart is Column)
                {
                    var barSeries = new ColumnSeries();
                    foreach (var item in ((Column)chart).Data)
                    {
                        barSeries.Items.Add(item);
                    }
                    this.oxyplotModel.Series.Add(barSeries);
                }
                else if (chart is Box)
                {
                    var boxSeries = new BoxPlotSeries();
                    foreach (var item in ((Box)chart).Data)
                    {
                        boxSeries.Items.Add(item);
                    }
                    this.oxyplotModel.Series.Add(boxSeries);
                }
                else if (chart is Contour)
                {
                    var contourSeries = new ContourSeries
                    {
                        Data = ((Contour)chart).Data,
                        ColumnCoordinates = ((Contour)chart).ColumnCoordinates,
                        RowCoordinates    = ((Contour)chart).RowCoordinates
                    };
                    this.oxyplotModel.Series.Add(contourSeries);
                }
                else if (chart is RectangleBar)
                {
                    var rectangleBarSeries = new RectangleBarSeries
                    {
                        Title = ((RectangleBar)chart).Title
                    };
                    foreach (var item in ((RectangleBar)chart).Data)
                    {
                        rectangleBarSeries.Items.Add(item);
                    }
                    this.oxyplotModel.Series.Add(rectangleBarSeries);
                }
                else if (chart is CandleStick)
                {
                    var candleStickSeries = new CandleStickSeries();
                    foreach (var item in ((CandleStick)chart).Data)
                    {
                        candleStickSeries.Items.Add(item);
                    }
                    this.oxyplotModel.Series.Add(candleStickSeries);
                }
                else if (chart is HeatMap)
                {
                    var heatMapSeries = new HeatMapSeries()
                    {
                        Data         = ((HeatMap)chart).Data,
                        X0           = ((HeatMap)chart).X0,
                        X1           = ((HeatMap)chart).X1,
                        Y0           = ((HeatMap)chart).Y0,
                        Y1           = ((HeatMap)chart).Y1,
                        Interpolate  = ((HeatMap)chart).Interpolate,
                        RenderMethod = ((HeatMap)chart).RenderMethod
                    };
                    this.oxyplotModel.Series.Add(heatMapSeries);
                }
                else if (chart is HighLow)
                {
                    var highLowSeries = new HighLowSeries();
                    foreach (var item in ((HighLow)chart).Data)
                    {
                        highLowSeries.Items.Add(item);
                    }
                    this.oxyplotModel.Series.Add(highLowSeries);
                }
                else if (chart is IntervalBar)
                {
                    var intervalBarSeries = new IntervalBarSeries();
                    foreach (var item in ((IntervalBar)chart).Data)
                    {
                        intervalBarSeries.Items.Add(item);
                    }
                    this.oxyplotModel.Series.Add(intervalBarSeries);
                }
                else if (chart is Scatter)
                {
                    var scatterSeries = new ScatterSeries();
                    foreach (var item in ((Scatter)chart).Data)
                    {
                        scatterSeries.Points.Add(item);
                    }
                    this.oxyplotModel.Series.Add(scatterSeries);
                }
            }
            foreach (var axis in plotModel.Axes)
            {
                this.oxyplotModel.Axes.Add(axis);
            }
        }
        private void RenderView()
        {
            Title = "Kinvey Live Service - Doctor";
            View.BackgroundColor = UIColor.FromRGB(7, 69, 126);
            nfloat w           = View.Bounds.Width;
            var    buttonWidth = (w / 2) - 20;

            AppDelegate myAppDel   = (UIApplication.SharedApplication.Delegate as AppDelegate);
            var         titleLabel = new UILabel
            {
                Text          = "Bob's Device Reading",
                TextColor     = UIColor.White,
                Frame         = new CGRect(10, 80, w - 20, h),
                TextAlignment = UITextAlignment.Center
            };

            View.AddSubview(titleLabel);

            MessageView = new UILabel
            {
                Text          = "--",
                Frame         = new CGRect(10, 120, w - 20, 3 * h),
                TextColor     = UIColor.White,
                Font          = UIFont.FromName("Helvetica-Bold", 60f),
                TextAlignment = UITextAlignment.Center
            };

            View.AddSubview(MessageView);

            TimeView = new UITextField
            {
                Placeholder     = "Roundtrip Time",
                Frame           = new CGRect(10, 200, w - 20, h),
                BorderStyle     = UITextBorderStyle.RoundedRect,
                BackgroundColor = UIColor.White,
                TextColor       = UIColor.Black
            };

            View.AddSubview(TimeView);
            TimeView.Hidden = true;

            plotModel = new OxyPlot.PlotModel();
            //plotModel.Background = OxyColor.FromRgb(131, 195, 202);
            plotModel.Background = OxyColor.FromRgb(157, 194, 198);
            plotModel.Axes.Add(new OxyPlot.Axes.LinearAxis {
                Position = OxyPlot.Axes.AxisPosition.Bottom
            });
            plotModel.Axes.Add(new OxyPlot.Axes.LinearAxis {
                Position = OxyPlot.Axes.AxisPosition.Left
            });

            OxyPlot.Xamarin.iOS.PlotView plotView = new OxyPlot.Xamarin.iOS.PlotView(new CGRect(10, 240, w - 20, 200));
            plotView.Model = plotModel;

            View.AddSubview(plotView);
            //UIButton buttonPublishDecrement;
            //buttonPublishDecrement = UIButton.FromType(UIButtonType.System);
            //buttonPublishDecrement.Frame = new CGRect(10, 280, buttonWidth, 44);
            //buttonPublishDecrement.SetTitle("Decrease", UIControlState.Normal);
            //buttonPublishDecrement.SetTitleColor(UIColor.Red, UIControlState.Normal);
            //buttonPublishDecrement.BackgroundColor = colorLightBlue;
            //buttonPublishDecrement.TouchUpInside += async (sender, e) =>
            //{
            //	await this.Publish(MedicalDeviceCommand.EnumCommand.DECREMENT);
            //	//PublishMessageView.Text = String.Empty;
            //};

            //View.AddSubview(buttonPublishDecrement);

            //UIButton buttonPublishIncrement;
            //buttonPublishIncrement = UIButton.FromType(UIButtonType.System);
            //buttonPublishIncrement.Frame = new CGRect(w - buttonWidth - 10, 280, buttonWidth, 44);
            //buttonPublishIncrement.SetTitle("Increase", UIControlState.Normal);
            //buttonPublishIncrement.SetTitleColor(UIColor.Green, UIControlState.Normal);
            //buttonPublishIncrement.BackgroundColor = colorLightBlue;
            ////buttonPublishIncrement.BackgroundColor = UIColor.Green;
            //buttonPublishIncrement.TouchUpInside += async (sender, e) =>
            //{
            //	await this.Publish(MedicalDeviceCommand.EnumCommand.INCREMENT);
            //	//PublishMessageView.Text = String.Empty;
            //};

            //View.AddSubview(buttonPublishIncrement);

            UIButton buttonLogout;

            buttonLogout       = UIButton.FromType(UIButtonType.System);
            buttonLogout.Frame = new CGRect(10, 460, w - 20, 44);
            buttonLogout.SetTitle("Logout", UIControlState.Normal);
            buttonLogout.SetTitleColor(UIColor.Black, UIControlState.Normal);
            buttonLogout.BackgroundColor = UIColor.Gray;

            var user = new UIViewController();

            user.View.BackgroundColor = UIColor.FromRGB(7, 69, 126);

            buttonLogout.TouchUpInside += async(sender, e) =>
            {
                await myAppDel.Logout();
            };

            View.AddSubview(buttonLogout);
        }
示例#58
0
        Control Hours(TimeInterval m)
        {
            var model = new OxyPlot.PlotModel()
            {
                Title           = "Hours",
                Background      = OxyColors.White,
                DefaultFont     = "Arial",
                DefaultFontSize = 10.0
            };

            model.Axes.Add(new DateTimeAxis
            {
                Position           = AxisPosition.Left,
                MajorGridlineStyle = LineStyle.Solid,
                // MinorGridlineStyle = LineStyle.Dot,
                MajorStep    = 1,
                Minimum      = DateTimeAxis.ToDouble(m.Begin.AddDays(-1)),
                Maximum      = DateTimeAxis.ToDouble(m.End),
                StringFormat = "ddd dd.MM.",
            });

            model.Axes.Add(new TimeSpanAxis
            {
                Position           = AxisPosition.Bottom,
                MajorGridlineStyle = LineStyle.Solid,
                MinorGridlineStyle = LineStyle.Dot,
                StringFormat       = "h:mm",
            });

            var w = input.Range(m)
                    .GroupBy(x => x.TimeInterval.Begin.Date)
                    .Select(g => new
            {
                Day     = g.Key,
                Active  = g.Where(_ => _.IsActive).Sum(_ => _.TimeInterval.Duration.TotalSeconds),
                Working = Worktime(g).TotalSeconds,
                On      = g.Sum(_ => _.TimeInterval.Duration.TotalSeconds)
            })
                    .ToList();

            var activity = new OxyPlot.Series.RectangleBarSeries()
            {
                TrackerFormatString = "{2} - {3}",
                StrokeThickness     = 0
            };

            foreach (var i in w)
            {
                var refDay = i.Day;
                var y      = DateTimeAxis.ToDouble(refDay);
                activity.Items.Add(new RectangleBarItem(0, y - daySep, i.On, y + daySep)
                {
                    Color = ToOxyColor(idleColor)
                });
                activity.Items.Add(new RectangleBarItem(0, y - daySep, i.Working, y + daySep)
                {
                    Color = ToOxyColor(workingColor)
                });
                activity.Items.Add(new RectangleBarItem(0, y - daySep, i.Active, y + daySep)
                {
                    Color = ToOxyColor(activeColor)
                });
            }

            model.Series.Add(activity);

            var plotView = new OxyPlot.WindowsForms.PlotView
            {
                Model = model
            };

            return(plotView);
        }
示例#59
0
 public static void DVHPlot(Structure structure, ScriptContext scriptContext)
 {
     var model = new OxyPlot.PlotModel {
         Title = $"DVH Plot"
     };
 }
示例#60
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     OxyPlot.PlotModel plotModel1 = new OxyPlot.PlotModel();
     this.splitContainer1 = new System.Windows.Forms.SplitContainer();
     this.treeView1       = new System.Windows.Forms.TreeView();
     this.plot1           = new OxyPlot.WindowsForms.PlotView();
     ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
     this.splitContainer1.Panel1.SuspendLayout();
     this.splitContainer1.Panel2.SuspendLayout();
     this.splitContainer1.SuspendLayout();
     this.SuspendLayout();
     //
     // splitContainer1
     //
     this.splitContainer1.Dock     = System.Windows.Forms.DockStyle.Fill;
     this.splitContainer1.Location = new System.Drawing.Point(0, 0);
     this.splitContainer1.Name     = "splitContainer1";
     //
     // splitContainer1.Panel1
     //
     this.splitContainer1.Panel1.Controls.Add(this.treeView1);
     //
     // splitContainer1.Panel2
     //
     this.splitContainer1.Panel2.Controls.Add(this.plot1);
     this.splitContainer1.Size             = new System.Drawing.Size(943, 554);
     this.splitContainer1.SplitterDistance = 314;
     this.splitContainer1.TabIndex         = 0;
     //
     // treeView1
     //
     this.treeView1.BorderStyle = System.Windows.Forms.BorderStyle.None;
     this.treeView1.Dock        = System.Windows.Forms.DockStyle.Fill;
     this.treeView1.Location    = new System.Drawing.Point(0, 0);
     this.treeView1.Name        = "treeView1";
     this.treeView1.Size        = new System.Drawing.Size(314, 554);
     this.treeView1.TabIndex    = 1;
     //
     // plot1
     //
     this.plot1.BackColor                = System.Drawing.Color.White;
     this.plot1.Dock                     = System.Windows.Forms.DockStyle.Fill;
     this.plot1.Location                 = new System.Drawing.Point(0, 0);
     plotModel1.AxisTierDistance         = 4D;
     plotModel1.Culture                  = null;
     plotModel1.DefaultColors            = null;
     plotModel1.DefaultFont              = "Segoe UI";
     plotModel1.DefaultFontSize          = 12D;
     plotModel1.IsLegendVisible          = true;
     plotModel1.PlotType                 = OxyPlot.PlotType.XY;
     plotModel1.RenderingDecorator       = null;
     plotModel1.Subtitle                 = null;
     plotModel1.SubtitleFont             = null;
     plotModel1.SubtitleFontSize         = 14D;
     plotModel1.SubtitleFontWeight       = 400D;
     plotModel1.Title                    = null;
     plotModel1.TitleFont                = null;
     plotModel1.TitleFontSize            = 18D;
     plotModel1.TitleFontWeight          = 700D;
     plotModel1.TitleHorizontalAlignment = OxyPlot.TitleHorizontalAlignment.CenteredWithinPlotArea;
     plotModel1.TitlePadding             = 6D;
     plotModel1.TitleToolTip             = null;
     this.plot1.Model                    = plotModel1;
     this.plot1.Name                     = "plot1";
     this.plot1.PanCursor                = System.Windows.Forms.Cursors.Hand;
     this.plot1.Size                     = new System.Drawing.Size(625, 554);
     this.plot1.TabIndex                 = 0;
     this.plot1.Text                     = "plot1";
     this.plot1.ZoomHorizontalCursor     = System.Windows.Forms.Cursors.SizeWE;
     this.plot1.ZoomRectangleCursor      = System.Windows.Forms.Cursors.SizeNWSE;
     this.plot1.ZoomVerticalCursor       = System.Windows.Forms.Cursors.SizeNS;
     //
     // MainForm
     //
     this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     this.AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Font;
     this.ClientSize          = new System.Drawing.Size(943, 554);
     this.Controls.Add(this.splitContainer1);
     this.Name = "MainForm";
     this.Text = "OxyPlot.WindowsForms Example Browser";
     this.splitContainer1.Panel1.ResumeLayout(false);
     this.splitContainer1.Panel2.ResumeLayout(false);
     ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
     this.splitContainer1.ResumeLayout(false);
     this.ResumeLayout(false);
 }