如何更改ms图表中X轴标签的方向 [英] how to change the direction of X-axis label in ms charts

查看:30
本文介绍了如何更改ms图表中X轴标签的方向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 winforms 应用程序中使用 Ms 图表控件根据日期显示值

Hi I am using Ms chart control in winforms application for displaying values according to dates

我需要将 x 轴标签值(日期)方向从水平更改为垂直

I need to change the x-axis label values(Dates) direction horizantal to vertical

我搜索了很多属性,但没有找到任何解决方案.

I have searched so many properties but i did not find any solution for this.

有人帮我解决这个问题

非常感谢....

推荐答案

据我所知,您问的是如何旋转图表标签以垂直显示.

As I understand your question - you are asking how to rotate the chart label to display vertically.

您可以按如下方式旋转 x 轴标签:

You can rotate the x-axis label as follows:

chart1.ChartAreas[0].AxisX.LabelStyle.Angle = -90;

这假设您已将系列与第一个图表区域相关联,这是使用 Winforms 设计器时未经修改的默认设置.

This assumes you have associated your series with the first chart area, which is the default without modification when using the Winforms designer.

下图显示了应用上述代码之前图表的外观,第二张图显示了应用代码后的外观.

The following images shows how the chart would look before the code above is applied, the second image shows how it appears after the code is applied.

如果这不是您想要做的,请告诉我,我会发布更新的答案.

Let me know if this is not what you are trying to do and I will post an updated answer.

旋转前

旋转后

在我最初的帖子提到在某些情况下设置chartArea1.AxisX.IsLabelAutoFit = false之后添加的另一个答案可能很重要;

Another answer added after my initial post mentions in certain situations it may be important to set chartArea1.AxisX.IsLabelAutoFit = false;

这篇关于如何更改ms图表中X轴标签的方向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆