PieLabelOffset 似乎没有任何影响
我正在创建一个包含三个数据点的简单饼图。第一个和第二个数据点各占 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不完全回答你的问题,但我必须处理同样的问题。我也没有设法将标签移离中心更远,最后我将
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
toOutside
, so placing all the labels outside of the chart.