波形图是Spread.NET 6新增功能之一,它是直接画在单元格里的微型图表,用于可视化的呈现数据。Spread 支持列、线和正负类型的波形图,同时可以与Excel 2010文件兼容及转换。下面图形显示了波形图的三种类型:
效果图
效果截图的第一行是要生成波形图的数据,第六行是通过数据生成的相对应的波形图。
参考代码
FarPoint.Win.Spread.SheetView sv = new FarPoint.Win.Spread.SheetView(); FarPoint.Win.Spread.Chart.SheetCellRange data = new FarPoint.Win.Spread.Chart.SheetCellRange(sv, 0, 0, 1, 5); FarPoint.Win.Spread.Chart.SheetCellRange data2 = new FarPoint.Win.Spread.Chart.SheetCellRange(sv, 5, 0, 1, 1); FarPoint.Win.Spread.ExcelSparklineSetting ex = new FarPoint.Win.Spread.ExcelSparklineSetting(); ex.ShowMarkers = true; ex.ShowNegative = true; ex.NegativeColor = Color.Red; ex.SeriesColor = Color.Olive; fpSpread1.Sheets[0] = sv; sv.Cells[0, 0].Value = 2; sv.Cells[0, 1].Value = 5; sv.Cells[0, 2].Value = 4; sv.Cells[0, 3].Value = -1; sv.Cells[0, 4].Value = 3; fpSpread1.Sheets[0].AddSparkline(data, data2, FarPoint.Win.Spread.SparklineType.Column, ex); 复制代码
环境:VS 2010 && Spread for WinForm 6.0