小编cen*_*rix的帖子

删除MS图表中x轴的端点

我有一个图形(请参阅附件图像),我想删除端点“ 2060”和“ 2020”。我希望间距保持不变。但是我想隐藏标签2060和2020。是否可以使用MS Chart以编程方式实现此目的?

去除末端标签

创建轴的代码:

            var area = new ChartArea();

        chart.ChartAreas.Add(area);
        chart.ChartAreas[0].Position.X = 5;
        chart.ChartAreas[0].Position.Y = 10;
        chart.ChartAreas[0].Position.Height = 80;
        chart.ChartAreas[0].Position.Width = 80;
        chart.ChartAreas[0].AxisX.LabelStyle.Font = font10Point;
        chart.ChartAreas[0].AxisY.LabelStyle.Font = font10Point;
        chart.ChartAreas[0].AxisX.Title = "Target Date Fund";
        chart.ChartAreas[0].AxisY.Title = "% Up Capture";

        chart.ChartAreas[0].AxisX.TitleFont = font10Point;
        chart.ChartAreas[0].AxisX.MajorGrid.LineColor = Color.Transparent;
        chart.ChartAreas[0].AxisY.MajorGrid.LineColor = Color.Black;
        chart.ChartAreas[0].BorderColor = Color.Black;
        chart.ChartAreas[0].Position = new ElementPosition(0, 10, 75, 85);

        chart.Series[0].YAxisType = AxisType.Secondary;
        chart.ChartAreas[0].AxisY.LabelStyle.Enabled = false;
        chart.ChartAreas[0].AxisX.Crossing = 2060; 
        chart.ChartAreas[0].AxisX.IsReversed = true;
        area.AxisX.Minimum = 2020; 
        area.AxisX.Maximum = 2060; 
        area.AxisX.Interval = 10;
        area.AxisX.LineWidth …
Run Code Online (Sandbox Code Playgroud)

c# graph mschart

1
推荐指数
1
解决办法
1922
查看次数

标签 统计

c# ×1

graph ×1

mschart ×1