本文整理汇总了C#中ZedGraph.XDate.AddYears方法的典型用法代码示例。如果您正苦于以下问题:C# XDate.AddYears方法的具体用法?C# XDate.AddYears怎么用?C# XDate.AddYears使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZedGraph.XDate
的用法示例。
在下文中一共展示了XDate.AddYears方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CalcMinorTicValue
/// <summary>
/// Determine the value for any minor tic.
/// </summary>
/// <remarks>
/// This method properly accounts for <see cref="IsLog"/>, <see cref="IsText"/>,
/// and other axis format settings.
/// </remarks>
/// <param name="baseVal">
/// The value of the first major tic (floating point double). This tic value is the base
/// reference for all tics (including minor ones).
/// </param>
/// <param name="iTic">
/// The major tic number (0 = first major tic). For log scales, this is the actual power of 10.
/// </param>
/// <returns>
/// The specified minor tic value (floating point double).
/// </returns>
private double CalcMinorTicValue( double baseVal, int iTic )
{
double[] dLogVal = { 0, 0.301029995663981, 0.477121254719662, 0.602059991327962,
0.698970004336019, 0.778151250383644, 0.845098040014257,
0.903089986991944, 0.954242509439325, 1 };
if ( this.IsDate ) // date scale
{
XDate xDate= new XDate( baseVal );
switch ( this.minorUnit )
{
case DateUnit.Year:
default:
xDate.AddYears( (double) iTic * this.minorStep );
break;
case DateUnit.Month:
xDate.AddMonths( (double) iTic * this.minorStep );
break;
case DateUnit.Day:
xDate.AddDays( (double) iTic * this.minorStep );
break;
case DateUnit.Hour:
xDate.AddHours( (double) iTic * this.minorStep );
break;
case DateUnit.Minute:
xDate.AddMinutes( (double) iTic * this.minorStep );
break;
case DateUnit.Second:
xDate.AddSeconds( (double) iTic * this.minorStep );
break;
}
return xDate.XLDate;
}
else if ( this.IsLog ) // log scale
{
return baseVal + Math.Floor( (double) iTic / 9.0 ) + dLogVal[ ( iTic + 9 ) % 9 ];
}
else // regular linear scale
{
return baseVal + (double) this.minorStep * (double) iTic;
}
}
示例2: CalcMinorTicValue
/// <summary>
/// Determine the value for any minor tic.
/// </summary>
/// <remarks>
/// This method properly accounts for <see cref="Scale.IsLog"/>, <see cref="Scale.IsText"/>,
/// and other axis format settings.
/// </remarks>
/// <param name="baseVal">
/// The value of the first major tic (floating point double). This tic value is the base
/// reference for all tics (including minor ones).
/// </param>
/// <param name="iTic">
/// The major tic number (0 = first major tic). For log scales, this is the actual power of 10.
/// </param>
/// <returns>
/// The specified minor tic value (floating point double).
/// </returns>
internal override double CalcMinorTicValue(double baseVal, int iTic)
{
XDate xDate = new XDate(baseVal);
switch (_minorUnit) {
case DateUnit.Year:
default:
xDate.AddYears((double) iTic*_minorStep);
break;
case DateUnit.Month:
xDate.AddMonths((double) iTic*_minorStep);
break;
case DateUnit.Day:
xDate.AddDays((double) iTic*_minorStep);
break;
case DateUnit.Hour:
xDate.AddHours((double) iTic*_minorStep);
break;
case DateUnit.Minute:
xDate.AddMinutes((double) iTic*_minorStep);
break;
case DateUnit.Second:
xDate.AddSeconds((double) iTic*_minorStep);
break;
}
return xDate.XLDate;
}
示例3: CalcMajorTicValue
/// <summary>
/// Determine the value for any major tic.
/// </summary>
/// <remarks>
/// This method properly accounts for <see cref="IsLog"/>, <see cref="IsText"/>,
/// and other axis format settings.
/// </remarks>
/// <param name="baseVal">
/// The value of the first major tic (floating point double)
/// </param>
/// <param name="tic">
/// The major tic number (0 = first major tic). For log scales, this is the actual power of 10.
/// </param>
/// <returns>
/// The specified major tic value (floating point double).
/// </returns>
private double CalcMajorTicValue( double baseVal, double tic )
{
if ( this.IsDate ) // date scale
{
XDate xDate = new XDate( baseVal );
switch ( this.majorUnit )
{
case DateUnit.Year:
default:
xDate.AddYears( tic * this.step );
break;
case DateUnit.Month:
xDate.AddMonths( tic * this.step );
break;
case DateUnit.Day:
xDate.AddDays( tic * this.step );
break;
case DateUnit.Hour:
xDate.AddHours( tic * this.step );
break;
case DateUnit.Minute:
xDate.AddMinutes( tic * this.step );
break;
case DateUnit.Second:
xDate.AddSeconds( tic * this.step );
break;
}
return xDate.XLDate;
}
else if ( this.IsLog ) // log scale
{
return baseVal + (double) tic;
}
else // regular linear scale
{
return baseVal + (double) this.step * tic;
}
}