円グラフのラベルの表示を制御するプロパティが見つからないようです。情報は凡例で利用できるため、ラベルをオフにする必要があります。
コードビハインドで使用できるプロパティを知っている人はいますか?
シリーズのラベルを何も設定しようとしましChart1.Series[i].Label = string.Empty;
たが、とにかくラベルが表示されるようです。
円グラフのラベルの表示を制御するプロパティが見つからないようです。情報は凡例で利用できるため、ラベルをオフにする必要があります。
コードビハインドで使用できるプロパティを知っている人はいますか?
シリーズのラベルを何も設定しようとしましChart1.Series[i].Label = string.Empty;
たが、とにかくラベルが表示されるようです。
Chart1.Series[i]["PieLabelStyle"] = "Disabled";
も機能し、データポイントごとに設定する必要はありません。
チャートのカスタムプロパティを変更すると、同様にうまくいき、コーディングは必要ありません
<asp:Series Name="Series1" ChartType="Pie" CustomProperties="PieLabelStyle=Disabled">
ここで答えを見つけました: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";
...そしてVB.NET形式でのベンの答え:
Chart1.Series(0)("PieLabelStyle") = "Disabled"
シリーズ全体を設定するのに問題なく動作します
このウェブサイトがあなたの問題を解決するかもしれません
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サイトからこのコードを取得します 。
objChart.ChartAreas[0].AxisY.LabelStyle.Enabled = false;
C# の場合、次のコードはシリーズ内のすべてのポイントでうまく機能します。
chart1.Series[seriesname]["PieLabelStyle"] = "Disabled";