C# chartcontrol的Y轴问题

2025-04-28 00:22:16
推荐回答(1个)
回答1:

将Y轴设置为以2为底的对数轴,代码如下:

using System;
using System.Windows.Forms;
using System.IO;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            // 将Y设置为以2为底的对数
            chart1.ChartAreas[0].AxisY.IsLogarithmic = true;
            chart1.ChartAreas[0].AxisY.LogarithmBase = 2;
        }
    }
}