19

醜い円グラフ

円グラフのラベルの表示を制御するプロパティが見つからないようです。情報は凡例で利用できるため、ラベルをオフにする必要があります。

コードビハインドで使用できるプロパティを知っている人はいますか?

シリーズのラベルを何も設定しようとしましChart1.Series[i].Label = string.Empty;たが、とにかくラベルが表示されるようです。

4

8 に答える 8

44
Chart1.Series[i]["PieLabelStyle"] = "Disabled";

も機能し、データポイントごとに設定する必要はありません。

于 2011-02-21T21:10:57.797 に答える
7

チャートのカスタムプロパティを変更すると、同様にうまくいき、コーディングは必要ありません

<asp:Series Name="Series1" ChartType="Pie" CustomProperties="PieLabelStyle=Disabled">
于 2011-02-24T16:25:37.050 に答える
7

ここで答えを見つけました:http://social.msdn.microsoft.com/Forums/en-US/MSWinWebChart/thread/32ccd993-5f43-47a3-bcbc-e772a13a87fe

円グラフのラベルの可視性を管理する PieLabelStyle と呼ばれる不明瞭な DataPointCustomProperty があることがわかりました。さらに悪いことに、各データ ポイントでプロパティを設定する必要があります。

for (var i = 0; i < chart.Series.Count; i++) 
    for (var j = 0; j < chart.Series[i].Points.Count; j++)
        chart.Series[i].Points[j]["PieLabelStyle"] = "Disabled";
于 2010-01-27T17:01:16.253 に答える
2

...そしてVB.NET形式でのベンの答え:

Chart1.Series(0)("PieLabelStyle") = "Disabled"

シリーズ全体を設定するのに問題なく動作します

于 2014-07-16T11:09:56.933 に答える
1

このウェブサイトがあなたの問題を解決するかもしれません

protected void Page_Load(object sender, EventArgs e) {
// コードを挿入して基本的な円グラフを作成します // 完全なソース コードについては、「ASP.NET の円グラフ」というタイトルのブログ投稿を参照してください

     // Set pie labels to be outside the pie chart
     this.Chart2.Series[0]["PieLabelStyle"] = "Outside";

     // Set border width so that labels are shown on the outside
     this.Chart2.Series[0].BorderWidth = 1;
     this.Chart2.Series[0].BorderColor = System.Drawing.Color.FromArgb(26, 59, 105);

     // Add a legend to the chart and dock it to the bottom-center
     this.Chart2.Legends.Add("Legend1");
     this.Chart2.Legends[0].Enabled = true;
     this.Chart2.Legends[0].Docking = Docking.Bottom;
     this.Chart2.Legends[0].Alignment = System.Drawing.StringAlignment.Center;

     // Set the legend to display pie chart values as percentages
     // Again, the P2 indicates a precision of 2 decimals
     this.Chart2.Series[0].LegendText = "#PERCENT{P2}";

     // By sorting the data points, they show up in proper ascending order in the legend
     this.Chart2.DataManipulator.Sort(PointSortOrder.Descending, Chart2.Series[0]);
 }

また、このWebサイトにアクセスして、そのWebサイトからこのコードを取得します

于 2013-11-05T06:00:21.653 に答える
0
objChart.ChartAreas[0].AxisY.LabelStyle.Enabled = false;
于 2010-06-02T10:28:26.267 に答える
0

C# の場合、次のコードはシリーズ内のすべてのポイントでうまく機能します。

chart1.Series[seriesname]["PieLabelStyle"] = "Disabled";
于 2022-03-02T22:49:58.343 に答える