隐藏饼图中的标签(MS Chart for .Net)
我似乎找不到控制属性饼图中标签的可见性。我需要关闭标签,因为图例中提供了信息。
有人知道我可以在代码后面使用什么属性吗?
我尝试将系列标签设置为空 Chart1.Series[i].Label = string.Empty;
但标签似乎还是显示出来了。
I can't seem to find the property that controls visibility of labels in pie charts. I need to turn the labels off as the information is available in the legend.
Anyone know what property I can use in code behind?
I tried setting the series labels to nothing Chart1.Series[i].Label = string.Empty;
but the labels seem to show up anyway.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
也有效,并且不需要为每个数据点进行设置。
works too, and doesn't need to be set for each datapoint.
这也可以在 UI 中完成,方法是:
CustomProperties
属性Disabled
This can also be done in the UI by
CustomProperties
propertyDisabled
在这里找到答案:http: //social.msdn.microsoft.com/Forums/en-US/MSWinWebChart/thread/32ccd993-5f43-47a3-bcbc-e772a13a87fe
事实证明,有一个不起眼的 DataPointCustomProperty 称为 PieLabelStyle,它控制饼图中的标签可见性。更糟糕的是,必须在每个数据点上设置该属性。
Found the answer here: http://social.msdn.microsoft.com/Forums/en-US/MSWinWebChart/thread/32ccd993-5f43-47a3-bcbc-e772a13a87fe
It turns out there is an obscure DataPointCustomProperty called PieLabelStyle that governs label visibility in pie charts. Worse still, the property must be set on each data point.
更改图表自定义属性也能达到目的,并且无需编码
Changing chart custom properties will do the trick as well and no coding is needed
...以及 Ben 在 VB.NET 格式中的回答:
对于设置整个系列效果很好
...and Ben's answer in VB.NET format:
works fine for setting whole series
可能是这个网站解决您的问题
protected void Page_Load(object sender, EventArgs e)
{
// 插入代码来创建基本饼图
// 请参阅我题为“ASP.NET 中的饼图”的博客文章以获取完整源代码
另请访问此网站 我也从该网站获取此代码 关于 mscharts 的非常好的教程
http://betterdashboards.wordpress.com/2009 /02/04/在饼图上显示百分比
May be this website solve your problem
protected void Page_Load(object sender, EventArgs e)
{
// Insert code to create basic pie chart
// See my blog post entitled "Pie Charts in ASP.NET" for full source code
Also visit this website i also take this code from that website very nice tutorial on mscharts
http://betterdashboards.wordpress.com/2009/02/04/display-percentages-on-a-pie-char
对于 C#,以下代码适用于本系列中的所有点。
For C# the following code works well for all points in the serie.