Zoom, pan and scrollbar issues

Hi, I've discovered a few problems with the sfChart so I've listed them all here. The attached sample can be used to reproduce each problem.

  1. Scrollbar does not appear for high zoom values. In the sample, if you first thing click the zoom 1 day button, the scrollbar does not appear. It will appear however, if you click the X axis. If you first click 3 or 2 day zoom, then when you click the 1 day zoom, the scrollbar will appear, but not in the correct position. The scrollbar is supposed to appear in the right-most position (scrolled to the last datapoint).
  2. Scrollbar disappears after clicking a zoom button after scrolling. If you first click the 3 day zoom button, then scroll a bit, then click the 3 day zoom button again, the scrollbar disappears.
  3. Scrollbar does not allow scrolling to the last datapoint for high zoom values. After showing the scrollbar for 1 day zoom, it's not possible to scroll to the last datapoint in the series. Only half of the last day is visible.
  4. Can't get VisibleRange immediately after zooming the X axis. The Y axis is supposed to be zoomed into min and max y values within the visible x range. But after clicking a zoom button, the Y axis does not zoom in. It only zooms when you click the button twice, or start to scroll with the scrollbar. How can I get VisibleRange immediately after zooming the X axis so that the Y axis can be zoomed correctly after clicking a zoom button?
  5. When scrolling very quickly to the beginning or end of the chart, the Y zoom doesn't update. 
  6. A MajorGridLine is always visible on the left Y axis when scrolling a zoomed chart. This is particularly visible if you increase the MajorGridLine thickness. The red gridline jumps around the left Y axis as you scroll the chart. Often (but not visible on this sample), the label of the previous interval will also be stuck to the left Y axis. For example, if the leftmost visible label is "9 March", the label "8 March" will be constantly hovering on the left Y axis as you scroll the chart.
  7. Artifacts appear on the left Y axis during scrolling. Small lines or single pixel dots with the same color as the series appear on the left Y axis during scrolling. This is particularly visible when the chart background is black with a bright colored series. In the attachment is an image example.
Please help with these issues, thank you.

Attachment: sfChartZoomTest_35074d8c.rar

15 Replies

MK Muneesh Kumar G Syncfusion Team April 11, 2018 11:49 AM UTC

Hi Tom,

 

Thank you for contacting syncfusion support.

 

We have analyzed the problems reported in your sample. Please find the solution below.

 

S.NO

Query

Solution

1.

Scrollbar does not appear for high zoom values. In the sample, if you first thing click the zoom 1 day button, the scrollbar does not appear. It will appear however, if you click the X axis. If you first click 3 or 2 day zoom, then when you click the 1 day zoom, the scrollbar will appear, but not in the correct position. The scrollbar is supposed to appear in the right-most position (scrolled to the last datapoint).

We have resolved this problem by setting the SmallChange value as 0 for scrollbar as per the below code snippet.

 

Private Sub chart_Loaded(sender As Object, e As RoutedEventArgs)

 

        Dim chart As SfChart

        chart = CType(sender, SfChart)

        scrollBar = CType(chart.PrimaryAxis.GetType.GetField("sfChartResizableBar", BindingFlags.NonPublic Or BindingFlags.GetField Or BindingFlags.Instance).GetValue(chart.PrimaryAxis), SfChartResizableBar)

        scrollBar.SmallChange = 0

 

    End Sub

2.

Scrollbar disappears after clicking a zoom button after scrolling. If you first click the 3 day zoom button, then scroll a bit, then click the 3 day zoom button again, the scrollbar disappears.

We have resolved this problem by updating the previousZoomFactor value of the scrollbar as follows.

 

scrollBar.GetType.GetField("previousZoomFactor", BindingFlags.NonPublic Or BindingFlags.GetField Or BindingFlags.Instance).

            SetValue(scrollBar, chart.PrimaryAxis.ZoomFactor)

 

3.

Scrollbar does not allow scrolling to the last datapoint for high zoom values. After showing the scrollbar for 1 day zoom, it's not possible to scroll to the last datapoint in the series. Only half of the last day is visible.

This problem have resolved by using solution 1.  

4.

Can't get VisibleRange immediately after zooming the X axis. The Y axis is supposed to be zoomed into min and max y values within the visible x range. But after clicking a zoom button, the Y axis does not zoom in. It only zooms when you click the button twice, or start to scroll with the scrollbar. How can I get VisibleRange immediately after zooming the X axis so that the Y axis can be zoomed correctly after clicking a zoom button.

We would like to inform you that visible range will not calculated immediately while setting zoom factor. So we recommend you to get this visible range after the chart layout update as follows.

 

Private Sub chart_LayoutUpdated(sender As Object, e As EventArgs)

        ZoomY(chartPrimaryAxis.VisibleRange)

    End Sub

 

5.

When scrolling very quickly to the beginning or end of the chart, the Y zoom doesn't update. 

This problem have resolved by using solution 4.

6.

A MajorGridLine is always visible on the left Y axis when scrolling a zoomed chart. This is particularly visible if you increase the MajorGridLine thickness. The red gridline jumps around the left Y axis as you scroll the chart. Often (but not visible on this sample), the label of the previous interval will also be stuck to the left Y axis. For example, if the leftmost visible label is "9 March", the label "8 March" will be constantly hovering on the left Y axis as you scroll the chart.

The problem was resolved by setting corresponding IntervalType as Minutes and Interval as 1440 in zoom button clicks as follows.

 

  chartPrimaryAxis.IntervalType = DateTimeIntervalType.Minutes

        chartPrimaryAxis.Interval = 1440

        chartPrimaryAxis.LabelFormat = "MMM/d"

7.

Artifacts appear on the left Y axis during scrolling. Small lines or single pixel dots with the same color as the series appear on the left Y axis during scrolling. This is particularly visible when the chart background is black with a bright colored series. In the attachment is an image example.

We are able to reproduce the issue “FastStepLineSeries edge pixels not rendering properly while scrolling”. The fix will be available on our upcoming volume 2 release, which will be available in month of May, 2018.



 

 

We have modified your sample based on above solutions, please find the sample from the following.

 

Sample : http://www.syncfusion.com/downloads/support/forum/136864/ze/sfChartZoomTest1509826224

 

Please let us know if you have any queries.

 

Thanks,

Muneesh Kumar G.



TO Tom April 15, 2018 03:08 AM UTC

Hi Muneesh, thank you for fixing some of the issues, but some are still remaining:

  1. Scrollbar issue. Your code works for a normal touchmode scrollbar, but not for a modified scrollbar with the number of days over 100. I've modified your sample to include a dictionary file which contains the modifications to the scrollbar, and the number of days set to 200. The problems with the 1 day zoom  is the same as before. If you click the 1 day zoom button the scrollbar does not appear. If you set the number of days to 300, the 2 day zoom button also does not display the scrollbar.
  2. VisibleRange flicker issue. Your suggested method of getting the visible range after the chart update has the side effect of the chart flickering momentarily. This is particularly noticeable with large amount of data (over 1000 days) with a dark background. I believe this is because the chart must first display the non Y zoomed chart, then get the visible range, then lastly show the Y zoomed chart. I would like to remove this flickering. I guess one approach would be to somehow calculate the visible range from the source data without needing to update the chart first to get VisibleRange. Could you suggest an approach that will eliminate the flickering? Note that the source data does not contain weekend days. Also, holidays will not be included, or any days that do not contain data.
  3. Scrolling display issue. I guess this is related to the VisibleRange issue. When scrolling the chart, the chart will first display the non Y zoomed state before displaying the Y zoomed state. Having the chart display twice this way is jarring, as well as probably affects the scrolling performance negatively. 
  4. Perhaps you could add a "SecondaryAxisAutoZoom" feature to the sfChart that enables the chart to automatically zoom the Y axis? This will fix issue 2 and 3. I think many users require this and will save a lot of coding and workarounds and will probably be better performance wise too.
  5. Primary axis gridline issue. Your solution of setting  DateTimeIntervalType to minute instead of days changes the nature of the gridlines. The purpose of the gridlines is to show when a day changes to the next day. For example, a gridline should be shown between the last minute of May 18 and the first minute of May 19, and should stay there during scrolling the chart. But by setting the interval type to minute, the gridlines continuously move from minute to minute during scrolling which is not the correct behavior. So the interval type should be set to day, and the issue remains, that the previous day gridline and label is constantly hovering over the left Y axis during scrolling. This looks like a bug.
  6. Artifact issue. Please also fix artifact issue for FastCandleBitmapSeries. This is visible on the sample.
Thank you.

Attachment: sfChartZoomTest2_3a45a64e.rar


MK Muneesh Kumar G Syncfusion Team April 17, 2018 07:23 AM UTC

Hi Tom, 
 
Please find the solution below. 
 
S.No 
Query 
Solution 
1. 
Scrollbar issue. Your code works for a normal touchmode scrollbar, but not for a modified scrollbar with the number of days over 100. I've modified your sample to include a dictionary file which contains the modifications to the scrollbar, and the number of days set to 200. The problems with the 1 day zoom  is the same as before. If you click the 1 day zoom button the scrollbar does not appear. If you set the number of days to 300, the 2 day zoom button also does not display the scrollbar. 
 
We would like to inform you that, we have rendered the axis scrollbar for minimum zoom position 0.99. So we have checked the condition for ZoomFactor and ZoomPosition as follows.  
 
Also we recommend you to first set the zoom position and then zoom factor. 
 
Code Snippet 
 
Private Sub btZoom1day_Click(sender As Object, e As RoutedEventArgs) Handles btZoom1day.Click 
 
 
        Dim zoomPosition = (1 - (zoomDays / (TestColl.TotalDays))) 
        zoomPosition = If(zoomPosition <= 0.99, zoomPosition, 0.99) 
 
        Dim zoomFactor = (zoomDays / (TestColl.TotalDays)) 
        zoomFactor = If(zoomFactor >= 0.01, zoomFactor, 0.01) 
 
        chartPrimaryAxis.ZoomPosition = zoomPosition 
        chartPrimaryAxis.ZoomFactor = zoomFactor 
 
End Sub     
 
 
2. 
VisibleRange flicker issue. Your suggested method of getting the visible range after the chart update has the side effect of the chart flickering momentarily. This is particularly noticeable with large amount of data (over 1000 days) with a dark background. I believe this is because the chart must first display the non Y zoomed chart, then get the visible range, then lastly show the Y zoomed chart. I would like to remove this flickering. I guess one approach would be to somehow calculate the visible range from the source data without needing to update the chart first to get VisibleRange. Could you suggest an approach that will eliminate the flickering? Note that the source data does not contain weekend days. Also, holidays will not be included, or any days that do not contain data. 
 
We have resolved this problem by calculating the visible range in ActualRangeChanged event of the primary axis. 
 
Code Snippet 
 
XAML 
 
 
<chart:SfChart.PrimaryAxis> 
      <chart:DateTimeCategoryAxis ActualRangeChanged="DateTimeCategoryAxis_ActualRangeChanged" /> 
</chart:SfChart.PrimaryAxis> 
 
 
C# 
 
Private Sub DateTimeCategoryAxis_ActualRangeChanged(sender As Object, e As ActualRangeChangedEventArgs) 
 
        Dim primaryAxis As ChartAxisBase2D 
        primaryAxis = CType(sender, ChartAxisBase2D) 
 
        Dim delta As Double 
        delta = e.ActualMaximum - e.ActualMinimum 
 
        Dim visibleRange As DoubleRange 
 
        Dim rangeStart As Double 
        rangeStart = e.ActualMinimum + delta * primaryAxis.ZoomPosition 
 
        Dim rangeEnd As Double 
        rangeEnd = rangeStart + primaryAxis.ZoomFactor * delta 
 
        visibleRange = New DoubleRange(rangeStart, rangeEnd) 
        ZoomY(visibleRange) 
 
    End Sub 
 
 
3. 
Scrolling display issue. I guess this is related to the VisibleRange issue. When scrolling the chart, the chart will first display the non Y zoomed state before displaying the Y zoomed state. Having the chart display twice this way is jarring, as well as probably affects the scrolling performance negatively.  
 
4. 
Perhaps you could add a "SecondaryAxisAutoZoom" feature to the sfChart that enables the chart to automatically zoom the Y axis? This will fix issue 2 and 3. I think many users require this and will save a lot of coding and workarounds and will probably be better performance wise too. 
 
5. 
Primary axis gridline issue. Your solution of setting  DateTimeIntervalType to minute instead of days changes the nature of the gridlines. The purpose of the gridlines is to show when a day changes to the next day. For example, a gridline should be shown between the last minute of May 18 and the first minute of May 19, and should stay there during scrolling the chart. But by setting the interval type to minute, the gridlines continuously move from minute to minute during scrolling which is not the correct behavior. So the interval type should be set to day, and the issue remains, that the previous day gridline and label is constantly hovering over the left Y axis during scrolling. This looks like a bug. 
 
We have resolved this problem by overriding the visible labels generations method in axis as follows.  
 
XAML 
 
 
<chart:SfChart > 
 
   <chart:SfChart.PrimaryAxis> 
       <local:CustomDateTimeCategory /> 
    </chart:SfChart.PrimaryAxis> 
 
</chart:SfChart> 
 
 
Code Snippet 
 
Class CustomDateTimeCategoryAxis 
    Inherits DateTimeCategoryAxis 
 
    'Overriding this method can generate the labels as required in accordance with the data. 
    Protected Overrides Sub GenerateVisibleLabels() 
 
        If (IntervalType = DateTimeIntervalType.Days) Then 
 
            Dim chartArea As ChartBase 
            chartArea = CType((Me.GetType().GetProperty("Area", (BindingFlags.Instance + BindingFlags.NonPublic + BindingFlags.GetProperty)).GetValue(Me)), ChartBase) 
 
            Dim actualSeries As ChartSeriesBase 
            actualSeries = chartArea.VisibleSeries(0) 
 
            If (Not (actualSeries) Is Nothing) Then 
 
                Dim actualXValues = CType(actualSeries.GetType().GetProperty("ActualXValues", BindingFlags.GetProperty Or BindingFlags.NonPublic Or BindingFlags.Instance).GetValue(actualSeries), System.Collections.IEnumerable) 
 
                Dim xValuesCount = CType(actualXValues, List(Of Double)) 
 
                If ((Not (xValuesCount) Is Nothing) AndAlso (xValuesCount.Count > 0)) Then 
 
                    Dim interval As Double = Me.Interval 
                    Dim position As Double = VisibleRange.Start - VisibleRange.Start Mod interval 
                    Dim xValues = CType(actualXValues, List(Of Double)) 
                    Dim xStartValue = xValues(0).FromOADate() 
 
                    Dim date1 As DateTime = xStartValue.Date 
 
                    Do While (position <= VisibleRange.End) 
                        Dim pos As Integer = CType(Math.Round(position), Integer) 
 
                        If (VisibleRange.Inside(position) AndAlso pos > -1 AndAlso (pos < xValues.Count)) Then 
 
                            Dim xValue = xValues(pos).FromOADate() 
                            If (xValue.Date > date1) Then 
                                date1 = xValue.Date 
                            End If 
 
                            If (xValue.Date = date1) Then 
                                Dim obj As Object = Me.GetLabelContent(pos, actualSeries, actualXValues) 
                                Dim dateTimeAxisLabel = New DateTimeAxisLabel(pos, obj, pos) 
 
                                'The hour is checked for 9 since the data provided starts it's new days with 9 am. 
                                If (xValue.Hour = 9 AndAlso xValue.Minute = 0) Then 
                                    VisibleLabels.Add(dateTimeAxisLabel) 
                                End If 
 
                                date1 = xValue.AddDays(CType(interval, Integer)).Date 
 
                            End If 
 
                        End If 
 
                        position = (position + 1) 
                    Loop 
 
                End If 
            End If 
 
        Else 
            MyBase.GenerateVisibleLabels() 
        End If 
 
    End Sub 
 
    Private Function GetLabelContent(ByVal pos As Integer, ByVal actualSeries As ChartSeriesBase, ByVal actualXValues As Object) As Object 
        If (Not (actualSeries) Is Nothing) Then 
            Dim xValues = CType(actualXValues, List(Of Double)) 
            If ((Not (xValues) Is Nothing) AndAlso (pos < xValues.Count) AndAlso (pos >= 0)) Then 
                Dim xDateTime As DateTime = xValues(pos).FromOADate() 
                Return xDateTime.ToString(Me.LabelFormat, Globalization.CultureInfo.CurrentCulture) 
            Else 
                Dim xStrValues = CType(actualXValues, List(Of String)) 
                If ((Not (xStrValues) Is Nothing) AndAlso pos < xStrValues.Count AndAlso pos >= 0) Then 
                    Return xStrValues(pos) 
                End If 
            End If 
        End If 
        Return pos 
    End Function 
 
End Class 
 
6. 
Artifact issue. Please also fix artifact issue for FastCandleBitmapSeries. This is visible on the sample. 
 
We have already logged issue report for this. The fix will be available on our upcoming volume 2 release, which will be available in month of May, 2018. 
 
 
We have modified your sample based on above solution, please find the sample from the below location.  
 
 
Please let us know if you have any queries.  
 
Thanks, 
Muneesh Kumar G. 
 



TO Tom April 18, 2018 05:29 AM UTC

Hi Muneesh, 

I greatly appreciate your help so far, most of the problems have been resolved! 

There is one important issue remaining, and that is the 1 day zoom issue. You say the scrollbar is rendered with a minimum zoom position of 0.99. As I understand, this means that the scrollbar of sfChart cannot display properly for zoom factors less than 0.01? If this is the case it is a major limitation. This means that, for my sample, for 200 days the smallest I can zoom with correct scrollbar display and scrolling behavior is 2 days. If I have 500 days, I can only zoom up to 5 days, etc. If there are no workarounds to this issue, can you have this fixed by removing this limitation? Or increasing the resolution so that the scrollbar can be rendered properly with a minimum zoom position of at least 0.9999? 

As for your solution to the primary axis gridline hovering over the Y axis issue, it works fine if the first minute of the day is always 9:00 am, however, this might not always be the case. Sometimes it could be 8:40 am, or even 13:12 pm, if there is data missing. Therefore, the code would need to loop over every single minute to find the first minute of every day. Since there could be hundreds of thousands of minutes I'm concerned this will slow down responsiveness of the chart, especially during scrolling.

Thank you.



MK Muneesh Kumar G Syncfusion Team April 19, 2018 05:58 PM UTC

Hi Tom,  
  
Please find the solution below.  
  
S.No  
Query  
Solution  
1.  
There is one important issue remaining, and that is the 1 day zoom issue. You say the scrollbar is rendered with a minimum zoom position of 0.99. As I understand, this means that the scrollbar of sfChart cannot display properly for zoom factors less than 0.01? If this is the case it is a major limitation. This means that, for my sample, for 200 days the smallest I can zoom with correct scrollbar display and scrolling behavior is 2 days. If I have 500 days, I can only zoom up to 5 days, etc. If there are no workarounds to this issue, can you have this fixed by removing this limitation? Or increasing the resolution so that the scrollbar can be rendered properly with a minimum zoom position of at least 0.9999?  
 
We can achieve your requirement to zoom the char to below 5 days by using PinchZooming / EnableZoomingToolBar / EnableSelectionZooming / EnableMouseWheelZooming. We can move the chart using EnablePanning as true as per the below code snippet. 
 
Code Snippet[XAML] 
 
            
<chart:SfChart IsManipulationEnabled="True"> 
 
 
 
  <chart:SfChart.Behaviors> 
                <chart:ChartZoomPanBehavior EnableZoomingToolBar="True" 
                                            EnableSelectionZooming="True"                                             
                                            EnablePinchZooming="True" 
                                            EnableMouseWheelZooming="True"                                           
                                            EnablePanning="True"/> 
   </chart:SfChart.Behaviors> 
 
 
 
</chart:SfChart> 
 
Please refer below UG documentation for more details.  
 
 
 
2. 
As for your solution to the primary axis gridline hovering over the Y axis issue, it works fine if the first minute of the day is always 9:00 am, however, this might not always be the case. Sometimes it could be 8:40 am, or even 13:12 pm, if there is data missing 
Instead of checking 9:00 am we have check the initial date of the visible range which satisfies your requirement whatever discontinuous the data may be. 
 
Code snippet [C#]: 
                                If (Math.Ceiling(VisibleRange.Start) < position) Then
                                    VisibleLabels.Add(dateTimeAxisLabel)
                                End If
 
 
3.  
 Therefore, the code would need to loop over every single minute to find the first minute of every day. Since there could be hundreds of thousands of minutes I'm concerned this will slow down responsiveness of the chart, especially during scrolling. 
We are able to reproduce the issue “Scrolling get slowdown in huge data with DatetimeCategoryAxis”. The fix for this issue will be available in one of our upcoming volume release. 

 
  
We have modified your sample based on above solution, please find the sample from the below location.   
  
  
Please let us know if you have any queries.   
  
Thanks,  
Muneesh Kumar G.  
 



TO Tom April 22, 2018 04:44 PM UTC

Hi Muneesh, 

Thank you for resolving all issues, and for providing a way to zoom to any range via the sfChart toolbar. However for the 1 day zoom issue I still prefer to use my own interface (1 day zoom button + scrollbar) rather than the sfChart toolbar. Therefore, it would be great if this issue is fixed so that zooming can be done through code.

Thanks.


MK Muneesh Kumar G Syncfusion Team April 23, 2018 11:21 AM UTC

Hi Tom,  
 
We can achieve your requirement by removing condition checking in zoomfactor and zoomposition in axis as follows.  
 
Code snippet [XAML]: 
Private Sub btZoom1day_Click(sender As Object, e As RoutedEventArgs) Handles btZoom1day.Click 
 
        'SET X ZOOM 
        Dim zoomDays As Integer = 1 
 
        Dim zoomPosition = (1 - (zoomDays / (TestColl.TotalDays))) 
        'zoomPosition = If(zoomPosition <= 0.99, zoomPosition, 0.99) 
        chartPrimaryAxis.ZoomPosition = zoomPosition 
 
        Dim zoomFactor = (zoomDays / (TestColl.TotalDays)) 
        'zoomFactor = If(zoomFactor >= 0.01, zoomFactor, 0.01) 
 
        .. 
    End Sub 
 
In this case scrollbar size is too small to scroll, so we recommend you to use panning option for moving the chart.  
 
Please let us know if you have any queries.  
 
Thanks,
Muneesh Kumar G.
 



TO Tom April 23, 2018 12:51 PM UTC

Hi Muneesh,

Mouse panning is not a good solution because it takes very long time to pan from the end of the chart to the beginning at high zoom values. Therefore, a scrollbar must be used to quickly move the chart.
  1. Yes, the scrollbar gets very small so a solution would be to incorporate a minimum scrollbar size. 
  2. The scrollbar is not positioned completely to right, as should be when scrolled to the last datapoint.
  3. There is still an issue where when clicking the 1 day zoom button from the zoom-all state the chart does not Y scale correctly. It only Y scales when starting to scroll the chart. 
Thank you.




MK Muneesh Kumar G Syncfusion Team April 25, 2018 05:24 PM UTC

Hi Tom, 
 
Please find the response below.  
 
Query 
Solution 
1  Yes, the scrollbar gets very small so a solution would be to incorporate a minimum scrollbar size.  
2  The scrollbar is not positioned completely to right, as should be when scrolled to the last datapoint. 
The reported issue can be resolved by setting the ScrollButtonVisibility property as collapsed in scroll bar template. 
 
Code Snippet: 
 
<ControlTemplate x:Key="customAxisTemplate"> 
 
 
<chart:SfChartResizableBar x:Name="sfchartResizableBar"     
                           EnableTouchMode="True" 
                           Style="{StaticResource sfResizableBarStyle}" 
                           ScrollButtonVisibility="Collapsed" 
                           SmallChange="0"/> 
</chart:ChartCartesianAxisPanel> 
 
</ControlTemplate> 
 
 
3  There is still an issue where when clicking the 1 day zoom button from the zoom-all state the chart does not Y scale correctly. It only Y scales when starting to scroll the chart.  
We have resolved this problem by calculating y axis range in CalculateVisibleRange  method in axis as per the below code snippet. 
 
Code Snippet 
 
 
Class CustomNumericalAxis 
    Inherits NumericalAxis 
 
 
 
Protected Overrides Sub CalculateVisibleRange(avalableSize As Size) 
 
        MyBase.CalculateVisibleRange(avalableSize) 
 
        Dim area = CType(Me.GetType().GetProperty("Area", BindingFlags.GetProperty Or BindingFlags.NonPublic Or BindingFlags.Instance).GetValue(Me), SfChart) 
        Dim primaryAxis = CType(area.PrimaryAxis, ChartAxisBase2D) 
        Dim actualRange = CType(primaryAxis.GetType().GetProperty("ActualRange", BindingFlags.GetProperty Or BindingFlags.NonPublic Or BindingFlags.Instance).GetValue(primaryAxis), DoubleRange) 
 
        If (actualRange.IsEmpty) Then 
            Return 
        End If 
 
        Dim primaryAxisVisibleRange = CalculatePrimarAxisRange(area, primaryAxis, actualRange) 
 
        ZoomY(primaryAxisVisibleRange, area) 
 
    End Sub 
 
 
 
End Class 
 
 
 
We have modified our sample based on this, please find the sample from the following location. 
 
 
Please let us know if you have any queries.  
 
Thanks, 
Muneesh Kumar G 



TO Tom April 27, 2018 11:45 AM UTC

Hi Muneesh,

Thank you so much, all issues have been resolved.


MK Muneesh Kumar G Syncfusion Team April 30, 2018 05:10 AM UTC

Hi Tom,

Thanks for the update.

We are glad to know that the given solution works. Please let us know if you need any further assistance.

Thanks,
Muneesh Kumar G.


TO Tom May 1, 2018 06:13 AM UTC

Hi Muneesh,

Unfortunately, more issues have cropped up. The attached sample has two comboboxes. The first one changes the data source between A and B. A contains 200 days of data, where B only contains 100 days. The other combobox switches the display state of the labels/primary axis. When the display state is "Collapsed", the primary axis should be collapsed and there should be no scrollbar. 

The goal is to have the chart behave correctly for all combinations: for all zoom days, when changing label display state, and when changing data source.

  1. Outside: Changing the data source when the zoom level is 1 day fails to Y zoom. Also, CalculateVisibleRange gets called twice, except for 1 day zoom. This slows down the chart because GetExtremes is executed twice.
  2. Inside: Switching data source fails to Y zoom when the zoom level is 3, 2 and 1. For examle, first click zoom 1 day, then change from A to B.
  3. Collapsed: Switching data source fails to Y zoom when the zoom level is 3, 2 and 1.
It seems to me the problem is somehow partially connected to the visibility of the primary axis labels. It also seems like when CalculateVisibleRange gets called twice it works, and fails when CalculateVisibleRange is only called once. It seems like in many cases the first time CalculateVisibleRange is called, actualXRange is wrong.

Attachment: sfChartZoomTest3_4b54d205.rar


MK Muneesh Kumar G Syncfusion Team May 2, 2018 04:11 PM UTC

Hi Tom, 
Please find the response below.  
Query 
Solution 
1. Outside: Changing the data source when the zoom level is 1 day fails to Y zoom. Also, CalculateVisibleRange gets called twice, except for 1 day zoom. This slows down the chart because GetExtremes is executed twice. 
 
2. Inside: Switching data source fails to Y zoom when the zoom level is 3, 2 and 1. For examle, first click zoom 1 day, then change from A to B. 
 
3. Collapsed: Switching data source fails to Y zoom when the zoom level is 3, 2 and 1. 
Sorry for the inconvenience caused.  
 
We have resolved these problems by updating the y axis visible range in x axis CalculateVisibleRange override method as per the below code snippet
 
Code Snippet 
 
Class CustomDateTimeCategoryAxis 
    Inherits DateTimeCategoryAxis 
 
 
 
    'We need to update the secondary axis visible range after the primary axis actual range is updated. 
    Protected Overrides Sub CalculateVisibleRange(avalableSize As Size) 
        MyBase.CalculateVisibleRange(avalableSize) 
        Dim area = CType(Me.GetType().GetProperty("Area", BindingFlags.GetProperty Or BindingFlags.NonPublic Or BindingFlags.Instance).GetValue(Me), SfChart) 
        Dim secondaryAxis = CType(area.SecondaryAxis, ChartAxisBase2D) 
 
        Dim customSecondaryAxis = CType(secondaryAxis, CustomLogarithmicAxis) 
 
        If (customSecondaryAxis.previousXVisibleRange = VisibleRange) Then Return 
        customSecondaryAxis.ZoomY(Me.VisibleRange, area) 
    End Sub 
 
 
 
End Class 
 
 
 
We have modified the sample based on this, please find the sample from the following location. 
 
 
Please let us know if you have any queries.  
Thanks, 
Muneesh Kumar G. 
 



TO Tom May 4, 2018 03:43 AM UTC

Thank you Muneesh, this works.


MK Muneesh Kumar G Syncfusion Team May 7, 2018 04:27 AM UTC

Hi Tom, 
 
Thanks for the update. 
 
We are glad to know that the given solution works. Please let us know if you need any further assistance. 
 
Thanks, 
Muneesh Kumar G. 
 


Loader.
Up arrow icon