PieLabelOffset 似乎没有任何影响

发布于 2024-09-18 12:53:03 字数 939 浏览 4 评论 0原文

我正在创建一个包含三个数据点的简单饼图。第一个和第二个数据点各占 10% 左右,而最后一个数据点则占图表的剩余 80%。这意味着小段的标签默认放置在图表中心附近彼此非常接近的位置。

我正在尝试将标签进一步移向饼图的外边缘,因为这将使它们更易于阅读。然而,似乎无论我使用什么值或在何处使用它,PieLabelOffset 属性都没有影响。

我尝试像这样设置每个数据点的属性:

DataPoint newDataPoint = new DataPoint();
newDataPoint.SetValueY(dataEntry.RunCount);
newDataPoint.Label = dataEntry.Name
newDataPoint.LegendText = dataEntry.Name + " (" + dataEntry.RunCount + ")";
newDataPoint["PieLabelOffset"] = "30:30";
myDataSeries.Points.Add(newDataPoint);

我还尝试像这样设置整个系列的属性:

Series myDataSeries= new Series("Default");
myDataSeries.ChartType = SeriesChartType.Pie;
myDataSeries.BorderColor = System.Drawing.Color.White;
myDataSeries.LabelForeColor = System.Drawing.Color.White;
myDataSeries["PieStartAngle"] = "270";
myDataSeries["PieLabelOffset"] = "30:30";
myChart.Series.Add(myDataSeries);

有谁知道 PieLabelOffset 是否真的有效?如果是这样,您能举例说明如何使用它吗?

I'm creating a simple pie chart with three data points. The first and second data point are around 10% each while the last data point makes up the remaining 80% of the chart. This means that the labels for the small segments are by default placed quite close to each other near the center of the chart.

I'm trying to move the labels further towards the outside edge of my pie chart as that would make them easier to read. It seems however that no matter what values I use or where I use it, the PieLabelOffset attribute has no affect.

I've tried setting the attribute per data point like this:

DataPoint newDataPoint = new DataPoint();
newDataPoint.SetValueY(dataEntry.RunCount);
newDataPoint.Label = dataEntry.Name
newDataPoint.LegendText = dataEntry.Name + " (" + dataEntry.RunCount + ")";
newDataPoint["PieLabelOffset"] = "30:30";
myDataSeries.Points.Add(newDataPoint);

I've also tried setting the attribute for the entire series like this:

Series myDataSeries= new Series("Default");
myDataSeries.ChartType = SeriesChartType.Pie;
myDataSeries.BorderColor = System.Drawing.Color.White;
myDataSeries.LabelForeColor = System.Drawing.Color.White;
myDataSeries["PieStartAngle"] = "270";
myDataSeries["PieLabelOffset"] = "30:30";
myChart.Series.Add(myDataSeries);

Does anyone know if PieLabelOffset actually works? If so, can you give an example of how you use it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

救赎№ 2024-09-25 12:53:03

不完全回答你的问题,但我必须处理同样的问题。我也没有设法将标签移离中心更远,最后我将 PieLabelStyle 设置为 Outside,因此将所有标签放置在图表之外。

chrtPie.Series["Values"]["PieLabelStyle"] = "Outside";

Not exactly answering your question, but I had to handle the same problem. I also didn't manage to move the labels further from the center, and finally I've set the PieLabelStyle to Outside, so placing all the labels outside of the chart.

chrtPie.Series["Values"]["PieLabelStyle"] = "Outside";
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文