hi~
I set date time format to AxisX, but it doesn't work.
Something wrong?
One more question.
I added DateTime data, it is started 01/03/2010.
But AxisX of chart is started earlier than 01/03/2010.
I want axis to start 01/03/2010.
thanks~~
Source code is here :
NChart m_Chart = this.xChart2.Charts[0];
NLineSeries line = (NLineSeries)m_Chart.Series.Add(SeriesType.Line);
line.UseXValues = true;
line.DataLabelStyle.Visible = false;
line.InflateMargins = true;
NDateTimeScaleConfigurator dateTimeScale = new NDateTimeScaleConfigurator();
dateTimeScale.LabelStyle.Angle = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 90);
dateTimeScale.LabelStyle.ContentAlignment = ContentAlignment.MiddleLeft;
dateTimeScale.AutoDateTimeUnits = new NDateTimeUnit[] { NDateTimeUnit.Day };
m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = dateTimeScale;
line.XValues.ValueFormatter = new NDateTimeValueFormatter("yy-MM-dd"); // It doesn't work
Random random = new Random();
DateTime startDate = new DateTime(2010, 03, 01);
DateTime endDate = startDate.AddYears(1);
TimeSpan span = endDate - startDate;
span = new TimeSpan(span.Ticks / 30);
if (span.Ticks > 0)
{
while (startDate < endDate)
{
line.XValues.Add(startDate);
startDate += span;
line.Values.Add(random.Next(100));
}
}
1.PNG
(40 views,
11.00 KB)