Group: Forum Members
Last Active: 12 Years Ago
Posts: 21,
Visits: 1
|
Hi~ I try to remove not working day from X axis by NMonthDayRule. But I got a problem. If the start month is November, the chart throw ArgumentOutOfRangeException. Please check my code. thanks~
-- Exception Message System.ArgumentOutOfRangeException: Year, Month, and Day parameters describe an un-representable DateTime. at System.DateTime.DateToTicks(Int32 year, Int32 month, Int32 day)
-- Sample source NCartesianChart m_Chart = (NCartesianChart)nChartControl1.Charts[0]; m_Chart.BoundsMode = BoundsMode.Stretch;
NDateTimeScaleConfigurator dateTimeScale = new NDateTimeScaleConfigurator(); dateTimeScale.AutoDateTimeUnits = new NDateTimeUnit[] { NDateTimeUnit.Month }; m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = dateTimeScale;
NBarSeries line = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar); line.UseXValues = true;
DateTime startDT = new DateTime(2010, 11, 01); DateTime endDT = new DateTime(2011, 01, 03); while (startDT <= endDT) { if (startDT.DayOfWeek != DayOfWeek.Saturday && startDT.DayOfWeek != DayOfWeek.Sunday && startDT.DayOfYear != 365) { line.XValues.Add(startDT); line.Values.Add(100); } startDT = startDT.AddDays(1); }
dateTimeScale.Calendar.Rules.Clear(); dateTimeScale.EnableCalendar = true;
NWeekDayRule wdr = new NWeekDayRule(); wdr.Saturday = false; wdr.Sunday = false; dateTimeScale.Calendar.Rules.Add(wdr);
NMonthDayRule mdr = new NMonthDayRule(); mdr.December = true; mdr.Day = 31; dateTimeScale.Calendar.Rules.Add(mdr);
nChartControl1.Refresh();
|
Group: Forum Members
Last Active: Last Week
Posts: 3,054,
Visits: 4,009
|
Hi Inhyuk, Thank you for pointing out this issue - it actually occurs only for days 29, 30 or 31 as they may not be present in each month. The issue will be fixed in the upcoming major release of the controls.
Best Regards, Nevron Support Team
|