找回密码
 立即注册

QQ登录

只需一步,快速开始

chensheng115

初级会员

9

主题

25

帖子

382

积分

初级会员

积分
382

活字格认证

chensheng115
初级会员   /  发表于:2012-2-17 14:08  /   查看:5296  /  回复:4
我用fpSpread1.Sheets[0].AddChart(cellRange, typeof(FarPoint.Win.Chart.PieSeries), 400, 400, 0, 0);这样不是很方便,我想对fpspread添加chartmodel类,因为chartmodel类比较灵活,但不知道怎么添加到fpspread中去。

4 个回复

倒序浏览
iceman
社区贡献组   /  发表于:2012-2-17 14:56:00
沙发

回复 1# chensheng115 的帖子

chensheng115  你好,请参考一下代码:
  1. FarPoint.Win.Chart.BarSeries series = new FarPoint.Win.Chart.BarSeries();
  2.             series.Values.Add(2.0);
  3.             series.Values.Add(4.0);
  4.             series.Values.Add(3.0);
  5.             series.Values.Add(5.0);
  6.             FarPoint.Win.Chart.YPlotArea plotArea = new FarPoint.Win.Chart.YPlotArea();
  7.             plotArea.Location = new PointF(0.2f, 0.2f);
  8.             plotArea.Size = new SizeF(0.6f, 0.6f);
  9.             plotArea.Series.Add(series);
  10.             FarPoint.Win.Chart.LabelArea label = new FarPoint.Win.Chart.LabelArea();
  11.             label.Text = "条形图";
  12.             label.Location = new PointF(0.5f, 0.02f);
  13.             label.AlignmentX = 0.5f;
  14.             label.AlignmentY = 0.0f;
  15.             FarPoint.Win.Chart.LegendArea legend = new FarPoint.Win.Chart.LegendArea();
  16.             legend.Location = new PointF(0.98f, 0.5f);
  17.             legend.AlignmentX = 1.0f;
  18.             legend.AlignmentY = 0.5f;
  19.             FarPoint.Win.Chart.ChartModel model = new FarPoint.Win.Chart.ChartModel();
  20.             model.LabelAreas.Add(label);
  21.             model.LegendAreas.Add(legend);
  22.             model.PlotAreas.Add(plotArea);
  23.             FarPoint.Win.Spread.Chart.SpreadChart chart = new FarPoint.Win.Spread.Chart.SpreadChart();
  24.             chart.Size = new Size(200, 200);
  25.             chart.Location = new Point(100, 100);
  26.             chart.Model = model;
  27.             fpSpread1.Sheets[0].Charts.Add(chart);
复制代码
回复 使用道具 举报
chensheng115
初级会员   /  发表于:2012-2-17 15:50:00
板凳
谢谢,问题解决了,你们效率非常高!
回复 使用道具 举报
chensheng115
初级会员   /  发表于:2012-2-17 15:50:00
地板

回复 2# iceman 的帖子

谢谢,问题解决了,你们效率非常高!
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2012-2-17 15:51:00
5#

回复 4# chensheng115 的帖子

呵呵 , 客气了。
也感谢你对我们的配合和肯定。:-D
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部