Spread for WinForms 中同样提供了组合图表的功能,我们只需在图表区域中添加两种不同的图表系列就可以实现。
实现代码如下: private void Form1_Load(object sender, EventArgs e)
{
StackedBarSeries stack = new StackedBarSeries();
stack.LabelVisible = true;
stack.YAxisId = 1;
BarSeries series0 = new BarSeries();
series0.Values.Add(8.0);
series0.Values.Add(4.0);
series0.Values.Add(2.0);
series0.Values.Add(1.0);
BarSeries series1 = new BarSeries();
series1.Values.Add(2.0);
series1.Values.Add(3.0);
series1.Values.Add(4.0);
series1.Values.Add(6.0);
stack.Series.Add(series0);
stack.Series.Add(series1);
LineSeries series2 = new LineSeries();
series2.PointMarker = new BuiltinMarker(MarkerShape.Circle, 7.0f);
series2.Values.Add(8.0);
series2.Values.Add(12.0);
series2.Values.Add(14.0);
series2.Values.Add(15.0);
series2.YAxisId = 1;
series2.LabelVisible = true;
ValueAxis y2 = new ValueAxis();
y2.AxisId = 1;
y2.AutoMaximum = true;
y2.AutoMinimum = true;
y2.LabelVisible = true;
y2.Location = AxisLocation.Far;
YPlotArea plotArea = new YPlotArea();
plotArea.Location = new PointF(0.2f, 0.2f);
plotArea.Size = new SizeF(0.6f, 0.6f);
plotArea.Series.Add(stack);
plotArea.Series.Add(series2);
plotArea.YAxes.Add(y2);
LabelArea label = new LabelArea();
label.Location = new PointF(0.5f, 0.02f);
label.AlignmentX = 0.5f;
label.AlignmentY = 0.0f;
label.Text = "组合图表";
ChartModel model = new ChartModel();
model.LabelAreas.Add(label);
model.PlotAreas.Add(plotArea);
fpSpread1.ActiveSheet.Charts[0].Model = model;
}
复制代码
运行截图:(11.58 K, 下载次数:5) |
SpreadJS | 下载试用
纯前端表格控件SpreadJS,兼容 450 种以上的 Excel 公式,具备“高性能、跨平台、与 Excel 高度兼容”的产品特性,备受华为、苏宁易购、天弘基金等行业龙头企业的青睐,并被中国软件行业协会认定为“中国优秀软件产品”。SpreadJS 可为用户提供类 Excel 的功能,满足表格文档协同编辑、 数据填报、 类 Excel 报表设计等业务场景需求,极大的降低企业研发成本和项目交付风险。
如下资源列表,可以为您评估产品提供帮助:
葡萄城热门产品
活字格
打通现有软件,快速定制面向未来的个性化应用

SpreadJS
可嵌入您系统的在线Excel的纯前端表格控件

Wyn商业智能
可与企业自有系统深度集成,增强数据分析的 BI 工具
