Пример #1
0
 public override void ChangeDrawArea()
 {
     if (autoYToolStripMenuItem.Checked)
     {
         SelArea.SetChartDrawAreaLimitedY(AxisX, AxisY, k_X.ToArray(), exp_Y.ToArray(), fit_Y.ToArray());
     }
     else
     {
         base.ChangeDrawArea();
     }
 }
Пример #2
0
        public override void ChangeDrawArea()
        {
            if (autoYToolStripMenuItem.Checked)
            {
                double ymax = -1;
                double xmin = AxisX.PixelPositionToValue(Math.Min(SelArea.X0, SelArea.X1));
                double xmax = AxisX.PixelPositionToValue(Math.Max(SelArea.X0, SelArea.X1));
                foreach (var s in chart.Series)
                {
                    for (int i = 0; i < s.Points.Count; i++)
                    {
                        //範囲内での絶対値最大の値を探す
                        if (ymax < 0)
                        {
                            ymax = Math.Abs(s.Points[i].YValues[0]);
                        }
                        else
                        {
                            ymax = Math.Max(ymax, s.Points.Max(
                                                t => (t.XValue >= xmin && t.XValue <= xmax) ? Math.Abs(t.YValues[0]) : 0
                                                ));
                        }
                    }
                }
                if (ymax < 0)
                {
                    return;
                }


                SelArea.SetChartDrawAreaLimitedY(AxisX, AxisY, ymax);
            }
            else
            {
                base.ChangeDrawArea();
            }
        }