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

ActualVisibleRange and ActualRange

8 Answers 318 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Terry
Top achievements
Rank 1
Terry asked on 21 Apr 2014, 05:43 PM
I need an explanation on a few items. I am using a DateTimeContinuous axis for my X-Axis on my chartview. There are three properties I would like some clarification on the following:

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.

The questions...
Is there a way to programmatically set the ActualVisibleRange attribute?
How about the ActualRange?
What do the Minimum and Maximum attributes control?

Thanks.

 




8 Answers, 1 is accepted

Sort by
0
Petar Marchev
Telerik team
answered on 23 Apr 2014, 07:13 AM
Hello Terry,

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.

Regards,
Petar Marchev
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Valentin
Top achievements
Rank 1
Iron
Iron
answered on 28 Apr 2017, 12:17 PM

Hello,

 

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 !

0
Tanya
Telerik team
answered on 03 May 2017, 10:46 AM
Hello Valentin,

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.

Regards,
Tanya
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Valentin
Top achievements
Rank 1
Iron
Iron
answered on 03 May 2017, 12:42 PM

Hello Tanya,

 

To round up, I'm doing this :

var axeX = this.chartVariables.HorizontalAxis as DateTimeContinuousAxis;
 
            this.memAxeXMini = axeX.ActualVisibleRange.Minimum;
            this.memAxeXMaxi = axeX.ActualVisibleRange.Maximum;
 
            //Arrondi les bornes extrêmes pour avoir 0 seconde
            TimeSpan roundUp = TimeSpan.FromSeconds(60);
            this.memAxeXMini = new DateTime(((this.memAxeXMini.Ticks + roundUp.Ticks - 1) / roundUp.Ticks) * roundUp.Ticks);
            this.memAxeXMaxi = new DateTime(((this.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 :

private void updateAxesDateTime(DateTimeContinuousAxis pAxe, DateTime pDateDebut, DateTime pDateFin)
        {
            TimeSpan range = pDateFin - pDateDebut;
 
            if (range >= TimeSpan.FromMinutes(1) && range < TimeSpan.FromMinutes(4)) //Visu sur 1 à 4 minutes
            {
                pAxe.LabelFormat = "dd-MM HH:mm:ss";
                //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.

Regards.

0
Martin Ivanov
Telerik team
answered on 08 May 2017, 10:09 AM
Hello Valentin,

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? 

Regards,
Martin
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Valentin
Top achievements
Rank 1
Iron
Iron
answered on 09 May 2017, 08:01 AM

Hello Martin,

 

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 !

0
Valentin
Top achievements
Rank 1
Iron
Iron
answered on 09 May 2017, 12:51 PM

Hello,

 

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.

 

Thank you.

0
Martin Ivanov
Telerik team
answered on 12 May 2017, 08:09 AM
Hello Terry,

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.

Regards,
Martin
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
ChartView
Asked by
Terry
Top achievements
Rank 1
Answers by
Petar Marchev
Telerik team
Valentin
Top achievements
Rank 1
Iron
Iron
Tanya
Telerik team
Martin Ivanov
Telerik team
Share this question
or