/// <summary> /// Draw the <see c_ref="ErrorBar"/> to the specified <see c_ref="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 c_ref="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 c_ref="ErrorBar"/> is the X axis. True for an <see c_ref="XAxis"/> base, /// false for a <see c_ref="YAxis"/> or <see c_ref="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 c_ref="PaneBase.BaseDimension"/>. This /// scaling factor is calculated by the <see c_ref="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 c_ref="Color"/> and /// <see c_ref="PenWidth"/> for this <see c_ref="ErrorBar"/></param> /// <param name="dataValue">The data value to be used for a value-based /// color gradient. This is only applicable for <see c_ref="FillType.GradientByX"/>, /// <see c_ref="FillType.GradientByY"/> or <see c_ref="FillType.GradientByZ"/>.</param> /// <param name="isSelected">Indicates that the <see c_ref="ErrorBar" /> should be drawn /// with attributes from the <see c_ref="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); } }
/// <summary> /// Draw a legend key entry for this <see c_ref="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 c_ref="ZedGraph.GraphPane"/> object that is the parent or /// owner of this object. /// </param> /// <param name="rect">The <see c_ref="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 c_ref="ZedGraph.GraphPane"/> object using the /// <see c_ref="PaneBase.CalcScaleFactor"/> method, and is used to proportionally adjust /// font sizes, etc. according to the actual size of the graph. /// </param> override public void DrawLegendKey(Graphics g, GraphPane pane, RectangleF rect, float scaleFactor) { // Draw a sample curve to the left of the label text int xMid = (int)(rect.Left + rect.Width / 2.0F); int yMid = (int)(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, xMid, yMid, scaleFactor, false, null); }