NPlot.PhysicalAxis.WorldToPhysical C# (CSharp) Метод

WorldToPhysical() публичный Метод

Given a world coordinate value, returns the physical position of the coordinate along the axis.
public WorldToPhysical ( double coord, bool clip ) : PointF
coord double the world coordinate
clip bool if true, the physical position returned will be clipped to the physical max / min position as appropriate if the world value is outside the limits of the axis.
Результат PointF
        public PointF WorldToPhysical(double coord, bool clip)
        {
            return Axis.WorldToPhysical(coord, PhysicalMin, PhysicalMax, clip);
        }

Usage Example

Пример #1
0
        /// <summary>
        /// Draws the point plot on a GDI+ surface against the provided x and y axes.
        /// </summary>
        /// <param name="g">The GDI+ surface on which to draw.</param>
        /// <param name="xAxis">The X-Axis to draw against.</param>
        /// <param name="yAxis">The Y-Axis to draw against.</param>
        public virtual void Draw(IGraphics g, PhysicalAxis xAxis, PhysicalAxis yAxis)
        {
            SequenceAdapter data_ =
                new SequenceAdapter(DataSource, DataMember, OrdinateData, AbscissaData);

            float leftCutoff_  = xAxis.PhysicalMin.X - Marker.Size;
            float rightCutoff_ = xAxis.PhysicalMax.X + Marker.Size;

            for (int i = 0; i < data_.Count; ++i)
            {
                if (!Double.IsNaN(data_[i].X) && !Double.IsNaN(data_[i].Y))
                {
                    PointF xPos = xAxis.WorldToPhysical(data_[i].X, false);
                    if (xPos.X < leftCutoff_ || rightCutoff_ < xPos.X)
                    {
                        continue;
                    }

                    PointF yPos = yAxis.WorldToPhysical(data_[i].Y, false);
                    Marker.Draw(g, (int)xPos.X, (int)yPos.Y);
                    if (Marker.DropLine)
                    {
                        PointD yMin   = new PointD(data_[i].X, Math.Max(0.0f, yAxis.Axis.WorldMin));
                        PointF yStart = yAxis.WorldToPhysical(yMin.Y, false);
                        g.DrawLine(Marker.Pen, new Point((int)xPos.X, (int)yStart.Y), new Point((int)xPos.X, (int)yPos.Y));
                    }
                }
            }
        }
All Usage Examples Of NPlot.PhysicalAxis::WorldToPhysical