Example #1
0
 private void Refresh2()
 {
     XMinChanged?.Invoke(this, new EventArgs());
     XMaxChanged?.Invoke(this, new EventArgs());
     YMinChanged?.Invoke(this, new EventArgs());
     YMaxChanged?.Invoke(this, new EventArgs());
     _refreshFunctions();
 }
Example #2
0
 private void AutoScaleSmooth()
 {
     ChartAreas[0].AxisY.Minimum = double.NaN; //min;
     ChartAreas[0].AxisY.Maximum = double.NaN; //max;
     ChartAreas[0].RecalculateAxesScale();     //this.Update();
     XMinChanged?.Invoke(this, new EventArgs());
     XMaxChanged?.Invoke(this, new EventArgs());
     YMinChanged?.Invoke(this, new EventArgs());
     YMaxChanged?.Invoke(this, new EventArgs());
     NotifyPropertyChanged("XyRatio");
 }
Example #3
0
        private void AutoScaleHard()
        {
            double Xmax = double.MinValue, Xmin = double.MaxValue;
            double Ymax = double.MinValue, Ymin = double.MaxValue;

            foreach (var serie in Series)
            {
                if (serie.Points.Count > 0)
                {
                    var f = serie.Points.Max(p => p.YValues.Max());
                    if (f > Ymax)
                    {
                        Ymax = f;
                    }

                    f = serie.Points.Min(p => p.YValues.Min());
                    if (f < Ymin)
                    {
                        Ymin = f;
                    }

                    f = serie.Points.Max(p => p.XValue);

                    if (f > Xmax)
                    {
                        Xmax = f;
                    }

                    f = serie.Points.Min(p => p.XValue);
                    if (f < Xmin)
                    {
                        Xmin = f;
                    }
                }
            }
            ChartAreas[0].AxisX.Minimum = Xmin;
            ChartAreas[0].AxisX.Maximum = Xmax;

            ChartAreas[0].AxisY.Minimum = Ymin; //min;
            ChartAreas[0].AxisY.Maximum = Ymax; //max;
            XMinChanged?.Invoke(this, new EventArgs());
            XMaxChanged?.Invoke(this, new EventArgs());
            YMinChanged?.Invoke(this, new EventArgs());
            YMaxChanged?.Invoke(this, new EventArgs());
            NotifyPropertyChanged("XyRatio");
        }
Example #4
0
        private void zoomIn()
        {
            var any = false;

            /*
             * >> floor(log10(756))
             * ans = 3
             */

            var xScale = Math.Pow(10, Math.Ceiling(Math.Log10(Math.Abs(XMax - XMin) / 2.0) - 1));
            var yScale = Math.Pow(10, Math.Ceiling(Math.Log10(Math.Abs(YMax - YMin) / 2.0) - 1));

            /*
             * distance ϵ (0,2) => scale = floor(log10(distance))
             * distance ϵ <2,200> => scale = 1.0
             * (0,2) =>
             */


            scalingFactor = Math.Pow(10, Math.Ceiling(Math.Log10(Math.Abs(XMax - XMin))));
            //(0.1*Math.Abs(XMax - XMin)).RoundToSignificantDigits(0);

            if (/*Math.Abs(XMax - XMin) > 2 * scalingFactor &&*/ !yOnlyZoomMode)
            {
                ChartAreas[0].AxisX.Minimum += xScale;
                ChartAreas[0].AxisX.Maximum -= xScale;
                any = true;
            }
            if (/*Math.Abs(YMax - YMin) > 2 * scalingFactor &&*/ !xOnlyZoomMode)
            {
                ChartAreas[0].AxisY.Minimum += yScale;
                ChartAreas[0].AxisY.Maximum -= yScale;
                any = true;
            }
            if (any)
            {
                _refreshFunctions();
                XMinChanged?.Invoke(this, new EventArgs());
                XMaxChanged?.Invoke(this, new EventArgs());
                YMinChanged?.Invoke(this, new EventArgs());
                YMaxChanged?.Invoke(this, new EventArgs());
            }
        }
Example #5
0
        private void zoomOut()
        {
            var xScale = Math.Pow(10, maxCeiling(Math.Log10(Math.Abs(XMax - XMin) / 2.0) - 1));
            var yScale = Math.Pow(10, maxCeiling(Math.Log10(Math.Abs(YMax - YMin) / 2.0) - 1));


            if (!yOnlyZoomMode)
            {
                ChartAreas[0].AxisX.Minimum -= xScale;
                ChartAreas[0].AxisX.Maximum += xScale;
                XMinChanged?.Invoke(this, new EventArgs());
                XMaxChanged?.Invoke(this, new EventArgs());
            }
            if (!xOnlyZoomMode)
            {
                ChartAreas[0].AxisY.Minimum -= yScale;
                ChartAreas[0].AxisY.Maximum += yScale;
                YMinChanged?.Invoke(this, new EventArgs());
                YMaxChanged?.Invoke(this, new EventArgs());
            }
            _refreshFunctions();
        }