本文介绍了如何在mschart中缩放次要y轴的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个同时具有主要和次要y轴的图,但是在缩放图表区域时,只有主要x轴和主要y轴正在缩放,并且滚动条没有出现在次要Y轴上

I am making a plot which has both primary and secondary y axis but on zooming the chartarea only primary x axis and primary y axis are zooming and the scrollbar doesn't appear on the secondary Y Axis

        chrtarea.CursorX.IsUserEnabled = true;
        chrtarea.CursorX.IsUserSelectionEnabled = true;
        chrtarea.CursorY.IsUserEnabled = true;
        chrtarea.CursorY.IsUserSelectionEnabled = true;

        chrtarea.AxisX.ScaleView.Zoomable = true;
        chrtarea.AxisY.ScaleView.Zoomable = true;
        chrtarea.AxisY2.ScaleView.Zoomable = true;

代码是否有问题,请告知操作方法.

Is there a problem with the code.Please tell how to do this.

推荐答案

我意识到这个问题已经很久了,但是我今天遇到了这个问题.

I realise this question's old but I came up against this today.

您可以切换CursorY以与辅助轴(AxisY2)一起使用:

You can switch CursorY to work with Secondary axis (AxisY2):

    chartarea.CursorY.AxisType = System.Windows.Forms.DataVisualization.Charting.AxisType.Secondary;

这将禁用在主要Y轴上的缩放,因此,如果您希望在两个Y轴上都进行缩放,请遵循Erresen的答案

This will disable zooming on primary Y axis so if you wish to have zooming on both, stick to Erresen's answer

这篇关于如何在mschart中缩放次要y轴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 22:48