This is a migrated thread and some comments may be shown as answers.

DateTimeContinuousAxis last date is not visible

2 Answers 31 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Vipin
Top achievements
Rank 1
Vipin asked on 08 Feb 2016, 09:53 AM
I am using below code snippet but not getting end date on xaxis.[Please refer attached screen print.]
 
I need to show end date irrespective of (Odd/Even)number points. Can you please suggest how to achieve this.
 
public DateTimeContinuousAxis SetTimeInterval(DateTimeContinuousAxis xAxis, int dateCount)
      {
          var range = xAxis.Maximum - xAxis.Minimum;
          double lbs = System.Math.Ceiling(range.TotalDays / 10);
 
          if (lbs > 0 && range.TotalDays / lbs > 5)
          {
              xAxis.MajorStepUnit = TimeInterval.Day;
              xAxis.LabelInterval = 3;//(int)Math.Round(lbs);
              xAxis.LastLabelVisibility = Telerik.Charting.AxisLastLabelVisibility.Visible;
              xAxis.MajorStep = range.TotalDays;
          }
 
          return xAxis;
      }

2 Answers, 1 is accepted

Sort by
0
Vipin
Top achievements
Rank 1
answered on 08 Feb 2016, 10:10 AM

Correction to question in previous post:

I need to show end date irrespective of (Odd/Even)number of data points in the series. Can you please suggest how to achieve this?

0
Dinko
Telerik team
answered on 11 Feb 2016, 09:19 AM
Hi,

Thank you for contacting us.

Let me first explain LabelInterval and MajorStep properties. The LabelInterval property specifies the value indicating that only one on n axis labels will be visible (where n is the value of the property). As for the MajorStep, it specify a step for the major ticks which determines at which values will the major ticks be displayed.

In your case, when you set the LabelInterval to 3 the label will be visible on the third tick. So when you set MajorStep to the total days between the min and max date you are will have only 2 ticks. The last label is not visible because you have only two ticks. You can just adjust the labels on every thick by setting the LabelInterval to 1 which is the default value.

Instead of manually calculating the axis step you can take advantage of the SmartLabelsMode property of the axis which was introduced with the Q2 2015 release. The Axis Smart Labels help article explains in more details how you can use it. 


Regards,
Dinko
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Chart
Asked by
Vipin
Top achievements
Rank 1
Answers by
Vipin
Top achievements
Rank 1
Dinko
Telerik team
Share this question
or