MajorStep changing on y linear axis when zooming in

2 posts, 0 answers
  1. Borislav
    Borislav avatar
    15 posts
    Member since:
    Nov 2016

    Posted 02 Aug Link to this post

    Hello,

    I have issues with major step on the y linearAxis changing when zooming in. Generated ticks and corresponding grid is displayed correctly only in the case when whole chart is shown (zoom = 1). When I zoom in, interval between ticks on y axis is changed. Please note that I have applied similar logic on the zoom event on the x axis and it's working fine. However, it seems that MajorStep on the linear y axis cannot be changed in the same like MajorTickInterval  on the categorical x axis. So, how to keep interval between ticks on the y axis constant after changing the zoom settings?

    Here is the code snippet I'm using:

    private void View_ZoomChanged(object sender, EventArgs e)
            {
                var horizontalAxis = radChartView1.Axes[0] as CategoricalAxis;
                int DesiredHorizontalTickInterval = 12;
                double horizontalScale = (radChartView1.View as IChartView).ZoomWidth;
                int zoomWidth = (int)(horizontalScale + .5);
                if (horizontalAxis.MajorTickInterval != zoomWidth * DesiredHorizontalTickInterval)
                {
                    horizontalAxis.MajorTickInterval = zoomWidth * DesiredHorizontalTickInterval;
                }
     
                int desiredVerticalMajorStep = 7;
     
                double verticalScale = (radChartView1.View as IChartView).ZoomHeight;
                int zoomHeight = (int)(verticalScale + .5);
                var yAxis = ((sender as ChartView).Axes.Last() as LinearAxis);
                if (yAxis.MajorStep != zoomHeight * desiredVerticalMajorStep)
                {
                    yAxis.MajorStep = zoomHeight * desiredVerticalMajorStep;
                }
            }

  2. Borislav
    Borislav avatar
    15 posts
    Member since:
    Nov 2016

    Posted 03 Aug Link to this post

    Any help with this one?
Back to Top