English 中文(简体)
• 如何在哺乳动物中进行二次和轴心
原标题:How to zoom secondary y axis in mschart

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;

守则有问题。 请说明如何做到这一点。

问题回答

我认识到这个问题是老的,但今天我反对这个问题。

我能实现一个可聚居的亚轴线的唯一途径是在轴心认为变化时改变Y轴线的大小和min:

private void ChartMainAxisViewChanged(object sender, ViewEventArgs e)
{
    chartMain.ChartAreas[0].AxisY2.ScaleView.Position = chartMain.ChartAreas[0].AxisY.ScaleView.Position / 10.0;
    chartMain.ChartAreas[0].AxisY2.Minimum = chartMain.ChartAreas[0].AxisY.ScaleView.ViewMinimum / 10.0;
    chartMain.ChartAreas[0].AxisY2.Maximum = chartMain.ChartAreas[0].AxisY.ScaleView.ViewMaximum / 10.0;
    chartMain.ChartAreas[0].AxisY2.Interval = chartMain.ChartAreas[0].AxisY.Interval / 10.0;
    chartMain.ChartAreas[0].AxisY2.IntervalOffset = chartMain.ChartAreas[0].AxisY.IntervalOffset / 10.0;
}

这取决于Y轴和Y2轴之间的比例。 地雷有时是10:1,因此很容易转化,但如果你有活力,则需要计算这一比率。

最后两条路线也调整了间隔,但如果你不希望间隔一致,你就不必这样做。

我认识到这个问题是老的,但今天我反对这个问题。

您可以将CursorY转而与二级轴线合作(AxisY2):

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

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





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签