首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >显示值百分比的devexpress饼图

显示值百分比的devexpress饼图
EN

Stack Overflow用户
提问于 2013-08-03 17:21:51
回答 1查看 9.3K关注 0票数 4

我使用的是devexpress饼图。共有2个切片,值为8和12 (总共20个切片)。当我使用下面的代码时,切片上显示的值是0/40/6,而我需要的值是40%60%

代码语言:javascript
复制
((PiePointOptions)series.LegendPointOptions).PointView = PointView.Values;
((PiePointOptions)series.LegendPointOptions).PercentOptions.ValueAsPercent = false;

通过将值更改为01,设置ValueAsPercent = true只会使情况变得更糟!并在切片上显示相同的比例(0/40/6)。

如何显示每个切片的百分比??

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-08-03 17:26:38

下面是一个简单的例子,看看它是否有帮助

代码语言:javascript
复制
// Create an empty chart.
        ChartControl pieChart = new ChartControl();

        // Create a pie series and add it to the chart.
        Series series1 = new Series("Pie Series", ViewType.Pie);
        pieChart.Series.Add(series1);

        // Add points to it.
        series1.Points.Add(new SeriesPoint("A", new double[] { 0.3 }));
        series1.Points.Add(new SeriesPoint("B", new double[] { 5 }));
        series1.Points.Add(new SeriesPoint("C", new double[] { 9 }));
        series1.Points.Add(new SeriesPoint("D", new double[] { 12 }));

        // Make the series point labels display both arguments and values.
        ((PiePointOptions)series1.Label.PointOptions).PointView = PointView.ArgumentAndValues;

        // Make the series points' values to be displayed as percents.
        ((PiePointOptions)series1.Label.PointOptions).PercentOptions.ValueAsPercent = true;
        ((PiePointOptions)series1.Label.PointOptions).ValueNumericOptions.Format = NumericFormat.Percent;
        ((PiePointOptions)series1.Label.PointOptions).ValueNumericOptions.Precision = 0;

        // Add the chart to the form.
        pieChart.Dock = DockStyle.Fill;
        this.Controls.Add(pieChart);
票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18031309

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档