Applies to: Nevron Chart for .NET
How to display only years in Nevron Chart for .NET Date Time scale?
You can configure the Date Time scale to display only years in the chart axis. You can use fixed step + year only formatting. The following code snippet shows how to apply this to the X axis:
[C#]
NDateTimeScaleConfigurator dateTimeScale =
new
NDateTimeScaleConfigurator();
// to specify year formatting
dateTimeScale.MajorTickMode = MajorTickMode.CustomStep;
dateTimeScale.CustomStep =
new
NDateTimeSpan(1, NDateTimeUnit.Year);
dateTimeScale.EnableUnitSensitiveFormatting =
false
;
dateTimeScale.LabelValueFormatter =
new
NDateTimeValueFormatter(
"yyyy"
);
chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = dateTimeScale;
[VB.NET]
Dim
dateTimeScale
As
New
NDateTimeScaleConfigurator()
' to specify year formatting
dateTimeScale.MajorTickMode = MajorTickMode.CustomStep
dateTimeScale.CustomStep =
New
NDateTimeSpan(1, NDateTimeUnit.Year)
dateTimeScale.EnableUnitSensitiveFormatting =
False
dateTimeScale.LabelValueFormatter =
New
NDateTimeValueFormatter(
"yyyy"
)
chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = dateTimeScale
For more detailed information about Scale Configurators, take a look at the Help Documentation:
Chart for .NET > User's Guide > Axes > Scale > Scale Configurators > Overview
Related examples:
Chart Windows Forms: Axes - Scaling folder
Chart Web Forms: Axes - ScalingArticle ID: 190, Created On: 4/29/2011, Modified: 4/29/2011