找回密码
 立即注册

QQ登录

只需一步,快速开始

fitech

初级会员

12

主题

32

帖子

424

积分

初级会员

积分
424

[已处理] FpChart

fitech
初级会员   /  发表于:2017-7-3 10:43  /   查看:3138  /  回复:1
FpChart  怎么设置为显示饼图?

1 个回复

倒序浏览
dexteryao讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2017-7-3 12:14:22
沙发
用设计器可以直接选择饼图,
通过代码的话您可以参考下面代码,具体细节您可以在设计器里找到选项,然后又对应的接口。

  1. FarPoint.Win.Chart.PieSeries series = new FarPoint.Win.Chart.PieSeries();
  2. series.SeriesName = "Series 0";
  3. series.Values.Add(1.0);
  4. series.Values.Add(2.0);
  5. series.Values.Add(4.0);
  6. series.Values.Add(8.0);
  7. series.CategoryNames.Add("alpha");
  8. series.CategoryNames.Add("beta");
  9. series.CategoryNames.Add("gamma");
  10. series.CategoryNames.Add("delta");
  11. series.PieDetachments.Add(0.5f);
  12. FarPoint.Win.Chart.PiePlotArea plotArea = new FarPoint.Win.Chart.PiePlotArea();
  13. plotArea.Location = new PointF(0.2f, 0.2f);
  14. plotArea.Size = new SizeF(0.6f, 0.6f);
  15. plotArea.Series.Add(series);
  16. FarPoint.Win.Chart.LabelArea label = new FarPoint.Win.Chart.LabelArea();
  17. label.Text = "Exploded Pie Chart";
  18. label.Location = new PointF(0.5f, 0.02f);
  19. label.AlignmentX = 0.5f;
  20. label.AlignmentY = 0.0f;
  21. FarPoint.Win.Chart.LegendArea legend = new FarPoint.Win.Chart.LegendArea();
  22. legend.Location = new PointF(0.98f, 0.5f);
  23. legend.AlignmentX = 1.0f;
  24. legend.AlignmentY = 0.5f;
  25. FarPoint.Win.Chart.ChartModel model = new FarPoint.Win.Chart.ChartModel();
  26. model.LabelAreas.Add(label);
  27. model.LegendAreas.Add(legend);
  28. model.PlotAreas.Add(plotArea);
  29. fpChart1.Model = model;
复制代码
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部