本文整理汇总了C#中ZedGraph.CurveList.Add方法的典型用法代码示例。如果您正苦于以下问题:C# CurveList.Add方法的具体用法?C# CurveList.Add怎么用?C# CurveList.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZedGraph.CurveList
的用法示例。
在下文中一共展示了CurveList.Add方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestEasyData
public void TestEasyData()
{
string [] labels = {"basic1","basic2"};
double[] x1 = { 4, 5, 6 };
double[] y1 = { 12, 15, 18 };
double[] x2 = { -2, -3, -4 };
double[] y2 = { 0.01, 0.1, 1 };
CurveList cl = new CurveList();
cl.Add(new LineItem(labels[0], x1, y1, Color.Black, SymbolType.Circle));
cl.Add(new LineItem(labels[1], x2, y2, Color.Black, SymbolType.Circle));
string filename = folder + labels[0]+".csv";
Console.WriteLine("Writing for file: " + filename);
CsvWriter.ExportToCsv(cl, filename);
}
示例2: TestComplexData
public void TestComplexData()
{
string[] labels = { "complex1", "complex2","complex3" };
double[] x1 = { 4e12, 5e13, 6e14 };
double[] y1 = { 12e-10, 15e-10, 18e-10 };
double[] x2 = { -2, -3, -4, -5, -6, -7, -8, -9, -10, -11 };
double[] y2 = { 0.001, 0.01, 0.1, 1, 10, 100, 1000, 10000, 100000, 1000000 };
double[] z2 = { 1.23453456345345345, 2.6450985347635, 3.45237895638925, 4.42378962387534, 5.4532498734563,
6.429874343, 7.5349857345, 8.5347637634, 9.3764684593453, 10.53948756876345 };
double[] x3 = { 1, 2, 3, 4, 5, 6, 7, 8 };
double[] y3 = new double[x3.Length];
CurveList cl = new CurveList();
cl.Add(new LineItem(labels[0], x1, y1, Color.Black, SymbolType.Circle));
PointPairList ppl = new PointPairList();
for(int i = 0; i < x2.Length; i++)
ppl.Add(x2[i],y2[i],z2[i]);
cl.Add(new LineItem(labels[1], ppl, Color.Black, SymbolType.Circle));
cl.Add(new LineItem(labels[2], x3, y3, Color.Black, SymbolType.Circle));
string filename = folder + labels[0] + ".csv";
Console.WriteLine("Writing for file: " + filename);
CsvWriter.ExportToCsv(cl, filename);
}
示例3: FindNearestPoint
/// <summary>
/// Find the data point that lies closest to the specified mouse (screen)
/// point for the specified curve.
/// </summary>
/// <remarks>
/// This method will search only through the points for the specified
/// curve to determine which point is
/// nearest the mouse point. It will only consider points that are within
/// <see cref="Default.NearestTol"/> pixels of the screen point.
/// </remarks>
/// <param name="mousePt">The screen point, in pixel coordinates.</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="targetCurve">A <see cref="CurveItem"/> object containing
/// the data points to be searched.</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, CurveItem targetCurve,
out CurveItem nearestCurve, out int iNearest )
{
CurveList targetCurveList = new CurveList();
targetCurveList.Add( targetCurve );
return FindNearestPoint( mousePt, targetCurveList,
out nearestCurve, out iNearest );
}
示例4: FindContainedObjects
// Revision: JCarpenter 10/06
/// <summary>
/// Find any objects that exist within the specified (screen) rectangle.
/// This method will search through all of the graph objects, such as
/// <see cref="Axis"/>, <see cref="Legend"/>, <see cref="PaneBase.Title"/>,
/// <see cref="GraphObj"/>, and <see cref="CurveItem"/>.
/// and see if the objects' bounding boxes are within the specified (screen) rectangle
/// This method returns true if any are found.
/// </summary>
public bool FindContainedObjects( RectangleF rectF, Graphics g,
out CurveList containedObjs )
{
containedObjs = new CurveList();
foreach ( CurveItem ci in this.CurveList )
{
for ( int i = 0; i < ci.Points.Count; i++ )
{
if ( ci.Points[i].X > rectF.Left &&
ci.Points[i].X < rectF.Right &&
ci.Points[i].Y > rectF.Bottom &&
ci.Points[i].Y < rectF.Top )
{
containedObjs.Add( ci );
}
}
}
return ( containedObjs.Count > 0 );
}
示例5: Draw
/// <summary>
/// Render all the <see cref="CurveItem"/> objects in the list to the
/// specified <see cref="Graphics"/>
/// device by calling the <see cref="CurveItem.Draw"/> member function of
/// each <see cref="CurveItem"/> object.
/// </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="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>
public void Draw( Graphics g, GraphPane pane, float scaleFactor )
{
// Configure the accumulator for stacked bars
//Bar.ResetBarStack();
// Count the number of BarItems in the curvelist
int pos = this.NumBars;
// sorted overlay bars are a special case, since they are sorted independently at each
// ordinal position.
if ( pane._barSettings.Type == BarType.SortedOverlay )
{
// First, create a new curveList with references (not clones) of the curves
CurveList tempList = new CurveList();
foreach ( CurveItem curve in this )
if ( curve.IsBar )
tempList.Add( (CurveItem) curve );
// Loop through the bars, graphing each ordinal position separately
for ( int i=0; i<this.maxPts; i++ )
{
// At each ordinal position, sort the curves according to the value axis value
tempList.Sort( pane._barSettings.Base == BarBase.X ? SortType.YValues : SortType.XValues, i );
// plot the bars for the current ordinal position, in sorted order
foreach ( BarItem barItem in tempList )
barItem.Bar.DrawSingleBar( g, pane, barItem,
((BarItem)barItem).BaseAxis( pane ),
((BarItem)barItem).ValueAxis( pane ),
0, i, ( (BarItem)barItem ).GetBarWidth( pane ), scaleFactor );
}
}
// Loop for each curve in reverse order to pick up the remaining curves
// The reverse order is done so that curves that are later in the list are plotted behind
// curves that are earlier in the list
for ( int i = this.Count - 1; i >= 0; i-- )
{
CurveItem curve = this[i];
if ( curve.IsBar )
pos--;
// Render the curve
// if it's a sorted overlay bar type, it's already been done above
if ( !( curve.IsBar && pane._barSettings.Type == BarType.SortedOverlay ) )
{
curve.Draw( g, pane, pos, scaleFactor );
}
}
}
示例6: DisplayCalibrationCurve
//.........这里部分代码省略.........
else
{
zedGraphControl.GraphPane.Title.Text = QuantificationStrings.CalibrationForm_DisplayCalibrationCurve_To_fit_a_calibration_curve__set_the_Sample_Type_of_some_replicates_to_Standard__and_specify_their_concentration_;
}
}
zedGraphControl.GraphPane.XAxis.Title.Text = curveFitter.GetXAxisTitle();
zedGraphControl.GraphPane.YAxis.Title.Text = curveFitter.GetYAxisTitle();
CalibrationCurve = curveFitter.GetCalibrationCurve();
double minX = double.MaxValue, maxX = double.MinValue;
_scatterPlots = new CurveList();
foreach (var sampleType in SampleType.ListSampleTypes())
{
if (!Options.DisplaySampleType(sampleType))
{
continue;
}
PointPairList pointPairList = new PointPairList();
for (int iReplicate = 0;
iReplicate < document.Settings.MeasuredResults.Chromatograms.Count;
iReplicate++)
{
ChromatogramSet chromatogramSet = document.Settings.MeasuredResults.Chromatograms[iReplicate];
if (!Equals(sampleType, chromatogramSet.SampleType))
{
continue;
}
double? y = curveFitter.GetYValue(iReplicate);
double? x = curveFitter.GetSpecifiedXValue(iReplicate)
?? curveFitter.GetCalculatedXValue(CalibrationCurve, iReplicate);
if (y.HasValue && x.HasValue)
{
PointPair point = new PointPair(x.Value, y.Value) {Tag = iReplicate};
pointPairList.Add(point);
if (!Options.LogPlot || x.Value > 0)
{
minX = Math.Min(minX, x.Value);
}
maxX = Math.Max(maxX, x.Value);
}
}
if (pointPairList.Any())
{
var lineItem = zedGraphControl.GraphPane.AddCurve(sampleType.ToString(), pointPairList,
sampleType.Color, sampleType.SymbolType);
lineItem.Line.IsVisible = false;
lineItem.Symbol.Fill = new Fill(sampleType.Color);
_scatterPlots.Add(lineItem);
}
}
List<string> labelLines = new List<String>();
RegressionFit regressionFit = document.Settings.PeptideSettings.Quantification.RegressionFit;
if (regressionFit != RegressionFit.NONE)
{
if (minX <= maxX)
{
int interpolatedLinePointCount = 100;
if (!options.LogPlot)
{
if (regressionFit == RegressionFit.LINEAR_THROUGH_ZERO)
{
minX = Math.Min(0, minX);
}
if (regressionFit != RegressionFit.QUADRATIC)
{
interpolatedLinePointCount = 2;
示例7: Draw
/// <summary>
/// Render all the <see cref="CurveItem"/> objects in the list to the
/// specified <see cref="Graphics"/>
/// device by calling the <see cref="CurveItem.Draw"/> member function of
/// each <see cref="CurveItem"/> object.
/// </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="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>
public void Draw( Graphics g, GraphPane pane, double scaleFactor )
{
// Configure the accumulator for stacked bars
//Bar.ResetBarStack();
// Count the number of BarItems in the curvelist
int pos = this.NumBars;
if ( pane.BarType == BarType.SortedOverlay )
{
// First, create a new curveList with references (not clones) of the curves
CurveList tempList = new CurveList();
foreach ( CurveItem curve in this )
if ( curve.IsBar )
tempList.Add( (CurveItem) curve );
for ( int i=0; i<this.maxPts; i++ )
{
tempList.Sort( pane.BarBase == BarBase.X ? SortType.YValues : SortType.XValues, i );
foreach ( BarItem barItem in tempList )
barItem.Bar.DrawSingleBar( g, pane, barItem,
((BarItem)barItem).BaseAxis(pane),
((BarItem)barItem).ValueAxis(pane, barItem.IsY2Axis),
0, i, scaleFactor );
}
}
// Loop for each curve in reverse order to pick up the remaining bartypes
for ( int i=this.Count-1; i>=0; i-- )
{
CurveItem curve = this[i];
if ( curve.IsBar )
pos--;
// Render the curve
// if it's a bar type or a sorted overlay or a percentstacked bar, it's already been done above
if ( !(pane.BarType == BarType.SortedOverlay) || !curve.IsBar )
curve.Draw( g, pane, pos, scaleFactor );
}
}