Ejemplo n.º 1
0
 public void ClearAxisLines()
 {
     for (int i = 0; i < plotObjects.Count; i++)
     {
         Plottables.PlottableThing plotObject = plotObjects[i];
         if (plotObject is Plottables.AxLine)
         {
             plotObjects[i] = null;
         }
     }
     plotObjects.RemoveAll(item => item == null);
 }
Ejemplo n.º 2
0
        public double[] GetAxisLimits()
        {
            if (plotObjects.Count() == 0)
            {
                return(null);
            }

            double xMin = 0;
            double xMax = 0;
            double yMin = 0;
            double yMax = 0;

            // then expand as needed
            for (int i = 0; i < plotObjects.Count(); i++)
            {
                Plottables.PlottableThing thing = plotObjects[i];
                double[] axisLimits             = thing.AxisLimits();

                // skip things without clear axes
                if (axisLimits is null)
                {
                    continue;
                }

                if (xMin == xMax)
                {
                    // if this is the first, use all limits
                    xMin = axisLimits[0];
                    xMax = axisLimits[1];
                    yMin = axisLimits[2];
                    yMax = axisLimits[3];
                }
                else
                {
                    // otherwise use if expanding
                    xMin = Math.Min(xMin, axisLimits[0]);
                    xMax = Math.Max(xMax, axisLimits[1]);
                    yMin = Math.Min(yMin, axisLimits[2]);
                    yMax = Math.Max(yMax, axisLimits[3]);
                }
            }

            return(new double[] { xMin, xMax, yMin, yMax });
        }