示例#1
0
 /// <summary>
 /// Get AxisData (Min, Max, Step) from double[][] array
 /// </summary>
 /// <param name="f">double[][]</param>
 /// <returns>AxisData</returns>
 public static AxisData  Transform(double[][] f)
 {
     return(GraphMath.AxisScale(TransformNoScale(f)));
 }
示例#2
0
        /// <summary>
        /// Do not draw grid
        /// </summary>
        //public bool NoGrid{get{return nogrid;}set{nogrid = value;}}
        #endregion

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="cd">Chart Data</param>
        public DrawGrid(ChartDataList cds) : base()
        {
            //Initialize fields
            this.X         = cds.AxisRangeX;
            this.Y         = cds.AxisRangeY;
            this.GridColor = Color.LightGray;

            xAxisType = cds.AxisTypeX;
            yAxisType = cds.AxisTypeY;

            //Check if were gonna do autoscale
            if (cds.AutoScale)
            {
                //Scale X values
                if (this.XAxisType == AxisType.LOG)
                {
                    this.X = GraphMath.TransformLogX(cds.AxisRangeX.Min, cds.AxisRangeX.Max);
                }
                else
                {
                    this.X = GraphMath.AxisScale(cds.AxisRangeX);
                }

                //Scale Y values
                if (this.YAxisType == AxisType.LOG)
                {
                    this.Y = GraphMath.TransformLogY(cds.AxisRangeY.Min, cds.AxisRangeY.Max);
                }
                else
                {
                    this.Y = GraphMath.AxisScale(cds.AxisRangeY);
                }
            }
            else
            {
                //Scale X values with axisdata for X as limiter
                if (this.XAxisType == AxisType.LOG)
                {
                    this.X = GraphMath.TransformLog(X, GraphMath.TransformLogX(cds.AxisRangeX.Min, cds.AxisRangeX.Max));
                }
                else
                if (((X.Max - X.Min) / X.Step) > 30)
                {
                    this.X = GraphMath.AxisScale(cds.AxisRangeX);
                }


                //Scale Y values with axisdata for Y as limiter
                if (this.YAxisType == AxisType.LOG)
                {
                    this.Y = GraphMath.TransformLog(Y, GraphMath.TransformLogY(cds.AxisRangeY.Min, cds.AxisRangeY.Max));
                }
                else
                if (((Y.Max - Y.Min) / Y.Step) > 30)
                {
                    this.Y = GraphMath.AxisScale(cds.AxisRangeY);
                }
            }

            if (cds.Length > 0)
            {
                showzero = cds[0].ShowZero;
            }
        }