本文整理汇总了C#中ZedGraph.CurveItem类的典型用法代码示例。如果您正苦于以下问题:C# CurveItem类的具体用法?C# CurveItem怎么用?C# CurveItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CurveItem类属于ZedGraph命名空间,在下文中一共展示了CurveItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawSmoothFilledCurve
public override void DrawSmoothFilledCurve(IGraphics g, GraphPane pane, CurveItem curve, float scaleFactor)
{
base.DrawSmoothFilledCurve(g, pane, curve, scaleFactor);
// Draw the curve at the bottom of the graph.
DrawCurve(g, pane, curve, scaleFactor, GetPointsForLowPointsArray(curve));
}
示例2: DrawCurve
public DrawCurve(CurveItem _curve, string _curveName, GraphPane _pane, string _paneName)
{
CurveName = _curveName;
PaneName = _paneName;
Curve = _curve;
Pane = _pane;
}
示例3: Select
//public static Color SelectedSymbolColor = Color.Gray;
#endregion
#region Methods
/// <summary>
/// Place a <see cref="CurveItem" /> in the selection list, removing all other
/// items.
/// </summary>
/// <param name="master">The <see cref="MasterPane" /> that is the "owner"
/// of the <see cref="CurveItem" />'s.</param>
/// <param name="ci">The <see cref="CurveItem" /> to be added to the list.</param>
public void Select( MasterPane master, CurveItem ci )
{
//Clear the selection, but don't send the event,
//the event will be sent in "AddToSelection" by calling "UpdateSelection"
ClearSelection( master, false );
AddToSelection( master, ci );
}
示例4: MyPointValueHandler
private string MyPointValueHandler(ZedGraphControl control, GraphPane pane,
CurveItem curve, int iPt)
{
// Get the PointPair that is under the mouse
PointPair pt = curve[iPt];
return curve.Label.Text + " IV is " + pt.Y.ToString("f2") + "% " + pt.X.ToString("f1") + " strike";
}
示例5: FindCurveHandler
/// <summary>
/// Returns a new instance of a <see cref="ICurveDataHandler"/> appropriate for the
/// <paramref name="curveItem"/>.
/// </summary>
public static ICurveDataHandler FindCurveHandler(CurveItem curveItem)
{
var handlerClass = curveItem.GetType().GetCustomAttributes(typeof (CurveDataHandlerAttribute), true)
.Cast<CurveDataHandlerAttribute>().Select(attribute=>attribute.Class)
.FirstOrDefault() ??
((curveItem is HiLowBarItem) ? typeof (HiLowBarDataHandler) : typeof (CurveDataHandler));
var constructorInfo = handlerClass.GetConstructor(new Type[0]);
if (constructorInfo != null)
return (ICurveDataHandler) constructorInfo.Invoke(new object[0]);
return null;
}
示例6: DimensionContainsNonZeroData
static bool[] DimensionContainsNonZeroData(CurveItem curve)
{
bool[] ret = new bool[3];
for(int i = 0; i < curve.NPts; i++)
{
PointPair pp = curve.Points[i];
if (pp.X != 0) ret[0] = true;
if (pp.Y != 0) ret[1] = true;
if (pp.Z != 0) ret[2] = true;
}
return ret;
}
示例7: WriteDataRow
static void WriteDataRow(CurveItem curve, bool[] validDims, int row, StreamWriter writer)
{
if (row < curve.NPts)
{
if (validDims[0]) WriteDouble(curve.Points[row].X, writer);
if (validDims[1]) WriteDouble(curve.Points[row].Y, writer);
if (validDims[2]) WriteDouble(curve.Points[row].Z, writer);
}
else
{
if (validDims[0]) WriteElement("", writer);
if (validDims[1]) WriteElement("", writer);
if (validDims[2]) WriteElement("", writer);
}
}
示例8: CloseCurve
public override void CloseCurve(GraphPane pane, CurveItem curve, PointF[] arrPoints, int count, double yMin, System.Drawing.Drawing2D.GraphicsPath path)
{
if(pane.LineType == LineType.Stack)
throw new NotSupportedException("Filled lines cannot be stacked");
FilledLineItem filledCurve = curve as FilledLineItem;
if(filledCurve == null)
throw new ArgumentException("Curve was of the wrong type. Expected FilledLineItem but was " + curve.GetType(), "curve");
// Build another points array consisting of the low points (It gets these from the LowerPoints property of the curve)
PointF[] arrPoints2;
int count2;
BuildLowPointsArray(pane, curve, out arrPoints2, out count2);
// Add the new points to the GraphicsPath
float tension = _isSmooth ? _smoothTension : 0f;
path.AddCurve(arrPoints2, 0, count2 - 2, tension);
}
示例9: DataFrameBuilder
public DataFrameBuilder(GraphPane graphPane, CurveItem curveItem)
{
GraphPane = graphPane;
CurveItem = curveItem;
var msPointList = curveItem.Points as MSPointList;
if (msPointList != null)
{
Points = msPointList.FullList;
}
else
{
Points = curveItem.Points;
}
XAxis = curveItem.GetXAxis(graphPane);
YAxis = curveItem.GetYAxis(graphPane);
BaseAxis = curveItem.BaseAxis(graphPane);
ValueAxis = curveItem.ValueAxis(graphPane);
}
示例10: CurveItemTypePair
public CurveItemTypePair(CurveItem curve, CurveType type, String name, int nC)
{
Curve = curve;
Type = type;
Scale = GlobalVars.DEFAULTSCALE(type);
CurrCoordinates = new CurveItemTypePair.CurrentCoordinates();
DrawCursorDot = true;
DrawCursorLines = true;
HorizontalCursorLine = new LineObj();
VerticalCursorLine = new LineObj();
SymbolsOn = true;
Name = name;
ComputeInterestingValues();
CurveObj = new CurveObject((PointPairList)curve.Points, nC);
CurveObj.XMAX = this.XMax;
CurveObj.YMAX = this.YMax;
NCurves = nC;
}
示例11: zedGraphControl_PointValueEvent
private string zedGraphControl_PointValueEvent(ZedGraphControl sender, GraphPane pane, CurveItem curve, int iPt)
{
return String.Format("{0} hz/{1} rpm", curve[iPt].X,curve[iPt].X * 60.0);
}
示例12: FindNearestPoint
/// <summary>
/// Find the data point that lies closest to the specified mouse (screen)
/// point.
/// </summary>
/// <remarks>
/// This method will search through the specified list of curves to find which point is
/// nearest. It will only consider points that are within
/// <see cref="Default.NearestTol"/> pixels of the screen point, and it will
/// only consider <see cref="CurveItem"/>'s that are in
/// <paramref name="targetCurveList"/>.
/// </remarks>
/// <param name="mousePt">The screen point, in pixel coordinates.</param>
/// <param name="targetCurveList">A <see cref="CurveList"/> object containing
/// a subset of <see cref="CurveItem"/>'s to be searched.</param>
/// <param name="nearestCurve">A reference to the <see cref="CurveItem"/>
/// instance that contains the closest point. nearestCurve will be null if
/// no data points are available.</param>
/// <param name="iNearest">The index number of the closest point. The
/// actual data vpoint will then be <see cref="CurveItem.Points">CurveItem.Points[iNearest]</see>
/// . iNearest will
/// be -1 if no data points are available.</param>
/// <returns>true if a point was found and that point lies within
/// <see cref="Default.NearestTol"/> pixels
/// of the screen point, false otherwise.</returns>
public bool FindNearestPoint( PointF mousePt, CurveList targetCurveList,
out CurveItem nearestCurve, out int iNearest )
{
CurveItem nearestBar = null;
int iNearestBar = -1;
nearestCurve = null;
iNearest = -1;
// If the point is outside the ChartRect, always return false
if ( !_chart._rect.Contains( mousePt ) )
return false;
double x, x2;
double[] y;
double[] y2;
//ReverseTransform( mousePt, out x, out y, out y2 );
ReverseTransform( mousePt, out x, out x2, out y, out y2 );
if ( !AxisRangesValid() )
return false;
ValueHandler valueHandler = new ValueHandler( this, false );
double xPixPerUnit = _chart._rect.Width / ( _xAxis._scale._max - _xAxis._scale._min );
//double yPixPerUnit = chartRect.Height / ( yAxis.Max - yAxis.Min );
//double y2PixPerUnit; // = chartRect.Height / ( y2Axis.Max - y2Axis.Min );
double yPixPerUnitAct, yAct, yMinAct, yMaxAct;
double minDist = 1e20;
double xVal, yVal, dist = 99999, distX, distY;
double tolSquared = Default.NearestTol * Default.NearestTol;
int iBar = 0;
foreach ( CurveItem curve in targetCurveList )
{
//test for pie first...if it's a pie rest of method superfluous
if ( curve is PieItem && curve.IsVisible )
{
if ( ( (PieItem)curve ).SlicePath != null &&
( (PieItem)curve ).SlicePath.IsVisible( mousePt ) )
{
nearestBar = curve;
iNearestBar = 0;
}
continue;
}
else if ( curve.IsVisible )
{
int yIndex = curve.GetYAxisIndex( this );
Axis yAxis = curve.GetYAxis( this );
if ( curve.IsY2Axis )
{
yAct = y2[yIndex];
yMinAct = _y2AxisList[yIndex]._scale._min;
yMaxAct = _y2AxisList[yIndex]._scale._max;
}
else
{
yAct = y[yIndex];
yMinAct = _yAxisList[yIndex]._scale._min;
yMaxAct = _yAxisList[yIndex]._scale._max;
}
yPixPerUnitAct = _chart._rect.Height / ( yMaxAct - yMinAct );
IPointList points = curve.Points;
float barWidth = curve.GetBarWidth( this );
double barWidthUserHalf;
Axis baseAxis = curve.BaseAxis( this );
bool isXBaseAxis = ( baseAxis is XAxis || baseAxis is X2Axis );
if ( isXBaseAxis )
barWidthUserHalf = barWidth / xPixPerUnit / 2.0;
//.........这里部分代码省略.........
示例13: DrawSingleBar
/// <summary>
/// Protected internal routine that draws the specified single bar (an individual "point")
/// of this series to the specified <see cref="Graphics"/> device.
/// </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="curve">A <see cref="CurveItem"/> object representing the
/// <see cref="Bar"/>'s to be drawn.</param>
/// <param name="index">
/// The zero-based index number for the single bar to be drawn.
/// </param>
/// <param name="pos">
/// The ordinal position of the this bar series (0=first bar, 1=second bar, etc.)
/// in the cluster of bars.
/// </param>
/// <param name="baseAxis">The <see cref="Axis"/> class instance that defines the base (independent)
/// axis for the <see cref="Bar"/></param>
/// <param name="valueAxis">The <see cref="Axis"/> class instance that defines the value (dependent)
/// axis for the <see cref="Bar"/></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="GraphPane.CalcScaleFactor"/> method, and is used to proportionally adjust
/// font sizes, etc. according to the actual size of the graph.
/// </param>
protected virtual void DrawSingleBar( Graphics g, GraphPane pane,
CurveItem curve,
int index, int pos, Axis baseAxis, Axis valueAxis,
double scaleFactor )
{
// pixBase = pixel value for the bar center on the base axis
// pixHiVal = pixel value for the bar top on the value axis
// pixLowVal = pixel value for the bar bottom on the value axis
float pixBase, pixHiVal, pixLowVal;
float clusterWidth = pane.GetClusterWidth();
float barWidth = curve.GetBarWidth( pane );
float clusterGap = pane.MinClusterGap * barWidth;
float barGap = barWidth * pane.MinBarGap;
// curBase = the scale value on the base axis of the current bar
// curHiVal = the scale value on the value axis of the current bar
// curLowVal = the scale value of the bottom of the bar
double curBase, curLowVal, curHiVal;
BarValueHandler valueHandler = new BarValueHandler( pane );
valueHandler.GetBarValues( curve, index, out curBase,
out curLowVal, out curHiVal );
// Any value set to double max is invalid and should be skipped
// This is used for calculated values that are out of range, divide
// by zero, etc.
// Also, any value <= zero on a log scale is invalid
if ( !curve.Points[index].IsInvalid )
{
// calculate a pixel value for the top of the bar on value axis
pixLowVal = valueAxis.Transform( index, curLowVal );
pixHiVal = valueAxis.Transform( index, curHiVal );
// calculate a pixel value for the center of the bar on the base axis
pixBase = baseAxis.Transform( index, curBase );
// Calculate the pixel location for the side of the bar (on the base axis)
float pixSide = pixBase - clusterWidth / 2.0F + clusterGap / 2.0F +
pos * ( barWidth + barGap );
// Draw the bar
if ( pane.BarBase == BarBase.X )
this.Draw( g, pane, pixSide, pixSide + barWidth, pixLowVal,
pixHiVal, scaleFactor, true );
else
this.Draw( g, pane, pixLowVal, pixHiVal, pixSide, pixSide + barWidth,
scaleFactor, true );
}
}
示例14: RemoveFromSelection
/// <summary>
/// Remove the specified <see cref="CurveItem" /> from the selection list.
/// </summary>
/// <param name="master">The <see cref="MasterPane" /> that is the "owner"
/// of the <see cref="CurveItem" />'s.</param>
/// <param name="ci">The <see cref="CurveItem" /> to be removed from the list.</param>
public void RemoveFromSelection( MasterPane master, CurveItem ci )
{
if ( this.Contains( ci ) )
this.Remove( ci );
UpdateSelection( master );
}
示例15: BarCenterValue
/// <summary>
/// Calculate the screen pixel position of the center of the specified bar, using the
/// <see cref="Axis"/> as specified by <see cref="GraphPane.BarBase"/>. This method is
/// used primarily by the
/// <see cref="GraphPane.FindNearestPoint(PointF,out CurveItem,out int)"/> method in order to
/// determine the bar "location," which is defined as the center of the top of the individual bar.
/// </summary>
/// <param name="curve">The <see cref="CurveItem"/> representing the
/// bar of interest.</param>
/// <param name="barWidth">The width of each individual bar. This can be calculated using
/// the <see cref="CurveItem.GetBarWidth"/> method.</param>
/// <param name="iCluster">The cluster number for the bar of interest. This is the ordinal
/// position of the current point. That is, if a particular <see cref="CurveItem"/> has
/// 10 points, then a value of 3 would indicate the 4th point in the data array.</param>
/// <param name="val">The actual independent axis value for the bar of interest.</param>
/// <param name="iOrdinal">The ordinal position of the <see cref="CurveItem"/> of interest.
/// That is, the first bar series is 0, the second is 1, etc. Note that this applies only
/// to the bars. If a graph includes both bars and lines, then count only the bars.</param>
/// <returns>A screen pixel X position of the center of the bar of interest.</returns>
public double BarCenterValue( CurveItem curve, float barWidth, int iCluster,
double val, int iOrdinal )
{
float clusterWidth = pane.GetClusterWidth();
float clusterGap = pane.MinClusterGap * barWidth;
float barGap = barWidth * pane.MinBarGap;
if ( ( curve.IsBar && !( pane.BarType == BarType.Cluster ) ) ||
curve is ErrorBarItem || curve is HiLowBarItem )
iOrdinal = 0;
Axis baseAxis = curve.BaseAxis( pane );
float centerPix = baseAxis.Transform( iCluster, val )
- clusterWidth / 2.0F + clusterGap / 2.0F +
iOrdinal * ( barWidth + barGap ) + 0.5F * barWidth;
return baseAxis.ReverseTransform( centerPix );
}