本文整理汇总了C#中ZedGraph.XDate.CompareTo方法的典型用法代码示例。如果您正苦于以下问题:C# XDate.CompareTo方法的具体用法?C# XDate.CompareTo怎么用?C# XDate.CompareTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZedGraph.XDate
的用法示例。
在下文中一共展示了XDate.CompareTo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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 );
//.........这里部分代码省略.........