我正在将数据表绑定到ASP.NET图表,我正在为X-Axis使用自定义标签。标签文本垂直对齐,图表大小减小。
我尝试了以下代码:
Chart2.ChartAreas[0].AxisX.IsLabelAutoFit = false;
Chart2.ChartAreas[0].AxisX.LabelStyle.Enabled = true;
Chart2.ChartAreas[0].AxisX.LabelStyle.Font = new System.Drawing.Font("Comic Sans", 9F);
Chart2.ChartAreas[0].AxisX.LabelAutoFitStyle = LabelAutoFitStyles.WordWrap;
我也通过搜索互联网尝试了以下修复:
Chart2.ChartAreas[0].AxisX.LabelStyle.Angle = 90;
Chart2.ChartAreas[0].AxisX.LabelAutoFitStyle = LabelAutoFitStyles.LabelsAngleStep90;
我尝试更改角度的各种值但仍然会垂直对齐。
对此的任何链接或建议都将非常感激。
答案 0 :(得分:0)
我是Ultra New,但这可能有所帮助:“我一直在寻找最近4小时的解决方案,有人建议使用注释。此代码也在VB中,但如果可以,它可能有助于另一个方向找到答案。
Dim MyTextAnnotation As TextAnnotation
MyTextAnnotation = New TextAnnotation
MyTextAnnotation.Text = "some notation"
MyTextAnnotation.X = 0
MyTextAnnotation.Y = 0
chart1.Annotations.Add(MyTextAnnotation)