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

MajorStep changing on y linear axis when zooming in

1 Answer 68 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Borislav
Top achievements
Rank 1
Borislav asked on 03 Aug 2017, 12:51 AM

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;
            }
        }

1 Answer, 1 is accepted

Sort by
0
Borislav
Top achievements
Rank 1
answered on 03 Aug 2017, 03:07 PM
Any help with this one?
Tags
ChartView
Asked by
Borislav
Top achievements
Rank 1
Answers by
Borislav
Top achievements
Rank 1
Share this question
or