回复 12楼ttjie的帖子
这里有类似代码,您可以参考参考:
- BarSeries series = new BarSeries();
- BarSeries series1 = new BarSeries();
- series.Values.DataSource = new FarPoint.Win.Spread.Chart.SeriesDataField(fpSpread1, "Values", "Sheet1!$C$1:$C$4″);
- series1.Values.DataSource = new FarPoint.Win.Spread.Chart.SeriesDataField(fpSpread1, "Values1″, "Sheet1!$D$1:$D$4″);
- series.SeriesName = "Series 0″;
- series1.SeriesName = "Series 1″;
- YPlotArea plotArea = new YPlotArea();
- plotArea.Location = new PointF(0.2f, 0.2f);
- plotArea.Size = new SizeF(0.6f, 0.6f);
- plotArea.Series.Add(series);
- plotArea.Series.Add(series1);
- LabelArea label = new LabelArea();
- label.Text = "Bar Chart";
- label.Location = new PointF(0.5f, 0.02f);
- label.AlignmentX = 0.5f;
- label.AlignmentY = 0.0f;
- LegendArea legend = new LegendArea();
- legend.Location = new PointF(0.98f, 0.5f);
- legend.AlignmentX = 1.0f;
- legend.AlignmentY = 0.5f;
- ChartModel model = new ChartModel();
- model.LabelAreas.Add(label);
- model.LegendAreas.Add(legend);
- model.PlotAreas.Add(plotArea);
- FarPoint.Win.Spread.Chart.SpreadChart chart = new FarPoint.Win.Spread.Chart.SpreadChart();
- chart.Size = new Size(300, 300);
- chart.Location = new Point(400, 100);
- chart.Model = model;
- fpSpread1.Sheets[0].Charts.Add(chart);
复制代码 |