mschart 问题

anbin0814 2010-12-10 10:05:04
series.ChartType = (SeriesChartType)Enum.Parse(typeof(SeriesChartType), "StackedBar", true);
series.IsValueShownAsLabel = true;

问题是如果我数据是0 他就全部显示在一起,有没有什么办法不数值是0的不显示
...全文
86 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
俗人1979 2012-01-29
  • 打赏
  • 举报
回复
       
searies.IsValueShownAsLabel = true;
IEnumerable<DataPoint> dp = searies.Points.FindAllByValue(0);
foreach (var p in dp)
{
p.IsValueShownAsLabel = false;
}

这样就可以了
anbin0814 2010-12-13
  • 打赏
  • 举报
回复

if (dt.Rows[i][j * 2 + 3].ToString() != "0")
{
Chart1.Series[j].Points.AddY(dt.Rows[i][j * 2 + 3].ToString());
Chart1.Series[j].IsValueShownAsLabel = true;
}
else
{
Chart1.Series[j].Points.AddY(0);
Chart1.Series[j].IsValueShownAsLabel = false;
}

这里判断没有用,这样就全不显示了。
anbin0814 2010-12-13
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 koukoujiayi 的回复:]
看看我这里回答的是不是你需要的!
http://topic.csdn.net/u/20101125/15/cd745ea9-af4a-4a2d-b3f1-b1f18a1a8bd2.html
[/Quote]

为0数据也要添加,不能图表数据乱了,现在就想把为0不显示,显示不好看,
anbin0814 2010-12-13
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 k304475243 的回复:]
Chart1.Series[j].Point[Chart1.Series[j].Point.Count-1].Label = "" ;
[/Quote]

安装你这样的还是不行了,不知道你那可以吗?
夜归人 2010-12-13
  • 打赏
  • 举报
回复
Chart1.Series[j].Point[Chart1.Series[j].Point.Count-1].Label = "" ;
夜归人 2010-12-13
  • 打赏
  • 举报
回复
把每个Series的IsValueShownAsLabel 都设成True
if (dt.Rows[i][j * 2 + 3].ToString() != "0")
{
Chart1.Series[j].Points.AddY(dt.Rows[i][j * 2 + 3].ToString;
}
else
{
Chart1.Series[j].Points.AddY(0);
Chart1.Series[j].Point[Chart1.Series[j].Point.Count-].Label = "" }
anbin0814 2010-12-10
  • 打赏
  • 举报
回复
怎么就没一个人来勒~~~
koukoujiayi 2010-12-10
  • 打赏
  • 举报
回复

4,816

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 图表区
社区管理员
  • 图表区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧