Esempio n. 1
0
        /// <summary>
        /// Gets the ordinate on the specified axis that is represented by the locating value
        /// </summary>
        /// <param name="locator">The ordinate that is to be displayed</param>
        /// <param name="axis">The axis on which the ordinate is required</param>
        /// <returns>The value of the ordinate that the point is to be drawn at</returns>
        static int GetPointOrdinate(double locator, axisParameters axis, bool horizontal)
        {
            double locatorToRepresent = locator + (horizontal ? -1 : 1) * axis.baseOffset;
            int    position           = (int)(axis.startLocation + (locatorToRepresent * axis.scaleFactor));

            return(position);
        }
Esempio n. 2
0
 public void SetupAxes(int xValues, double xStart, int yValues, double yStart)
 {
     horizontalAxis = new axisParameters()
     {
         axisLabelSpacing = (int)(xValues * 20 / (double)graphArea.Width),
         baseOffset       = 0,
         scaleFactor      = graphArea.Width / (double)xValues,
         startLocation    = (int)(xStart * graphArea.Width) + graphArea.Left
     };
     verticalAxis = new axisParameters()
     {
         axisLabelSpacing = (int)(yValues * 20 / (double)graphArea.Height),
         baseOffset       = 0,
         scaleFactor      = graphArea.Height / (double)yValues,
         startLocation    = (int)(yStart * graphArea.Height) + graphArea.Top
     };
 }
Esempio n. 3
0
 void Graph_VerticalAxisModified(object sender, axisParameters e)
 {
     Invalidate();
 }
Esempio n. 4
0
 void Graph_HorizontalAxisModified(object sender, axisParameters e)
 {
     Invalidate();
 }
Esempio n. 5
0
        public virtual void SetupAxes()
        {
            if (!AxesUserModified)
            {
                //If the user has not forced the axes to be displayed in a certain way
                if (traces.Count == 0)
                {
                    //No traces to use for scaling
                    horizontalAxis = verticalAxis = new axisParameters()
                    {
                        startLocation    = graphPadding.Left,
                        baseOffset       = 0,
                        scaleFactor      = 1,
                        axisLabelSpacing = 1
                    };
                }
                else
                {
                    //Set the axes based on the highest and lowest parameters in each axis.
                    double highX = traces[0].HighestX();
                    double highY = traces[0].HighestY();
                    double lowX  = traces[0].LowestX();
                    double lowY  = traces[0].LowestY();

                    for (int traceIndex = 1; traceIndex < traces.Count; traceIndex++)
                    {
                        if (traces[traceIndex].HighestX() > highX)
                        {
                            highX = traces[traceIndex].HighestX();
                        }
                        if (traces[traceIndex].HighestY() > highY)
                        {
                            highY = traces[traceIndex].HighestY();
                        }
                        if (traces[traceIndex].LowestX() < lowX)
                        {
                            lowX = traces[traceIndex].LowestX();
                        }
                        if (traces[traceIndex].LowestY() < lowY)
                        {
                            lowY = traces[traceIndex].LowestY();
                        }
                    }

                    horizontalAxis = new axisParameters()
                    {
                        baseOffset       = (int)lowX,
                        startLocation    = (int)(graphArea.Width * (-lowX / (highX - lowX))),
                        scaleFactor      = graphArea.Width / (highX - lowX),
                        axisLabelSpacing = 30
                    };
                    verticalAxis = new axisParameters()
                    {
                        baseOffset       = (int)lowY,
                        startLocation    = (int)(graphArea.Height * (highY / (highY - lowY))),
                        scaleFactor      = graphArea.Height / (highY - lowY),
                        axisLabelSpacing = 30
                    };
                }
            }
        }
Esempio n. 6
0
 public void SetupAxes(axisParameters xAxis, axisParameters yAxis)
 {
     horizontalAxis = xAxis;
     verticalAxis   = yAxis;
 }
Esempio n. 7
0
 public void SetVerticalAxis(axisParameters axis)
 {
     this.verticalAxis = axis;
     AxesUserModified  = true;
 }
Esempio n. 8
0
 public void SetHorizontalAxis(axisParameters axis)
 {
     this.horizontalAxis = axis;
     AxesUserModified    = true;
 }