Esempio n. 1
0
        public Plot2DCurve AddLine(object x, object y, string quickLine)
        {
            Plot2DCurve plot2DCurve = AddLine(x, y);

            plot2DCurve.QuickLine = quickLine;
            return(plot2DCurve);
        }
Esempio n. 2
0
        public Plot2DCurve AddLine(double[] y)
        {
            double[]    x           = MathHelper.Counter(y.Length);
            Plot2DCurve plot2DCurve = AddLine(x, y);

            return(plot2DCurve);
        }
Esempio n. 3
0
        public Plot2DCurve AddLine(double[] x, double[] y, string quickLine)
        {
            Plot2DCurve plot2DCurve = AddLine(x, y);

            plot2DCurve.QuickLine = quickLine;
            return(plot2DCurve);
        }
Esempio n. 4
0
        public Plot2DCurve AddLine(object x, object y)
        {
            Curve       curve       = new Curve(Plotting.Array(x), Plotting.Array(y));
            Plot2DCurve plot2DCurve = new Plot2DCurve(curve);

            this.Children.Add(plot2DCurve);
            return(plot2DCurve);
        }
Esempio n. 5
0
        public Plot2DCurve AddLine(double[] x, double[] y)
        {
            Curve       curve       = new Curve(x, y);
            Plot2DCurve plot2DCurve = new Plot2DCurve(curve);

            this.Children.Add(plot2DCurve);
            return(plot2DCurve);
        }
Esempio n. 6
0
        public Plot2DCurve AddLine(double[] y, string quickLine)
        {
            double[]    x           = MathHelper.Counter(y.Length);
            Plot2DCurve plot2DCurve = AddLine(x, y);

            plot2DCurve.QuickLine = quickLine;
            return(plot2DCurve);
        }
Esempio n. 7
0
        protected static void OnAnnotationEnabledChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {
            Plot2DCurve localCurve = (Plot2DCurve)obj;

            if ((bool)e.NewValue == false)
            {
                localCurve.annotation.Visibility = Visibility.Collapsed;
            }
        }
Esempio n. 8
0
        void PlotFive(List<double> list1, List<double> list2)
        {
            int n = list1.Count;
            double[] x = new double[n];
            double[] y = new double[n];

            for (int i = 0; i < n; i++)
            {
                x[i] = i;
                y[i] = list1[i];
            }

            Plot2DCurve curve = plotfive.AddLine(x, y);

            curve.Stroke = Brushes.Blue; curve.StrokeThickness = 1.5;
            curve.Title = "Ankle flexion left";
            int n2 = list2.Count;

            double[] x2 = new double[n2];
            double[] y2 = new double[n2];

            for (int i = 0; i < n2; i++)
            {
                x2[i] = i;
                y2[i] = list2[i];
            }
            Plot2DCurve curve2 = new Plot2DCurve(new Curve(x2, y2)) { QuickLine = "r-" };
            plotfive.Children.Add(curve2);
            curve2.Title = "Ankle flexion right";
            plotfive.Legend.Background = Brushes.White;
            plotfive.BackgroundPlot = Brushes.White;

            plotfive.BottomLabel.Text = "Time";
            plotfive.LeftLabel.Text = "Ankle Dors-plantarflexion";
            plotfive.FontSize = 14;

            plotfive.Axes.XAxes[0].FontStyle = plotfive.Axes.YAxes[0].FontStyle = FontStyles.Oblique;

            plotfive.Axes.XAxes.Top.TickLength = 5;
            plotfive.Axes.YAxes.Left.TickLength = 5;

            plotfive.UseDirect2D = true;
        }
Esempio n. 9
0
        protected static void OnUseDirect2DChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {
            Plot2DCurve plot2DCurveLocal = ((Plot2DCurve)obj);

            if ((bool)e.NewValue == true && plot2DCurveLocal.lineD2D == null)
            {
                plot2DCurveLocal.lineD2D    = new DirectPath();
                plot2DCurveLocal.markersD2D = new DirectPathScatter()
                {
                    Curve = plot2DCurveLocal.curve
                };
                plot2DCurveLocal.BindToThis(plot2DCurveLocal.lineD2D, false, true);
                plot2DCurveLocal.BindToThis(plot2DCurveLocal.markersD2D, true, false);
            }
            if (plot2DCurveLocal.host == null)
            {
                return;
            }
            plot2DCurveLocal.RemoveElements((bool)e.OldValue);
            plot2DCurveLocal.AddElements();
        }
Esempio n. 10
0
        protected static void OnAnnotationPositionChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {
            Point       canvasPosition = (Point)e.NewValue;
            Plot2DCurve localCurve     = (Plot2DCurve)obj;

            if (Double.IsNaN(canvasPosition.X) || !localCurve.AnnotationEnabled)
            {
                localCurve.annotation.Visibility = Visibility.Collapsed;
                return;
            }
            else
            {
                localCurve.annotation.Visibility = Visibility.Visible;
            }
            int   index;
            Point curveCanvas = localCurve.SnappedCanvasPoint(canvasPosition, out index);

            localCurve.annotation.Annotation = localCurve.AnnotationFromPoint(new Point(localCurve.curve.x[index], localCurve.curve.y[index]));
            localCurve.annotation.SetValue(Canvas.LeftProperty, curveCanvas.X);
            localCurve.annotation.SetValue(Canvas.TopProperty, curveCanvas.Y);
            localCurve.annotation.InvalidateVisual();
        }
Esempio n. 11
0
        void Plot2DMultipleAxes()
        {
            // Example 2D plot:
            // First curve:
            Plot2DCurve curve1 = plotMultipleAxes.AddLine(new double[] { 1.2, 1.3, 2.8, 5.6, 1.9, -5.9 });
            curve1.Stroke = Brushes.Blue; curve1.StrokeThickness = 1.5; curve1.MarkersType = MarkersType.Square;
            // Second curve:
            int nPoints = 2000;
            double[] x = new double[nPoints];
            double[] y = new double[nPoints];
            Random rand = new Random();
            for (int i = 0; i < nPoints; ++i)
            {
                x[i] = i * 10.0 / (double)nPoints;
                y[i] = Math.Sin(x[i]) + 0.1 * Math.Sin(x[i] * 100);
            }
            Plot2DCurve curve2 = new Plot2DCurve(new Curve(x, y)) { QuickLine = "r-" };
            plotMultipleAxes.Children.Add(curve2);
            // Third curve:
            Plot2DCurve curve3 = new Plot2DCurve(new Curve(new double[] { 1, 3, 1.5, 7 }, new double[] { 4.5, 9.0, 3.2, 4.5 })) { StrokeThickness = 3.0, Stroke = Brushes.Green };
            curve3.QuickLine = "o";
            curve3.MarkersFill = Brushes.Blue;
            curve3.Title = "Test3";
            //curve3.QuickStrokeDash = QuickStrokeDash.Dash;
            plotMultipleAxes.Children.Add(curve3);
            // Can use Direct2D acceleration, but requires DirectX10 (Windows 7)
            //plotMultipleAxes.UseDirect2D = true; 
            //plotMultipleAxes.EqualAxes = true;

            // If you want to lose the gradient background:
            //plotMultipleAxes.Legend.Background = Brushes.White;
            //plotMultipleAxes.BackgroundPlot = Brushes.White;

            // Additional labels:
            //plotMultipleAxes.BottomLabel.Text = "Bottom label";
            //plotMultipleAxes.LeftLabel.Text = "Left label";
            plotMultipleAxes.FontSize = 14;
            plotMultipleAxes.Axes.XAxes[0].AxisLabel.Text = "Innermost X Axis";
            plotMultipleAxes.Axes.YAxes[0].AxisLabel.Text = "Innermost Y Axis";
            XAxis xAxisOuter = new XAxis(); YAxis yAxisOuter = new YAxis();
            xAxisOuter.AxisLabel.Text = "Added X Axis";
            yAxisOuter.AxisLabel.Text = "Added Y Axis";
            plotMultipleAxes.Axes.XAxes.Add(xAxisOuter);
            plotMultipleAxes.Axes.YAxes.Add(yAxisOuter);
            yAxisOuter.Position = YAxisPosition.Left;
            plotMultipleAxes.Axes.XAxes[0].FontStyle = plotMultipleAxes.Axes.YAxes[0].FontStyle = FontStyles.Oblique;
            //curve3.XAxis = xAxisOuter;
            curve3.YAxis = yAxisOuter;
            // Other alyout options to try:
            //plotMultipleAxes.Axes.EqualAxes = new AxisPair(plot1.Axes.XAxes.Bottom, plot1.Axes.YAxes.Left);
            //plotMultipleAxes.Axes.SetAxesEqual();
            //plotMultipleAxes.Axes.Height = 100;
            //plotMultipleAxes.Axes.Width = 500;
            //plotMultipleAxes.Axes.MinAxisMargin = new Thickness(200, 0, 0, 0);
            plotMultipleAxes.Axes.XAxes.Top.TickLength = 5;
            plotMultipleAxes.Axes.YAxes.Left.TickLength = 5;

            xAxisOuter.Min = 6.5e-5;
            xAxisOuter.Max = 7.3e-3;
            xAxisOuter.AxisType = AxisType.Log;
            plotMultipleAxes.Children.Add(new Plot2DCurve(new Curve(new double[] { 0.01, 10 }, new double[] { 5, 6 })) { XAxis = xAxisOuter });
            plotMultipleAxes.UseDirect2D = false;
        }
Esempio n. 12
0
        void PlotAlignment()
        {
            plot1.Axes.XAxes.First().BindToAxis(plot2.Axes.XAxes.First());
            plot2.Axes.XAxes.First().BindToAxis(plot3.Axes.XAxes.First());

            var curve1 = plot1.AddLine(new double[] { 0.5, 1.2, 2 }, new double[] { 0.7, 0.4, 0.5 });
            curve1.QuickLine = "o";
            curve1.MarkersFill = Brushes.Green;

            liveCurve = plot2.AddLine(new double[] {  }, new double[] {  });

            System.Timers.Timer aTimer = new System.Timers.Timer();
            aTimer.Elapsed += aTimer_Elapsed;
            aTimer.Interval = 1000;
            aTimer.Enabled = true;

            emptyCurve = plot3.AddLine(new double[] { });
        }
Esempio n. 13
0
 public Plot2DCurve AddLine(object x, object y)
 {
     Curve curve = new Curve(Plotting.Array(x), Plotting.Array(y));
     Plot2DCurve plot2DCurve = new Plot2DCurve(curve);
     this.Children.Add(plot2DCurve);
     return plot2DCurve;
 }
Esempio n. 14
0
 public Plot2DCurve AddLine(double[] x, double[] y)
 {
     Curve curve = new Curve(x, y);
     Plot2DCurve plot2DCurve = new Plot2DCurve(curve);
     this.Children.Add(plot2DCurve);
     return plot2DCurve;
 }