Profile Picture

DateTime Axis Issue

Posted By inhyuk son 14 Years Ago
Author
Message
bob milanov
Posted 14 Years Ago
View Quick Profile
Supreme Being

Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)

Group: Forum Members
Last Active: 6 Months Ago
Posts: 153, Visits: 11

Hi Inhyuk,

You have to turn off tick rounding:

dateTimeScale.RoundToTickMin = false;

This will make the axis start at first date time value. Another thing to consider is using one of the more advanced date time scales range / value timeline, which will annotate the axis better.

Hope this helps - let me know if you meet any problems.

Best regards,
Bob

 



inhyuk son
Posted 14 Years Ago
View Quick Profile
Junior Member

Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)

Group: Forum Members
Last Active: 12 Years Ago
Posts: 21, Visits: 1
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));
}
}

Attachments
1.PNG (40 views, 11.00 KB)


Similar Topics


Reading This Topic