スライスから作成する円グラフ
円グラフは、スライスのコレクションから作成できます。
ScottPlot.Plot myPlot = new();
List<PieSlice> slices =
[
new PieSlice() { Value = 5, FillColor = Colors.Red, Label = "赤", LegendText = "R" },
new PieSlice() { Value = 2, FillColor = Colors.Orange, Label = "オレンジ" },
new PieSlice() { Value = 8, FillColor = Colors.Gold, Label = "黄" },
new PieSlice() { Value = 4, FillColor = Colors.Green, Label = "緑", LegendText = "G" },
new PieSlice() { Value = 8, FillColor = Colors.Blue, Label = "青", LegendText = "B" },
];
var pie = myPlot.Add.Pie(slices);
pie.ExplodeFraction = .1;
pie.SliceLabelDistance = 1.4;
myPlot.ShowLegend();
// 不要なプロットコンポーネントを非表示にする
myPlot.Axes.Frameless();
myPlot.HideGrid();
myPlot.SavePng("demo.png", 400, 300);
このレシピは、円グラフカテゴリにある多数のレシピのうちの 1 つです
