DateTimeContinuous.Minimum and DateTimeContinuous.Maximum
DateTimeContinuous.ActualVisibleRange (both minimum and maximum).
DateTimeContinuous,ActualRange (both min and max properties)
My understanding is:
ActualRange is the data the chart contains.
ActualVisibleRange is the current viewport - or what the user sees.
Minimum and Maximum is the setter for ActualRange. But not entirely sure. (Need some explanation).
So if I load a year of data (e.g. January thru Dec 2013), my actual range will be (1/2013 - 12/2013). If I then zoom and pan so that only march is displayed, my actualVisibleRange will change to (3/2013). The chart still contains the other data points, but they are not visible, so I need to zoom and pan to see them.
Is there a way to programmatically set the ActualVisibleRange attribute?
How about the ActualRange?
What do the Minimum and Maximum attributes control?
8 Answers, 1 is accepted
The Minimum and Maximum properties exist so that you are able to set a manual range. They, however, would not return the automatic range that the chart has calculated. To get the automatic range you can use the ActualRange property. When you have manually set the Minimum and/or Maximum, this property holds the user defined values as well, so it really is an axis' actual range property.
The ActualVisibleRange is the actual visible range. This is when you zoom and pan, whatever you see in the view port (plot area), this is the ActualVisibleRange.
1. Is there a way to programmatically set the ActualVisibleRange attribute?
No, there is no such a feature. However, you can use the HorizontalZoomRangeStart and End properties to zoom in. Say that the axis has a range from 0 to 1000 and you need to zoom from 250 to 350. You need to simply set the horizontal zoom range start to 0.25 and the end to 0.35.
2. How about the ActualRange?
You need to set the Minimum and Maximum properties of the axis.
3. What do the Minimum and Maximum attributes control?
They simply control the minimum and maximum of the axis. Say that you have a point with value -1000. If you do not set the minimum and maximum, the axis will calculate an automatic range so that the -1000 value is shown. But of you set a Minium of 0 and Maximum of 100, this negative value will not be show because it would not be in the visible range.
When the user is zooming in chart, the values of DateTime Axis are updated automaticaly. But sometimes, the values displayed are e.g. 01/03/2017 00:02:38 or maybe 01/05/2017 00:08:24.
I found a solution to round up the seconds, but I can't apply it. You said that is it impossible to set the ActualVisibleRang, but there is an other possibility to apply my changements ?
Thank you !
Could you please explain in more details what the end goal is? What do you mean when saying that you have a solution "to round up the seconds"?
I am not sure how it will fit your needs but would like to mention that the DateTime axis you to set their LabelFormat property to define the format for their labels.
Telerik by Progress
To round up, I'm doing this :
var axeX =
.memAxeXMini = axeX.ActualVisibleRange.Minimum;
.memAxeXMaxi = axeX.ActualVisibleRange.Maximum;
//Arrondi les bornes extrêmes pour avoir 0 seconde
TimeSpan roundUp = TimeSpan.FromSeconds(60);
.memAxeXMini.Ticks + roundUp.Ticks - 1) / roundUp.Ticks) * roundUp.Ticks);
.memAxeXMaxi.Ticks + roundUp.Ticks - 1) / roundUp.Ticks) * roundUp.Ticks);
updateAxesDateTime(axeX, this.memAxeXMini, this.memAxeXMaxi);
The goal is representing by "before" and "after" attached files. Seconds are round up to next minute.
After rounded up seconds, I'm modifying axis like this :
updateAxesDateTime(DateTimeContinuousAxis pAxe, DateTime pDateDebut, DateTime pDateFin)
TimeSpan range = pDateFin - pDateDebut;
(range >= TimeSpan.FromMinutes(1) && range < TimeSpan.FromMinutes(4))
//Visu sur 1 à 4 minutes
//Interval 15 secondes
pAxe.MajorStepUnit = Telerik.Charting.TimeInterval.Second;
pAxe.MajorStep = 15;
.... But I'm sorry, It's working find. I'm setting seconds for a little range and I looked a biggest range and I looked displayed minutes... Sorry sorry.
But, I have an other question that I asked here : http://www.telerik.com/forums/datetimecontinuousaxis-ticks. It is in link with this problem.
I don't know if I'm clear but I'm french and I'm not good in english.
Thank you for the additional information.
When you zoom-in/out into the chart's plot area, the step of the axes is automatically re-calculated so that a meaningful number of ticks is displayed. This is why you observe the described behavior. You can avoid this and leave the original step of the axis by setting its IsStepRecalculationOnZoomEnabled property to False.
If you want to display different ticks and labels while zooming and still have a rounded values on the axis, you will need to manually calculate the MajorStep value, as you already doing. If I understand you correctly you managed to make this work on your side.
About your other question, I noticed that Peter Mladenov already answered it in the forum. Does its reply answers your question?
Telerik by Progress
You'r right, it's IsStepRecalculationOnZoomEnabled property that i needed to set to False !
Now, ticks are good.
I'm going to say it to Peter Mladenov.
Thank you very much !
Now, I can set custom ticks, but I have an other question : How I can change de Minimum property of axis ?
This is the same question of the last 28th April because I round down datetime depending on zoom but can't apply the new value.
You can use the Minimum property of the axis. However, keep in mind that this is the minimum of the entire axis range, not the minimum of the visible range. If you want to set the visible range of the axis you can use the HorizontalZoomRangeStart and HorizontalZoomRangeEnd properties and the analogical vertical properties. They work in relative units between 0 and 1. You can read more about the properties in the Scroll and Zoom article.
Telerik by Progress