gpt4 book ai didi

c# - 如何设置刻度线的间隔?

转载 作者:行者123 更新时间:2023-11-30 12:41:29 28 4
gpt4 key购买 nike

我试图以 50 的间隔设置刻度线。MajorGrid 工作正常,但我找不到任何方法让 yAxis 的刻度线与 majorgrid 的网格线对齐。目前我正在使用这个:

chart.ChartAreas.Add(new ChartArea("statistic")
{
AxisX = ...
AxisY = new Axis
{
MajorGrid =
new Grid
{
Enabled = true,
LineColor = Color.Black,
LineDashStyle = ChartDashStyle.Solid,
Interval = 50,
IntervalOffset = 0
},
Title = yAxisDesc,
Minimum = yAxisRange.Item1,
Maximum = yAxisRange.Item2
}
}

得到这个:

Current result lacking alignment of ticks to grid.

我尝试修改 MajorTickMark 无济于事。

我需要更改什么?

最佳答案

试试这个:

 private void Form1_Load(object sender, EventArgs e)
{
int xmax = 100;

chart1.ChartAreas[0].AxisX.IsLogarithmic = true;
chart1.ChartAreas[0].AxisX.MinorGrid.Enabled = true;
chart1.ChartAreas[0].AxisX.MinorGrid.Interval = 1;

chart1.ChartAreas[0].AxisY.MajorGrid.Interval = 50;
chart1.ChartAreas[0].AxisY.MajorTickMark.Interval = 50;
chart1.ChartAreas[0].AxisY.LabelStyle.Interval = 50;

for (int x = 1; x < xmax; x++)
chart1.Series[0].Points.AddXY(x, 5 * x);
}

enter image description here

关于c# - 如何设置刻度线的间隔?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37275655/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com