关于MSCHART给饼图添加百分比的问题!!!
关于MSCHART给饼图添加百分比的问题离问题结束还有14天13小时提问者:人为什么要睡觉|悬赏分:5|浏览次数:3次我用下面语句给饼图添加了百分比,又用两个comman...
关于MSCHART给饼图添加百分比的问题 离问题结束还有 14 天 13 小时 提问者:人为什么要睡觉 | 悬赏分:5 | 浏览次数:3次
我用下面语句给饼图添加了百分比,又用两个command来切换折线图和柱形图,如果点了折线图或柱形图,再点回饼图,百分比就没了,然后再怎么重新添加也没有,请高手帮我看看是怎么回事,谢谢。
With MSChart1
.ChartType = 14
For i = 1 To .Plot.SeriesCollection.Count
With .Plot.SeriesCollection(i).DataPoints(-1).DataPointLabel
.LocationType = VtChLabelLocationTypeOutside
.Component = VtChLabelComponentPercent
.PercentFormat = "0% "
.VtFont.Size = 10
End With
Next i
End With
Q!! 展开
我用下面语句给饼图添加了百分比,又用两个command来切换折线图和柱形图,如果点了折线图或柱形图,再点回饼图,百分比就没了,然后再怎么重新添加也没有,请高手帮我看看是怎么回事,谢谢。
With MSChart1
.ChartType = 14
For i = 1 To .Plot.SeriesCollection.Count
With .Plot.SeriesCollection(i).DataPoints(-1).DataPointLabel
.LocationType = VtChLabelLocationTypeOutside
.Component = VtChLabelComponentPercent
.PercentFormat = "0% "
.VtFont.Size = 10
End With
Next i
End With
Q!! 展开
2个回答
展开全部
部分代码如下:
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();
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();
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询