本文整理汇总了C#中ZedGraph.CurveItem类的典型用法代码示例。如果您正苦于以下问题:C# CurveItem类的具体用法?C# CurveItem怎么用?C# CurveItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CurveItem类属于ZedGraph命名空间,在下文中一共展示了CurveItem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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));
}
开发者ID:konrad-zielinski,项目名称:ZedGraph,代码行数:7,代码来源:FilledLine.cs
示例2: DrawCurve
public DrawCurve(CurveItem _curve, string _curveName, GraphPane _pane, string _paneName)
{
CurveName = _curveName;
PaneName = _paneName;
Curve = _curve;
Pane = _pane;
}
开发者ID:oghenez,项目名称:trade-software,代码行数:7,代码来源:libs.cs
示例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 );
}
开发者ID:Jungwon,项目名称:ZedGraph,代码行数:21,代码来源:Selection.cs
示例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";
}
开发者ID:redrhino,项目名称:DDE.Console.cs,代码行数:8,代码来源:Form1.cs
示例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;
}
开发者ID:lgatto,项目名称:proteowizard,代码行数:15,代码来源:CurveDataHandlers.cs
示例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;
}
开发者ID:adrianj,项目名称:AdriansLib,代码行数:12,代码来源:CsvWriter.cs
示例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);
}
}
开发者ID:adrianj,项目名称:AdriansLib,代码行数:15,代码来源:CsvWriter.cs
示例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);
}
开发者ID:konrad-zielinski,项目名称:ZedGraph,代码行数:18,代码来源:FilledLine.cs
示例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);
}
开发者ID:AlexandreBurel,项目名称:pwiz-mzdb,代码行数:18,代码来源:DataFrameBuilder.cs
示例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;
}
开发者ID:Zordonia,项目名称:AdvisIXAccel,代码行数:18,代码来源:GraphInfo.cs
示例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);
}
开发者ID:marcoarruda,项目名称:MissionPlanner,代码行数:4,代码来源:fftui.cs
示例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;
//.........这里部分代码省略.........
开发者ID:cliffton2008,项目名称:JNMAutoTrader_Capital,代码行数:101,代码来源:GraphPane.cs
示例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 );
}
}
开发者ID:InsungChoi,项目名称:dddd,代码行数:80,代码来源:Bar.cs
示例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 );
}
开发者ID:Jungwon,项目名称:ZedGraph,代码行数:14,代码来源:Selection.cs
示例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 );
}
开发者ID:InsungChoi,项目名称:dddd,代码行数:36,代码来源:BarValueHandler.cs
示例16: zg1_PointValueEvent
private string zg1_PointValueEvent(ZedGraphControl sender, GraphPane pane, CurveItem curve, int iPt)
{
PointPair pt = curve[iPt];
return (curve.Label.Text + pt.X.ToString()+" , "+pt.Y.ToString());
}
开发者ID:maveroke,项目名称:PerformanceProgression,代码行数:5,代码来源:Form2.cs
示例17: GetBarValues
/// <summary>
/// Get the user scale values associate with a particular point of a
/// particular curve.</summary>
/// <remarks>The main purpose of this method is to handle
/// stacked bars, in which case the stacked values are returned rather
/// than the individual data values.
/// </remarks>
/// <param name="pane">The parent <see cref="GraphPane"/> object.</param>
/// <param name="curve">A <see cref="CurveItem"/> object of interest.</param>
/// <param name="iPt">The zero-based point index for the point of interest.</param>
/// <param name="baseVal">A <see cref="Double"/> value representing the value
/// for the independent axis.</param>
/// <param name="lowVal">A <see cref="Double"/> value representing the lower
/// value for the dependent axis.</param>
/// <param name="hiVal">A <see cref="Double"/> value representing the upper
/// value for the dependent axis.</param>
/// <returns>true if the data point is value, false for
/// <see cref="PointPair.Missing"/>, invalid, etc. data.</returns>
public static bool GetBarValues( GraphPane pane, CurveItem curve, int iPt,
out double baseVal, out double lowVal, out double hiVal )
{
hiVal = PointPair.Missing;
lowVal = PointPair.Missing;
baseVal = PointPair.Missing;
if ( curve == null || curve.Points.Count <= iPt )
return false;
Axis baseAxis = curve.BaseAxis( pane );
if ( baseAxis is XAxis )
baseVal = curve.Points[iPt].X;
else
baseVal = curve.Points[iPt].Y;
if ( curve is BarItem && ( pane.BarType == BarType.Stack ||
pane.BarType == BarType.PercentStack ) )
{
double positiveStack = 0;
double negativeStack = 0;
double curVal;
foreach ( CurveItem tmpCurve in pane.CurveList )
//for ( int iCurve=pane.CurveList.Count-1; iCurve >=0; iCurve-- )
{
//CurveItem tmpCurve = pane.CurveList[iCurve];
if ( tmpCurve.IsBar && iPt < tmpCurve.Points.Count )
{
if ( baseAxis is XAxis )
curVal = tmpCurve.Points[iPt].Y;
else
curVal = tmpCurve.Points[iPt].X;
if ( curVal == PointPair.Missing )
continue;
if ( tmpCurve == curve )
{
if ( curVal >= 0 )
{
lowVal = positiveStack;
hiVal = positiveStack + curVal;
}
else
{
hiVal = negativeStack;
lowVal = negativeStack + curVal;
}
}
if ( curVal >= 0 )
positiveStack += curVal;
else
negativeStack += curVal;
}
}
if ( pane.BarType == BarType.PercentStack )
{
positiveStack += Math.Abs( negativeStack );
if ( positiveStack != 0 )
{
lowVal = lowVal / positiveStack * 100.0;
hiVal = hiVal / positiveStack * 100.0;
}
else
{
lowVal = 0;
hiVal = 0;
}
}
if ( baseVal == PointPair.Missing || lowVal == PointPair.Missing ||
hiVal == PointPair.Missing )
return false;
else
return true;
}
else
{
//.........这里部分代码省略.........
开发者ID:InsungChoi,项目名称:dddd,代码行数:101,代码来源:BarValueHandler.cs
示例18: GetValues
/// <summary>
/// Get the user scale values associate with a particular point of a
/// particular curve.</summary>
/// <remarks>The main purpose of this method is to handle
/// stacked bars and lines, in which case the stacked values are returned rather
/// than the individual data values. However, this method works generically for any
/// curve type.
/// </remarks>
/// <param name="pane">The parent <see cref="GraphPane"/> object.</param>
/// <param name="curve">A <see cref="CurveItem"/> object of interest.</param>
/// <param name="iPt">The zero-based point index for the point of interest.</param>
/// <param name="baseVal">A <see cref="Double"/> value representing the value
/// for the independent axis.</param>
/// <param name="lowVal">A <see cref="Double"/> value representing the lower
/// value for the dependent axis.</param>
/// <param name="hiVal">A <see cref="Double"/> value representing the upper
/// value for the dependent axis.</param>
/// <returns>true if the data point is value, false for
/// <see cref="PointPairBase.Missing"/>, invalid, etc. data.</returns>
public static bool GetValues( GraphPane pane, CurveItem curve, int iPt,
out double baseVal, out double lowVal, out double hiVal )
{
hiVal = PointPair.Missing;
lowVal = PointPair.Missing;
baseVal = PointPair.Missing;
if ( curve == null || curve.Points.Count <= iPt || !curve.IsVisible )
return false;
Axis baseAxis = curve.BaseAxis( pane );
Axis valueAxis = curve.ValueAxis( pane );
if ( baseAxis is XAxis || baseAxis is X2Axis )
baseVal = curve.Points[iPt].X;
else
baseVal = curve.Points[iPt].Y;
// is it a stacked bar type?
if ( curve is BarItem && ( pane._barSettings.Type == BarType.Stack ||
pane._barSettings.Type == BarType.PercentStack ) )
{
double positiveStack = 0;
double negativeStack = 0;
double curVal;
// loop through all the curves, summing up the values to get a total (only
// for the current ordinal position iPt)
foreach ( CurveItem tmpCurve in pane.CurveList )
{
// Sum the value for the current curve only if it is a bar
if ( tmpCurve.IsBar && tmpCurve.IsVisible )
{
curVal = PointPair.Missing;
// For non-ordinal curves, find a matching base value (must match exactly)
if ( curve.IsOverrideOrdinal || !baseAxis._scale.IsAnyOrdinal )
{
IPointList points = tmpCurve.Points;
for ( int i=0; i<points.Count; i++ )
{
if ( ( baseAxis is XAxis || baseAxis is X2Axis ) && points[i].X == baseVal )
{
curVal = points[i].Y;
break;
}
else if ( !(baseAxis is XAxis || baseAxis is X2Axis) && points[i].Y == baseVal )
{
curVal = points[i].X;
break;
}
}
}
// otherwise, it's an ordinal type so use the value at the same ordinal position
else if ( iPt < tmpCurve.Points.Count )
{
// Get the value for the appropriate value axis
if ( baseAxis is XAxis || baseAxis is X2Axis )
curVal = tmpCurve.Points[iPt].Y;
else
curVal = tmpCurve.Points[iPt].X;
}
// If it's a missing value, skip it
if ( curVal == PointPair.Missing )
{
positiveStack = PointPair.Missing;
negativeStack = PointPair.Missing;
}
// the current curve is the target curve, save the summed values for later
if ( tmpCurve == curve )
{
// if the value is positive, use the positive stack
if ( curVal >= 0 )
{
lowVal = positiveStack;
hiVal = ( curVal == PointPair.Missing || positiveStack == PointPair.Missing ) ?
PointPair.Missing : positiveStack + curVal;
}
// otherwise, use the negative stack
//.........这里部分代码省略.........
开发者ID:konrad-zielinski,项目名称:ZedGraph,代码行数:101,代码来源:ValueHandler.cs
示例19: BarCenterValue
/// <summary>
/// Calculate the user scale position of the center of the specified bar, using the
/// <see cref="Axis"/> as specified by <see cref="BarSettings.Base"/>. 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 user scale value position of the center of the bar of interest.</returns>
public double BarCenterValue( CurveItem curve, float barWidth, int iCluster,
double val, int iOrdinal )
{
Axis baseAxis = curve.BaseAxis( _pane );
if ( curve is ErrorBarItem || curve is HiLowBarItem ||
curve is OHLCBarItem || curve is JapaneseCandleStickItem )
{
if ( baseAxis._scale.IsAnyOrdinal && iCluster >= 0 && !curve.IsOverrideOrdinal )
return (double) iCluster + 1.0;
else
return val;
}
else
{
float clusterWidth = _pane._barSettings.GetClusterWidth();
float clusterGap = _pane._barSettings.MinClusterGap * barWidth;
float barGap = barWidth * _pane._barSettings.MinBarGap;
if ( curve.IsBar && _pane._barSettings.Type != BarType.Cluster )
iOrdinal = 0;
float centerPix = baseAxis.Scale.Transform( curve.IsOverrideOrdinal, iCluster, val )
- clusterWidth / 2.0F + clusterGap / 2.0F +
iOrdinal * ( barWidth + barGap ) + 0.5F * barWidth;
return baseAxis.Scale.ReverseTransform( centerPix );
}
}
开发者ID:konrad-zielinski,项目名称:ZedGraph,代码行数:46,代码来源:ValueHandler.cs
示例20: AddToSelection
/// <summary>
/// Add a <see cref="CurveItem" /> to 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 added to the list.</param>
public void AddToSelection( MasterPane master, CurveItem ci )
{
if ( this.Contains( ci ) == false )
Add( ci );
UpdateSelection( master );
}
开发者ID:Jungwon,项目名称:ZedGraph,代码行数:13,代码来源:Selection.cs
注:本文中的ZedGraph.CurveItem类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论