Applies to: Nevron Chart for .NET
How to localize and format the week in the Chart Range Timeline scale?
If you are using the Chart Range Timeline Scale (NRangeTimelineScaleConfigurator), you may want to localize the Week. For example, change W (Week in English) to S (Semaine in French).
The following code demonstrates how to change the Week formatting for the Second Row of the Range Timeline scale in Nevron Chart for .NET. If the week unit appears in the third or first row you can do the same for FirstRow and ThirdRow (see the last three lines of code).
[C#]
NLineSeries series = (NLineSeries)chart.Series.Add(SeriesType.Line);
series.UseXValues =
true
;
series.Values.AddRange(
new
double
[] { 20, 30, 15 });
series.XValues.Add(
new
DateTime(2012, 03, 01, 12, 0, 0).ToOADate());
series.XValues.Add(
new
DateTime(2012, 03, 15, 12, 0, 0).ToOADate());
series.XValues.Add(
new
DateTime(2012, 03, 31, 12, 0, 0).ToOADate());
NRangeTimelineScaleConfigurator scaleX =
new
NRangeTimelineScaleConfigurator();
scaleX.SecondRow.TickMode = TimelineScaleRowTickMode.Custom;
scaleX.SecondRow.CustomStep =
new
NDateTimeSpan(1, NDateTimeUnit.Week);
NDateTimeValueFormatter vf =
new
NDateTimeValueFormatter(
"#W"
);
vf.WeekFormatString =
"S{0}"
;
scaleX.SecondRow.DateTimeUnitFormatterPairs.WeekFormatter = vf;
[VB.NET]
Dim
series
As
NLineSeries =
DirectCast
(chart.Series.Add(SeriesType.Line), NLineSeries)
series.UseXValues =
True
series.Values.AddRange(
New
Double
() {20, 30, 15})
series.XValues.Add(
New
DateTime(2012, 3, 1, 12, 0, 0).ToOADate())
series.XValues.Add(
New
DateTime(2012, 3, 15, 12, 0, 0).ToOADate())
series.XValues.Add(
New
DateTime(2012, 3, 31, 12, 0, 0).ToOADate())
Dim
scaleX
As
New
NRangeTimelineScaleConfigurator()
scaleX.SecondRow.TickMode = TimelineScaleRowTickMode.[Custom]
scaleX.SecondRow.CustomStep =
New
NDateTimeSpan(1, NDateTimeUnit.Week)
Dim
vf
As
New
NDateTimeValueFormatter(
"#W"
)
vf.WeekFormatString =
"S{0}"
scaleX.SecondRow.DateTimeUnitFormatterPairs.WeekFormatter = vf
Article ID: 212, Created On: 3/19/2012, Modified: 3/19/2012