コード例 #1
0
 public void Remove(PlotDataSet newPlotDataSet)
 {
     List.Remove(newPlotDataSet);
 }
コード例 #2
0
 public void Add(PlotDataSet newPlotDataSet)
 {
     List.Add(newPlotDataSet);
 }
コード例 #3
0
        public static PlotDataSet GetTickIntervals(float min, float max)
        {
            float       tick_size_ref;
            float       tick_size = 1;
            float       tick_value_now;
            float       temp;
            int         temp_i;
            PlotDataSet tick_values = new PlotDataSet("tick values", VariableType.Float);

            // Get range
            tick_size_ref = (max - min) / 5;
            // Determin tick size
            if (tick_size_ref >= tick_size)
            {
                while (tick_size_ref >= tick_size)
                {
                    tick_size = tick_size * 10;
                }
                tick_size = tick_size / 10;
            }
            else
            {
                while (tick_size_ref < tick_size)
                {
                    tick_size = tick_size / 10;
                }
            }
            if (tick_size * 5 <= tick_size_ref)
            {
                tick_size = tick_size * 5f;
            }
            else if (tick_size * 2 <= tick_size_ref)
            {
                tick_size = tick_size * 2f;
            }
            // Determin min tick value
            temp_i         = (int)(min / tick_size) - 1;
            tick_value_now = tick_size * (float)temp_i;
            while (tick_value_now < min)
            {
                temp            = tick_value_now;
                tick_value_now += tick_size;
                if (tick_value_now == temp)
                {
                    // Reached limit of float
                    return(null);
                }
            }
            // Get tick intervals
            while (tick_value_now < max)
            {
                tick_values.Add(tick_value_now);
                temp            = tick_value_now;
                tick_value_now += tick_size;
                if (tick_value_now == temp)
                {
                    // Reached limit of float
                    return(null);
                }
            }
            return(tick_values);
        }