Nevron Forum

Is it possible to remove date of not exist data from X axis?

https://www.nevron.com/Forum/Topic5906.aspx

By inhyuk son - Thursday, December 1, 2011

Hi~ Nevron.

I want to remove some date from X axis.
Because I don't have a data of the date.
Is it possible?
Many thanks~


//sample source is here.
NCartesianChart m_Chart = (NCartesianChart)nChartControl1.Charts[0];
m_Chart.BoundsMode = BoundsMode.Stretch;

NDateTimeScaleConfigurator dateTimeScale = new NDateTimeScaleConfigurator();
dateTimeScale.AutoDateTimeUnits = new NDateTimeUnit[] { NDateTimeUnit.Day };
m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = dateTimeScale;

NLineSeries line = (NLineSeries)m_Chart.Series.Add(SeriesType.Line);
line.UseXValues = true;

line.XValues.Add(new DateTime(2011, 1,1));
line.Values.Add(100);

line.XValues.Add(new DateTime(2011, 1, 2));
line.Values.Add(110);

//there is not data of 3.Jan.2011. I want to remove 3.Jan.2011 from the axis.

line.XValues.Add(new DateTime(2011, 1, 4));
line.Values.Add(120);

line.XValues.Add(new DateTime(2011, 1, 5));
line.Values.Add(100);

nChartControl1.Refresh();
By Nevron Support - Thursday, December 1, 2011

Hi Inhyuk,

Take a look at the All Examples\xes\Scaling\Date Time Work Calendar - it allows you to skip dates from the axis.

By inhyuk son - Friday, December 2, 2011

Hi~
I already check it.
But I want to remove 3.Jan.2011 not Sunday.

thanks~
By Nevron Support - Monday, December 5, 2011

Hi Inhyuk,

You simply have to add a different set of rules - in this case you can use the NDateTimeRangeRule which enables to you to mark a range of days as non working (skipped). Check out the following topic:

http://helpdotnetvision.nevron.com/UsersGuide_Axes_Scale_Work_Calendar.html

It discusses the different types of date/time rules in more detail.