Пример #1
0
 private void xAxis_AxisChanged(object sender, AxisChangedEventArgs args)
 {
     if (_plotsSynchronized == 1)
     {
         SynchronizePlotsByTimeAxis();
     }
 }
Пример #2
0
 /// <summary>
 /// Event handler for X Axis changed event.
 /// Updates Y axis when X axis changes
 /// </summary>
 /// <param name="sender">The sender LinearAxis</param>
 /// <param name="e">The event arguments</param>
 private void XAxisChanged(object sender, AxisChangedEventArgs e)
 {
     if (this.AutoAdjustYAxis)
     {   // Y axis is zoomed based on the the maximum visible point in the range selected by the X axis.
         this.AdjustForZoom();
     }
 }
Пример #3
0
        private void SynchronizeCharts(PlotModel plotModel, object sender, AxisChangedEventArgs e)
        {
            if (DateTime.Now.Subtract(_lastAxisAdjust).TotalMilliseconds < 100)
            {
                return;
            }
            _lastAxisAdjust = DateTime.Now;

            try
            {
                double xstart = plotModel.DefaultXAxis.ActualMinimum;
                double xend   = plotModel.DefaultXAxis.ActualMaximum;

                if (xstart < 0)
                {
                    xstart = 0;
                }

                foreach (var pm in PlotModels)
                {
                    // set x zoom only for the charts not being zoomed
                    if (pm.Title != plotModel.Title)
                    {
                        pm.DefaultXAxis.Zoom(xstart, xend);
                    }
                    pm.InvalidatePlot(true);
                }

                InitializeQueries();
            }
            finally
            {
                _lastAxisAdjust = DateTime.Now;
            }
        }
Пример #4
0
        protected void OnYAxisChange(object sender, AxisChangedEventArgs e)
        {
            var yAxis = sender as LinearAxis;

            if (yAxis == null)
            {
                return;
            }

            // Set to use 5 major labels no matter where you are zoomed
            if (yAxis.ActualMaximum > 1)
            {
                yAxis.MajorStep = yAxis.ActualMaximum / 5.0;
            }

            // No need to update anything else if the minimum is already <= 0
            if (yAxis.ActualMinimum <= 0)
            {
                return;
            }

            // Set the minimum to 0 and refresh the plot
            yAxis.Zoom(0, yAxis.ActualMaximum);

            yAxis.PlotModel.InvalidatePlot(true);
        }
Пример #5
0
        private void AxeY_AxisChanged(object sender, AxisChangedEventArgs e)
        {
            Axis ax = sender as Axis;

            if (e.ChangeType == AxisChangeTypes.Pan)
            {
                double delta = ax.ActualMaximum - ax.ActualMinimum;
                foreach (Axis axis in plotter.ActualModel.Axes)
                {
                    if ((axis.GetType() != typeof(DateTimeAxis)) && (axis != ax))
                    {
                        axis.Pan(e.DeltaMaximum * (axis.ActualMaximum - axis.ActualMinimum) / delta * axis.Scale * -1);
                    }
                }
            }
            if (e.ChangeType == AxisChangeTypes.Zoom)
            {
                double delta = (ax.ActualMaximum - e.DeltaMaximum) - (ax.ActualMinimum - e.DeltaMinimum);
                foreach (Axis axis in plotter.ActualModel.Axes)
                {
                    if ((axis.GetType() != typeof(DateTimeAxis)) && (axis != ax))
                    {
                        double z = e.DeltaMaximum * (axis.ActualMaximum - axis.ActualMinimum) / delta;
                        double x = e.DeltaMinimum * (axis.ActualMaximum - axis.ActualMinimum) / delta;
                        axis.Zoom(axis.ActualMinimum + x, axis.ActualMaximum + z);
                    }
                }
            }
            RenderTextAnnotaions();
        }
        void DateAxis_Changed(object sender, AxisChangedEventArgs e)
        {
            if (e.ChangeType != AxisChangeTypes.Zoom)
            {
                return;
            }

            if (PlotModel == null)
            {
                return;
            }

            var dateAxis = sender as DateTimeAxis;

            if (dateAxis == null)
            {
                return;
            }

            var dateMin = dateAxis.ActualMinimum;
            var dateMax = dateAxis.ActualMaximum;
            var delta   = dateMax - dateMin;

            //Debug.WriteLine($"min={dateMin}, max={dateMax}, delta={delta}");

            if (delta > YearScale_BreakPoint) // more than 280 days being shown
            {
                dateAxis.MinorStep    = YearScale_MinorStep;
                dateAxis.MajorStep    = YearScale_MajorStep;
                dateAxis.StringFormat = YearScale_AxisFormat;
            }
            else if (delta > ThirtyDayScale_BreakPoint) // more than 90 days being shown
            {
                dateAxis.MinorStep    = ThirtyDayScale_MinorStep;
                dateAxis.MajorStep    = ThirtyDayScale_MajorStep;
                dateAxis.StringFormat = ThirtyDayScale_AxisFormat;
            }
            else if (delta > WeekScale_BreakPoint) // more than 7 days being shown
            {
                dateAxis.MinorStep    = WeekScale_MinorStep;
                dateAxis.MajorStep    = WeekScale_MajorStep;
                dateAxis.StringFormat = WeekScale_AxisFormat;
            }
            else
            {
                dateAxis.MinorStep    = DayScale_MinorStep;
                dateAxis.MajorStep    = DayScale_MajorStep;
                dateAxis.StringFormat = DayScale_AxisFormat;
            }

            // update line thickness and dots based on zoom level for more clarity and less jumble when zoomed out
            if (PlotModel.Series != null && PlotModel.Series.Count > 0 && PlotModel.Series[0] is LineSeries)
            {
                var lineSeries = PlotModel.Series[0] as LineSeries;
                var factor     = delta / 30;                                                                                                       // TODO:: by default the view shows 30 days, need to tie this to a common variable
                lineSeries.MarkerSize      = Math.Min(Math.Max(Constants.UI.GraphMarkerSize / factor, 1), Constants.UI.GraphMarkerSize);           // don't let it get below 1 or over default
                lineSeries.StrokeThickness = Math.Min(Math.Max(Constants.UI.GraphStrokeThickness / factor, 1), Constants.UI.GraphStrokeThickness); // don't let it get below 1 or over default
            }
        }
Пример #7
0
        private void MyWindow_Sma_AxisChanged(object sender, AxisChangedEventArgs e)
        {
            _PricePlotView.Model.Axes[0].Maximum = _SmaPlotView.Model.Axes[0].ActualMaximum;

            _PricePlotView.Model.Axes[0].Minimum = _SmaPlotView.Model.Axes[0].ActualMinimum;

            _PricePlotView.InvalidatePlot(false);
        }
Пример #8
0
        private void MyWindow_Price_AxisChanged(object sender, AxisChangedEventArgs e)
        {
            //throw new NotImplementedException();

            _SmaPlotView.Model.Axes[0].Maximum = _PricePlotView.Model.Axes[0].ActualMaximum;

            _SmaPlotView.Model.Axes[0].Minimum = _PricePlotView.Model.Axes[0].ActualMinimum;
            _SmaPlotView.InvalidatePlot(false);
        }
Пример #9
0
        private void DetectorPlotY_AxisChanged(object sender, AxisChangedEventArgs e)
        {
            var axis = sender as OxyPlot.Axes.LinearAxis;

            YZoom?.Invoke(this, new Point()
            {
                min = axis.ActualMinimum,
                max = axis.ActualMaximum
            });
        }
Пример #10
0
        /// <summary>
        /// Handle changes to the bin axis.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BinAxis_AxisChanged(object sender, AxisChangedEventArgs e)
        {
            // Get the current selections
            double minBin = _binAxis.ActualMinimum;
            double maxBin = _binAxis.ActualMaximum;

            // Set the axis for the depth axis
            _depthAxis.Minimum = _blankSize + (minBin * _binSize);
            _depthAxis.Maximum = _blankSize + (maxBin * _binSize);
        }
Пример #11
0
        private void TrackAxis(AxisChangedEventArgs e)
        {
            var c           = Colors.White;
            var scaledValue = e.Value / _graphScale;

            if (e.Device.Name.ToLower().Contains("stick"))
            {
                switch (e.AxisId)
                {
                case 0:
                    c = Colors.Coral;
                    break;

                case 4:
                    c = Colors.Pink;
                    break;

                case 8:
                    c = Colors.Fuchsia;
                    break;
                }
            }

            if (e.Device.Name.ToLower().Contains("throttle"))
            {
                switch (e.AxisId)
                {
                case 0:
                    c = Colors.Red;
                    break;

                case 4:
                    c = Colors.Yellow;
                    break;

                case 8:
                    c = Colors.Cyan;
                    break;

                case 12:
                    c = Colors.MediumPurple;
                    break;

                case 16:
                    c = Colors.LimeGreen;
                    break;

                case 20:
                    c = Colors.DeepSkyBlue;
                    break;
                }
            }

            Dispatcher.InvokeAsync(() => Draw1(e.AxisId, scaledValue, c));
        }
Пример #12
0
 private void Axis_AxisChanged(object sender, AxisChangedEventArgs e)
 {
     if (e.ChangeType == AxisChangeTypes.Zoom)
     {
         DoLogic();
     }
     else if (e.ChangeType != AxisChangeTypes.Zoom)
     {
         return;
     }
 }
        private void AxisChanged(object?sender, AxisChangedEventArgs args)
        {
            if (args.ChangeType == AxisChangeTypes.Reset || sender is null)
            {
                return;
            }
            DateTimeAxis axis  = sender as DateTimeAxis;
            DateTime     dtMax = DateTime.FromOADate(axis.ActualMaximum);
            DateTime     dtMin = DateTime.FromOADate(axis.ActualMinimum);

            OnWindowChange(new ZoomEventArgs(dtMin, dtMax));
        }
        void DateAxis_Changed(object sender, AxisChangedEventArgs e)
        {
            if (e.ChangeType != AxisChangeTypes.Zoom)
            {
                return;
            }

            if (PlotModel == null)
            {
                return;
            }

            var dateAxis = sender as DateTimeAxis;

            if (dateAxis == null)
            {
                return;
            }

            var dateMin = dateAxis.ActualMinimum;
            var dateMax = dateAxis.ActualMaximum;
            var delta   = dateMax - dateMin;

            if (delta > YearScale_BreakPoint) // more than 280 days being shown
            {
                dateAxis.MinorStep    = YearScale_MinorStep;
                dateAxis.MajorStep    = YearScale_MajorStep;
                dateAxis.StringFormat = YearScale_AxisFormat;
            }
            else if (delta > ThirtyDayScale_BreakPoint) // more than 90 days being shown
            {
                dateAxis.MinorStep    = ThirtyDayScale_MinorStep;
                dateAxis.MajorStep    = ThirtyDayScale_MajorStep;
                dateAxis.StringFormat = ThirtyDayScale_AxisFormat;
            }
            else if (delta > WeekScale_BreakPoint) // more than 7 days being shown
            {
                dateAxis.MinorStep    = WeekScale_MinorStep;
                dateAxis.MajorStep    = WeekScale_MajorStep;
                dateAxis.StringFormat = WeekScale_AxisFormat;
            }
            else
            {
                dateAxis.MinorStep    = DayScale_MinorStep;
                dateAxis.MajorStep    = DayScale_MajorStep;
                dateAxis.StringFormat = DayScale_AxisFormat;
            }

            //Debug.WriteLine($"min={dateMin}, max={dateMax}, delta={delta}");
        }
Пример #15
0
        private void XAxis_AxisChanged(object sender, AxisChangedEventArgs e)
        {
            // Make sure to keep aspect ratio
            var xrange = Deg2Rad(xAxis.ActualMaximum - xAxis.ActualMinimum);
            var yrange = Deg2Rad(yAxis.ActualMaximum - yAxis.ActualMinimum);

            var xmid   = Deg2Rad(xAxis.ActualMaximum + xAxis.ActualMinimum) / 2;
            var ymid   = Deg2Rad(yAxis.ActualMaximum + yAxis.ActualMinimum) / 2;
            var nrange = xrange * Math.Cos(ymid);

            yAxis.Minimum = Rad2Deg(ymid - nrange / 2);
            yAxis.Maximum = Rad2Deg(ymid + nrange / 2);
            //throw new NotImplementedException();
        }
Пример #16
0
        private void _hotasDevice_AxisChanged(object sender, AxisChangedEventArgs e)
        {
            IBaseMapViewModel map;

            try
            {
                map = ButtonMap.FirstOrDefault(axis => axis.ButtonId == e.AxisId);
            }
            catch (Exception exception)
            {
                Logging.Log.Fatal(exception);
                return;
            }
            map?.SetAxis(e.Value);
        }
Пример #17
0
        public void OnAxisChanged(object sender, AxisChangedEventArgs e)
        {
            if (isInternalChange)
            {
                return;
            }
            LinearAxis axis = sender as LinearAxis;

            if (axis == null)
            {
                return;
            }

            OnAxisChanged(axis);
        }
Пример #18
0
        /// <summary>
        /// Event handler for XAxis changed to update area ratio labels when shared x axis is zoomed or panned.
        /// </summary>
        /// <param name="sender">The x Axis that sent the event</param>
        /// <param name="e">The event arguments</param>
        private void XAxisChanged(object sender, AxisChangedEventArgs e)
        {
            if (!this.axisInternalChange)
            {
                this.axisInternalChange = true;
                this.axisInternalChange = true;
                var axis = sender as LinearAxis;
                if (axis == null)
                {
                    return;
                }

                this.UpdateAxesRecursive(axis, new HashSet <LinearAxis>());
                this.axisInternalChange = false;
            }
        }
        private void TimeXAxis_AxisChanged(object sender, AxisChangedEventArgs e)
        {
            var xAxis = sender as DateTimeAxis;

            foreach (var plot in SignalPlots)
            {
                foreach (var ax in plot.SignalViewPlotModel.Axes)
                {
                    if (ax.IsHorizontal() && (ax.ActualMaximum != xAxis.ActualMaximum || ax.ActualMinimum != xAxis.ActualMinimum))
                    {
                        ax.Zoom(xAxis.ActualMinimum, xAxis.ActualMaximum);
                        plot.SignalViewPlotModel.InvalidatePlot(false);
                        break;
                    }
                }
            }
        }
        private void OnYAxisChange(object sender, AxisChangedEventArgs e)
        {
            var yAxis = sender as LinearAxis;

            if (yAxis == null)
            {
                return;
            }

            // No need to update anything if the minimum is already <= 0
            if (yAxis.ActualMinimum <= 0)
            {
                return;
            }

            // Set the minimum to 0 and refresh the plot
            yAxis.Zoom(0, yAxis.ActualMaximum);
            yAxis.PlotModel.InvalidatePlot(true);
        }
Пример #21
0
        private void Update(object sender, AxisChangedEventArgs args)
        {
            Thread[] threads = new Thread[3];

            threads[0] = new Thread(() => Target(Fn1, OxyColors.Red));
            threads[1] = new Thread(() => Target(Fn2, OxyColors.Green));
            threads[2] = new Thread(() => Target(Fn3, OxyColors.Blue));

            foreach (Thread t in threads)
            {
                t.Start();
            }

            foreach (Thread t in threads)
            {
                t.Join();
            }

            min = GetMinimum(1);
            max = GetMaximum(1);
        }
Пример #22
0
 private void XAxis_Changed(object sender, AxisChangedEventArgs e) => IsExportable = false;
        private void OnYAxisChange(object sender, AxisChangedEventArgs e)
        {
            LinearAxis yAxis = sender as LinearAxis;

            // No need to update anything if the minimum is already <= 0
            if (yAxis.ActualMinimum <= 0) return;

            // Set the minimum to 0 and refresh the plot
            yAxis.Zoom(0, yAxis.ActualMaximum);
            yAxis.PlotModel.RefreshPlot(true);
        }
Пример #24
0
 private void AxisChangedHandler(object sender, AxisChangedEventArgs e)
 {
     TrackAxis(e);
 }
        private void AxisChangedHandler(object sender, AxisChangedEventArgs e)
        {
            Logging.Log.Debug($"Device:{e.Device.Name}, Axis:{e.AxisId}, Value:{e.Value}");

            AppDispatcher.Invoke(Go);
        }
Пример #26
0
 void dateAxis_AxisChanged(object sender, AxisChangedEventArgs e)
 {
     
 }
Пример #27
0
 private void OnAxisChanged(object sender, AxisChangedEventArgs axisChangedEventArgs)
 {
     if (sender != null)
     {
     }
 }
 private void DateTimeAxis_AxisChanged(object sender, AxisChangedEventArgs e)
 {
     //Strzałka w prawo inforumująca że wykres wychodzi poza zakres
     //Console.WriteLine("Oś się zmieniła " + e.ChangeType + " " + e.DeltaMaximum);
 }
Пример #29
0
 private void TimeLineAxis_AxisChanged(object sender, AxisChangedEventArgs e)
 {
     if (e.ChangeType == AxisChangeTypes.Zoom)
     {
     }
 }
Пример #30
0
 private void XAxisOnAxisChanged(object sender, AxisChangedEventArgs axisChangedEventArgs)
 {
     ZoomY();
 }
Пример #31
0
 private void OnTimeAxisChanged(object sender, AxisChangedEventArgs e)
 {
 }
 void l_BottomAxis_AxisChanged(object sender, AxisChangedEventArgs e)
 {
     m_ActualMinimumDate = DateTimeAxis.ToDateTime(this.oxyMainPlot.Model.DefaultXAxis.ActualMinimum);
 }
 void l_SideAxis_AxisChanged(object sender, AxisChangedEventArgs e)
 {
     double l_PlotHeight = oxyMainPlot.Model.DefaultYAxis.ActualMaximum - oxyMainPlot.Model.DefaultYAxis.ActualMinimum;
     sldTopLine.Maximum = this.oxyMainPlot.Model.DefaultYAxis.ActualMaximum;
     sldTopLine.Minimum = this.oxyMainPlot.Model.DefaultYAxis.ActualMinimum;
     sldBottomLine.Minimum = this.oxyMainPlot.Model.DefaultYAxis.ActualMinimum;
     sldBottomLine.Maximum = this.oxyMainPlot.Model.DefaultYAxis.ActualMaximum;
     oxyMainPlot.Model.DefaultYAxis.AbsoluteMinimum = m_TopLine.Y - l_PlotHeight + l_PlotHeight*0.05;
     oxyMainPlot.Model.DefaultYAxis.AbsoluteMaximum = m_BottomLine.Y + l_PlotHeight - l_PlotHeight*0.05;
 }
        private void OnXAxisChange(object sender, AxisChangedEventArgs e)
        {
            LinearAxis axis = sender as LinearAxis;

            _xAxisIsChangedInternally = true;

            MSGraphMinX = axis.ActualMinimum;
            MSGraphMaxX = axis.ActualMaximum;

            _xAxisIsChangedInternally = false;
        }
Пример #35
0
 private void AxeX_AxisChanged(object sender, AxisChangedEventArgs e)
 {
     RenderTextAnnotaions();
 }