问题描述
我的条形图上的标签有问题。有时最长条的标签显示在条形图上 - 不应该在它旁边,因为它会查找其他条形图:
此图表的最大值保留为"auto"。我通过设置最大值(高于自动值)将相同问题排序到另一个图表。我不能在这里做,因为series2的值是从数据库读取的
,并且会有所不同,具体取决于用户。
如何解决这个问题,任何想法?
我会插入图片以更好地展示什么我的意思是,但是我收到一个错误:
I would insert the picture to show better what I mean, but I get an error:
在我们验证您的帐户之前,正文文本不能包含图片或链接。
推荐答案
您可以尝试在绑定数据之后调用ChartArea.RecalculateAxisScale,然后将最大轴值设置为大于默认值的值。
What you could try is to call ChartArea.RecalculateAxisScale after binding the data and then setting the maximum axis value to something bigger than the default.
Chart1.ChartAreas(0).RecalculateAxisScale()
Chart1.ChartAreas(0).AxisY.Maximum += 5 'Added value depends on the scale of the data.
或者,使用注释代替标签。它们不会在条形图上移动,但如果图表太窄,文本可能会被截断。
Or, instead of labels, use annotations. They won't move on top of the bars, but the text may get truncated if the chart is too narrow.
For Each dp As DataPoint In Chart1.Series(0).Points
Dim a As New TextAnnotation()
a.AnchorDataPoint = dp
a.Text = dp.YValues(0).ToString()
a.AnchorAlignment = ContentAlignment.MiddleLeft
Chart1.Annotations.Add(a)
Next
线程中讨论了这个问题
here 和
这里例如.. 它应该减少垃圾邮件。基本上你必须"赚钱"发布图片和链接的权利。
This issue is discussed in threads here and here for example.. It's supposed to reduce spam. Basically you have to "earn" the right to post images and links.
这篇关于条形图标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!