Beispiel #1
0
 /// <summary>
 /// Draw the <see cref="ErrorBar"/> to the specified <see cref="Graphics"/>
 /// device at the specified location.
 /// </summary>
 /// <param name="g">
 /// A graphic device object to be drawn into.  This is normally e.Graphics from the
 /// PaintEventArgs argument to the Paint() method.
 /// </param>
 /// <param name="pane">
 /// A reference to the <see cref="GraphPane"/> object that is the parent or
 /// owner of this object.
 /// </param>
 /// <param name="isXBase">boolean value that indicates if the "base" axis for this
 /// <see cref="ErrorBar"/> is the X axis.  True for an <see cref="XAxis"/> base,
 /// false for a <see cref="YAxis"/> or <see cref="Y2Axis"/> base.</param>
 /// <param name="pixBase">The independent axis position of the center of the error bar in
 /// pixel units</param>
 /// <param name="pixValue">The dependent axis position of the top of the error bar in
 /// pixel units</param>
 /// <param name="pixLowValue">The dependent axis position of the bottom of the error bar in
 /// pixel units</param>
 /// <param name="scaleFactor">
 /// The scaling factor for the features of the graph based on the <see cref="PaneBase.BaseDimension"/>.  This
 /// scaling factor is calculated by the <see cref="PaneBase.CalcScaleFactor"/> method.  The scale factor
 /// represents a linear multiple to be applied to font sizes, symbol sizes, etc.</param>
 /// <param name="pen">A pen with attributes of <see cref="Color"/> and
 /// <see cref="PenWidth"/> for this <see cref="ErrorBar"/></param>
 /// <param name="dataValue">The data value to be used for a value-based
 /// color gradient.  This is only applicable for <see cref="FillType.GradientByX"/>,
 /// <see cref="FillType.GradientByY"/> or <see cref="FillType.GradientByZ"/>.</param>
 /// <param name="isSelected">Indicates that the <see cref="ErrorBar" /> should be drawn
 /// with attributes from the <see cref="Selection" /> class.
 /// </param>
 public void Draw(
     Graphics g,
     GraphPane pane,
     bool isXBase,
     float pixBase,
     float pixValue,
     float pixLowValue,
     float scaleFactor,
     Pen pen,
     bool isSelected,
     PointPair dataValue)
 {
     if (isXBase)
     {
         g.DrawLine(pen, pixBase, pixValue, pixBase, pixLowValue);
         _symbol.DrawSymbol(
             g,
             pane,
             (int)pixBase,
             (int)pixValue,
             scaleFactor,
             isSelected,
             dataValue);
         _symbol.DrawSymbol(
             g,
             pane,
             (int)pixBase,
             (int)pixLowValue,
             scaleFactor,
             isSelected,
             dataValue);
     }
     else
     {
         g.DrawLine(pen, pixValue, pixBase, pixLowValue, pixBase);
         _symbol.DrawSymbol(
             g,
             pane,
             (int)pixValue,
             (int)pixBase,
             scaleFactor,
             isSelected,
             dataValue);
         _symbol.DrawSymbol(
             g,
             pane,
             (int)pixLowValue,
             (int)pixBase,
             scaleFactor,
             isSelected,
             dataValue);
     }
 }
Beispiel #2
0
        /// <summary>
        /// Render this object to the specified <see cref="Graphics"/> device.
        /// </summary>
        /// <remarks>
        /// This method is normally only called by the Draw method
        /// of the parent <see cref="GraphObjList"/> collection object.
        /// </remarks>
        /// <param name="g">
        /// A graphic device object to be drawn into.  This is normally e.Graphics from the
        /// PaintEventArgs argument to the Paint() method.
        /// </param>
        /// <param name="pane">
        /// A reference to the <see cref="PaneBase"/> object that is the parent or
        /// owner of this object.
        /// </param>
        /// <param name="scaleFactor">
        /// The scaling factor to be used for rendering objects.  This is calculated and
        /// passed down by the parent <see cref="GraphPane"/> object using the
        /// <see cref="PaneBase.CalcScaleFactor"/> method, and is used to proportionally adjust
        /// font sizes, etc. according to the actual size of the graph.
        /// </param>
        override public void Draw(Graphics g, PaneBase pane, float scaleFactor)
        {
            var gPane = pane as GraphPane;

            if (pane == null)
            {
                return;
            }

            // Convert the arrow coordinates from the user coordinate system
            // to the screen coordinate system
            var pix = GetLocation(gPane, scaleFactor);

            Symbol.DrawSymbol(g, gPane, Type, pix.X, pix.Y, Size, IsVisible, Fill, Border, scaleFactor, false, new PointPair());
        }
Beispiel #3
0
        /// <summary>
        /// Draw a legend key entry for this <see cref="LineItem"/> at the specified location
        /// </summary>
        /// <param name="g">
        /// A graphic device object to be drawn into.  This is normally e.Graphics from the
        /// PaintEventArgs argument to the Paint() method.
        /// </param>
        /// <param name="pane">
        /// A reference to the <see cref="ZedGraph.GraphPane"/> object that is the parent or
        /// owner of this object.
        /// </param>
        /// <param name="rect">The <see cref="RectangleF"/> struct that specifies the
        /// location for the legend key</param>
        /// <param name="scaleFactor">
        /// The scaling factor to be used for rendering objects.  This is calculated and
        /// passed down by the parent <see cref="ZedGraph.GraphPane"/> object using the
        /// <see cref="PaneBase.CalcScaleFactor"/> method, and is used to proportionally adjust
        /// font sizes, etc. according to the actual size of the graph.
        /// </param>
        public override void DrawLegendKey(Graphics g, GraphPane pane, RectangleF rect, float scaleFactor)
        {
            // Draw a sample curve to the left of the label text
            float yMid = rect.Top + rect.Height / 2.0F;

            //RectangleF rect2 = rect;
            //rect2.Y = yMid;
            //rect2.Height = rect.Height / 2.0f;

            _line.Fill.Draw(g, rect);

            _line.DrawSegment(g, pane, rect.Left, yMid, rect.Right, yMid, scaleFactor);

            // Draw a sample symbol to the left of the label text
            _symbol.DrawSymbol(g, pane, rect.Left + rect.Width / 2.0F, yMid, scaleFactor, null);
        }