MSCHART 饼状图怎样显示百分比?

t200021 2011-11-08 05:19:58
MSCHART 饼状图怎样显示百分比,我想在饼状图上显示出百分比??大家看我的代码写的对不对,第一次用MSCHART 网上好像也没找到例程..

sql = " select tmm1102,count(tmm1200) as 数量 from tmm12 "
+ " left outer join tmm11 on tmm1100=tmm1201 "
+ " group by tmm1102 ";

DataSet dt = DBOperate.executeQueryDS(sql, "TMM12");
dataGridView1.DataSource = dt.Tables["TMM12"];

chart1.DataSource = dt.Tables["TMM12"];
chart1.Series["Series1"].XValueMember = "TMM1102";
chart1.Series["Series1"].YValueMembers = "数量";


chart1.DataBind();

...全文
838 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
wangjiwei0103 2012-06-14
  • 打赏
  • 举报
回复
使用这个"#PERCENT"就可以了,我最近也在学习。
xx00 2012-03-06
  • 打赏
  • 举报
回复
给你看看效果 我这里显示的只是数值 没计算过
xx00 2012-03-06
  • 打赏
  • 举报
回复
我最近在弄Chart控件 不知道你这个控件里面有木有 series1.IsValueShownAsLabel = true;这个属性 有的话 你算出来 显示就可以了
c210501053 2012-03-06
  • 打赏
  • 举报
回复
chart.DataSource = dt;
Series series = new Series("test");
series.ChartType = SeriesChartType.Pie;
series.IsValueShownAsLabel = true;
series.CustomProperties = "DoughnutRadius=25, PieDrawingStyle=Concave, CollectedLabel=Other, MinimumRelativePieSize=20";
series.Label = "#PERCENT{P1}";
series.BackGradientStyle = GradientStyle.None;
for (int i = 0; i < dt.Rows.Count; i++)
{
series.Points.AddXY(dt.Rows[i][0], dt.Rows[i][1].ToString());
series.Points[i].LegendText = dt.Rows[i][0].ToString();
}
chart.Series.Add(series);
// Set the threshold under which all points will be collected
series["CollectedThreshold"] = "8";

// Set the label of the collected pie slice
series["CollectedLabel"] = "Other";

// Set the legend text of the collected pie slice
series["CollectedLegendText"] = "Other";

// Set the collected pie slice to be exploded
series["CollectedSliceExploded"] = true.ToString();
t200017 2011-11-09
  • 打赏
  • 举报
回复
问题简单没人愿意回答吗..用的是VS2008..
t200021 2011-11-08
  • 打赏
  • 举报
回复
来个人为小弟解答下吧~~
t200021 2011-11-08
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 chenxi0516 的回复:]
没用过帮你顶下,不过你可以自己算出来的,在旁边或者留白的地方,自己算出输出
[/Quote]
不过想在圆饼图上显示,这样更明了一些
忙里偷着乐 2011-11-08
  • 打赏
  • 举报
回复
没用过帮你顶下,不过你可以自己算出来的,在旁边或者留白的地方,自己算出输出

110,561

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

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