用设计器可以直接选择饼图,
通过代码的话您可以参考下面代码,具体细节您可以在设计器里找到选项,然后又对应的接口。
- FarPoint.Win.Chart.PieSeries series = new FarPoint.Win.Chart.PieSeries();
- series.SeriesName = "Series 0";
- series.Values.Add(1.0);
- series.Values.Add(2.0);
- series.Values.Add(4.0);
- series.Values.Add(8.0);
- series.CategoryNames.Add("alpha");
- series.CategoryNames.Add("beta");
- series.CategoryNames.Add("gamma");
- series.CategoryNames.Add("delta");
- series.PieDetachments.Add(0.5f);
- FarPoint.Win.Chart.PiePlotArea plotArea = new FarPoint.Win.Chart.PiePlotArea();
- plotArea.Location = new PointF(0.2f, 0.2f);
- plotArea.Size = new SizeF(0.6f, 0.6f);
- plotArea.Series.Add(series);
- FarPoint.Win.Chart.LabelArea label = new FarPoint.Win.Chart.LabelArea();
- label.Text = "Exploded Pie Chart";
- label.Location = new PointF(0.5f, 0.02f);
- label.AlignmentX = 0.5f;
- label.AlignmentY = 0.0f;
- FarPoint.Win.Chart.LegendArea legend = new FarPoint.Win.Chart.LegendArea();
- legend.Location = new PointF(0.98f, 0.5f);
- legend.AlignmentX = 1.0f;
- legend.AlignmentY = 0.5f;
- FarPoint.Win.Chart.ChartModel model = new FarPoint.Win.Chart.ChartModel();
- model.LabelAreas.Add(label);
- model.LegendAreas.Add(legend);
- model.PlotAreas.Add(plotArea);
- fpChart1.Model = model;
复制代码 |