简体   繁体   English

Visual Studio C#图表。 如何控制X轴编号?

[英]Visual studio C# chart. How to control the x-axis numbering?

I'm learning how to use charts in C# using Visual studio. 我正在学习如何使用Visual Studio在C#中使用图表。

I'm writing a Windows Forms application to test the zoom and I don't like how it messes up the axis numbering. 我正在编写Windows窗体应用程序以测试缩放,但我不喜欢它如何弄乱了轴编号。

How can I force the Y-axis grid to be placed symetrically on both sides of zero. 如何强制将Y轴网格对称地放置在零的两侧。 And always include the zero if zero is between axis min and max? 如果轴的最小值和最大值之间为零,则始终包括零吗?

And I'm only interested in the Y-axis. 而且我只对Y轴感兴趣。

在此处输入图片说明

I'm assuming you already have 我假设你已经有

using System.Windows.Forms.DataVisualization.Charting;

You can use the code below: 您可以使用以下代码:

chart.ChartAreas[0].AxisY.Interval = n;  // Set a constant interval if you want
chart.ChartAreas[0].AxisY.Minimum = lower;
chart.ChartAreas[0].AxisY.Maximum = upper;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM