本文整理汇总了C#中ZedGraph.PointPairList.Sort方法的典型用法代码示例。如果您正苦于以下问题:C# PointPairList.Sort方法的具体用法?C# PointPairList.Sort怎么用?C# PointPairList.Sort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZedGraph.PointPairList
的用法示例。
在下文中一共展示了PointPairList.Sort方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateGraph_NegativeHorizontalBars
private void CreateGraph_NegativeHorizontalBars( ZedGraphControl z1 )
{
GraphPane myPane = z1.GraphPane;
PointPairList list = new PointPairList();
Random rand = new Random();
for ( int i = 0; i < 20; i++ )
{
list.Add( rand.NextDouble() * 200.0 - 100.0, (double) i + 1.0, 50.0 );
}
list.Sort( SortType.XValues );
HiLowBarItem myBar = myPane.AddHiLowBar( "histogram", list, Color.Blue );
myBar.Bar.Fill = new Fill( Color.Blue );
myPane.BarSettings.MinClusterGap = 0.0f;
myPane.YAxis.MajorGrid.IsZeroLine = false;
myPane.BarSettings.Base = BarBase.Y;
LineObj line = new LineObj( Color.Black, 0, 50, 1, 50 );
line.Location.CoordinateFrame = CoordType.XChartFractionYScale;
myPane.GraphObjList.Add( line );
z1.AxisChange();
}
示例2: CreateGraph_DifferencePlot
// Simple plot with interpolated difference curve
private void CreateGraph_DifferencePlot( ZedGraphControl z1 )
{
GraphPane myPane = z1.GraphPane;
// Generate the first data set
PointPairList list1 = new PointPairList();
for ( int i = 0; i < 13; i++ )
{
double x = i + 11.0;
double y = 150.0 * ( 1.0 + Math.Sin( i * 0.3 ) );
list1.Add( x, y );
}
// Generate a second data set that is unrelated to the first
PointPairList list2 = new PointPairList();
for ( int i = 0; i < 15; i++ )
{
double x = i * 1.2 + 10.0;
double y = 250.0 * ( 1.0 + Math.Sin( x * 0.5 ) );
list2.Add( x, y );
}
// Make sure the data are sorted and monotonically increasing
list1.Sort();
list2.Sort();
// Get the lower and upper limit of the data
// This code can throw an exception if either list is empty
double xMin = Math.Min( list1[0].X, list2[0].X );
double xMax = Math.Max( list1[list1.Count - 1].X, list2[list2.Count - 1].X );
// Create a new list that will hold the difference points
PointPairList diffList = new PointPairList();
// Select the number of points for the new difference curve
// This is completely arbitrary, but more points will make it smoother in the
// case of SplineInterpolation
const int count = 50;
// Loop for each data point to be created in the new PointPairList
for ( int i=0; i<count; i++ )
{
// Calculated X values are evenly spaced
double x = xMin + (double) i * ( xMax - xMin ) / count;
// Use spline interpolation to create the Y values for the new curve
// Note that this allows extrapolation beyond the actual data available
// A tension value of 0.5 is used, but anywhere between 0 and 1 is reasonable
//double y = list1.InterpolateX( x );
double y1 = list1.InterpolateX( x );
double y2 = list2.SplineInterpolateX( x, 0.5 );
// Add the new Point to the list taking the difference between the Y values
// If either value is Missing, it means that a point was extrapolated beyond
// the available data, which is not allowed for SplineInterpolateX()
// This won't happen with InterpolateX, since it allows extrapolation
if ( y1 == PointPair.Missing || y2 == PointPair.Missing )
diffList.Add( x, PointPair.Missing, PointPair.Missing );
else
diffList.Add( x, y1 - y2, (y1-y2) > 0 ? 1 : 0 );
}
// Create the three curves -- two datasets, plus a difference curve
LineItem diffCurve = myPane.AddCurve( "diff", diffList, Color.Red, SymbolType.None );
LineItem myCurve1 = myPane.AddCurve( "curve", list1, Color.Blue, SymbolType.Diamond );
LineItem myCurve2 = myPane.AddCurve( "curve 2", list2, Color.Green, SymbolType.Circle );
Color[] colors = { Color.Red, Color.Green };
diffCurve.Line.Fill = new Fill( colors, 90 );
diffCurve.Line.Fill.RangeMin = 0;
diffCurve.Line.Fill.RangeMax = 1;
diffCurve.Line.Fill.Type = FillType.GradientByZ;
//diffCurve.Line.GradientFill = new Fill( colors, 90 );
//diffCurve.Line.GradientFill.RangeMin = -100;
//diffCurve.Line.GradientFill.RangeMax = 200;
//diffCurve.Line.IsOptimizedDraw = true;
// Add some "pretty" stuff (optional)
myCurve1.Symbol.Fill = new Fill( Color.White );
myCurve2.Symbol.Fill = new Fill( Color.White );
diffCurve.Line.Width = 2.0f;
//diffCurve.Symbol.Fill = new Fill( Color.White );
myPane.Title.Text = "Interpolated Data Curve";
myPane.XAxis.Title.Text = "Period";
myPane.YAxis.Title.Text = "Response";
myPane.Legend.FontSpec.Size = 14;
myPane.Fill = new Fill( Color.WhiteSmoke, Color.Lavender, 0F );
myPane.Chart.Fill = new Fill( Color.FromArgb( 255, 255, 245 ),
Color.FromArgb( 255, 255, 190 ), 90F );
XDate xx = new XDate( 2007, 11, 9 );
XDate x2 = new XDate( 2007, 11, 9 );
XDate x3 = new XDate( 2007, 11, 9, 1, 1, 1 );
object junk = new object();
int i1 = xx.CompareTo( xx );
int i2 = xx.CompareTo( x2 );
//.........这里部分代码省略.........
示例3: GraphSeparators
private void GraphSeparators(PointPairList endpoints)
{
PointPairList points = new PointPairList();
endpoints.Sort(SortType.XValues);
points.Add(endpoints[0]);
for (int counter = 0; counter < endpoints.Count - 1; counter++)
{
points.Add(endpoints[counter].X, 0);
points.Add(endpoints[counter + 1].X, 0);
points.Add(endpoints[counter + 1]);
}
LineItem separator = new LineItem("Separator", points, Color.Blue, SymbolType.None);
curves.Add(separator);
}
示例4: ROCpoints
/// <summary>
/// given a mlr model, vary the threshold by increments to find model sensitivity and specificity
/// for each increment - these become roc plotting points for the model. also, save the roc trace
/// data for passing to the caller for table display. plotting points need to be sorted and aggregated
/// (weedppl(ppl)) for calculating auc (area-under-curve via integration)
/// </summary>
/// <param name="model">given mlr model</param>
/// <param name="rocTableVals"></param>
/// <returns>null if number of pts lt 10, otherwise a pointpair list fro plotting</returns>
private PointPairList ROCpoints(MLRIndividual model, out List<object> rocTableVals)
{
const int interations = 50;
//vary the decision threshold by increments
//calculate the ROC point for the decision threshold increment
//accumulate points for all increments and return pointpairlist
PointPairList ppl = new PointPairList();
PointPair pp = new PointPair();
ROCParameters rocParameters = null;
List<object> rocTableVal = new List<object>();
double maxPred = model.PredictedValues.Max();
double minPred = model.PredictedValues.Min();
double inc = (maxPred - minPred) / (double)interations;
double threshold = minPred;
while (threshold < maxPred)
{
threshold += inc;
pp = ROCpoint(model, threshold, out rocParameters);
if (!pp.IsInvalid)
{
ppl.Add(pp);
rocTableVal.Add(rocParameters.ROCPars);
}
}
rocTableVals = rocTableVal;
//how many points is the minimum???
if (ppl.Count > 10)
{
//sort for integral calc
ppl.Sort();
//get rid of multiple X datapoints
ppl = weedppl(ppl);
return ppl;
}
else
{
return null;
}
}
示例5: SendSolvingResultType2Mass
public void SendSolvingResultType2Mass(Dictionary<string, RKResults> results, IFunctionExecuter fe)
{
List<double> divZ;
List<double> divZ2;
List<double> divT;
List<ResPointViewType2> list;
var p = new PointPairList();
mainForm.DrawCurves(results);
var r = new Dictionary<string, List<ResPointViewType2>>();
foreach (string s in results.Keys)
{
ResolveType2(results[s], fe, out divT, out divZ, out divZ2, out list);
r.Add(s, list);
if (divZ.Count > 0)
{
p.Add(divZ[0], divZ2[0]);
}
}
p.Sort(SortType.YValues);
//p.Sort(ZedGraph.SortType.XValues);
ShowResultType2Mass(p, r);
}