C#组件系列 你值得拥有的一款Excel处理神器Spire.XLS

2019-12-30 13:54:39王振洲

得到结果如下:

C#,组件,Excel,Spire.XLS

这里唯一的变化是数据区域,只要指定我们需要生成图表的区域是哪部分,Excel会自动进行计算并生成图表。

2.4、各种类型的图表展示

上文说过,chart.ChartType = chartFormat;这一句可以设置图表的类型,在Spire.XLS里面定义了一系列的图表类型:

amespace Spire.Xls


{
  // 摘要: 
  //   Chart types.
  public enum ExcelChartType
  {
    // 摘要: 
    //   Represents the column clustered chart type.
    ColumnClustered = 0,
    //
    // 摘要: 
    //   Represents the stacked column chart type.
    ColumnStacked = 1,
    //
    // 摘要: 
    //   Represents the 100% stacked column chart type.
    Column100PercentStacked = 2,
    //
    // 摘要: 
    //   Represents the 3D clustered column chart type.
    Column3DClustered = 3,
    //
    // 摘要: 
    //   Represents the 3D stacked column chart type.
    Column3DStacked = 4,
    //
    // 摘要: 
    //   Represents the 3D 100% stacked column chart type.
    Column3D100PercentStacked = 5,
    //
    // 摘要: 
    //   Represents the 3D column chart type.
    Column3D = 6,
    //
    // 摘要: 
    //   Represents the clustered bar chart type.
    BarClustered = 7,
    //
    // 摘要: 
    //   Represents the stacked bar chart type.
    BarStacked = 8,
    //
    // 摘要: 
    //   Represents the 100% stacked bar chart type.
    Bar100PercentStacked = 9,
    //
    // 摘要: 
    //   Represents the 3D clustered bar chart type.
    Bar3DClustered = 10,
    //
    // 摘要: 
    //   Represents the 3D stacked bar chart type.
    Bar3DStacked = 11,
    //
    // 摘要: 
    //   Represents the 100% 3D stacked bar chart type.
    Bar3D100PercentStacked = 12,
    //
    // 摘要: 
    //   Represents the Line chart type.
    Line = 13,
    //
    // 摘要: 
    //   Represents the stacked line chart type.
    LineStacked = 14,
    //
    // 摘要: 
    //   Represents the 100% stacked line chart type.
    Line100PercentStacked = 15,
    //
    // 摘要: 
    //   Represents the markers line chart type.
    LineMarkers = 16,
    //
    // 摘要: 
    //   Represents the stacked markers line chart type.
    LineMarkersStacked = 17,
    //
    // 摘要: 
    //   Represents the 100% stacked markers line chart type.
    LineMarkers100PercentStacked = 18,
    //
    // 摘要: 
    //   Represents the 3D line chart type.
    Line3D = 19,
    //
    // 摘要: 
    //   Represents the pie chart type.
    Pie = 20,
    //
    // 摘要: 
    //   Represents the 3D pie chart type.
    Pie3D = 21,
    //
    // 摘要: 
    //   Represents the pie of pie chart type.
    PieOfPie = 22,
    //
    // 摘要: 
    //   Represents the exploded pie chart type.
    PieExploded = 23,
    //
    // 摘要: 
    //   Represents the 3D exploded pie chart type.
    Pie3DExploded = 24,
    //
    // 摘要: 
    //   Represents the bar pie chart type.
    PieBar = 25,
    //
    // 摘要: 
    //   Represents the markers scatter chart type.
    ScatterMarkers = 26,
    //
    // 摘要: 
    //   Represents the ScatterSmoothedLineMarkers chart type.
    ScatterSmoothedLineMarkers = 27,
    //
    // 摘要: 
    //   Represents the ScatterSmoothedLine chart type.
    ScatterSmoothedLine = 28,
    //
    // 摘要: 
    //   Represents the ScatterLineMarkers chart type.
    ScatterLineMarkers = 29,
    //
    // 摘要: 
    //   Represents the ScatterLine chart type.
    ScatterLine = 30,
    //
    // 摘要: 
    //   Represents the Area chart type.
    Area = 31,
    //
    // 摘要: 
    //   Represents the AreaStacked chart type.
    AreaStacked = 32,
    //
    // 摘要: 
    //   Represents the Area100PercentStacked chart type.
    Area100PercentStacked = 33,
    //
    // 摘要: 
    //   Represents the Area3D chart type.
    Area3D = 34,
    //
    // 摘要: 
    //   Represents the Area3DStacked chart type.
    Area3DStacked = 35,
    //
    // 摘要: 
    //   Represents the Area3D100PercentStacked chart type.
    Area3D100PercentStacked = 36,
    //
    // 摘要: 
    //   Represents the Doughnut chart type.
    Doughnut = 37,
    //
    // 摘要: 
    //   Represents the DoughnutExploded chart type.
    DoughnutExploded = 38,
    //
    // 摘要: 
    //   Represents the Radar chart type.
    Radar = 39,
    //
    // 摘要: 
    //   Represents the RadarMarkers chart type.
    RadarMarkers = 40,
    //
    // 摘要: 
    //   Represents the RadarFilled chart type.
    RadarFilled = 41,
    //
    // 摘要: 
    //   Represents the Surface3D chart type.
    Surface3D = 42,
    //
    // 摘要: 
    //   Represents the Surface3DNoColor chart type.
    Surface3DNoColor = 43,
    //
    // 摘要: 
    //   Represents the SurfaceContour chart type.
    SurfaceContour = 44,
    //
    // 摘要: 
    //   Represents the SurfaceContourNoColor chart type.
    SurfaceContourNoColor = 45,
    //
    // 摘要: 
    //   Represents the Bubble chart type.
    Bubble = 46,
    //
    // 摘要: 
    //   Represents the Bubble3D chart type.
    Bubble3D = 47,
    //
    // 摘要: 
    //   Represents the StockHighLowClose chart type.
    StockHighLowClose = 48,
    //
    // 摘要: 
    //   Represents the StockOpenHighLowClose chart type.
    StockOpenHighLowClose = 49,
    //
    // 摘要: 
    //   Represents the StockVolumeHighLowClose chart type.
    StockVolumeHighLowClose = 50,
    //
    // 摘要: 
    //   Represents the StockVolumeOpenHighLowClose chart type.
    StockVolumeOpenHighLowClose = 51,
    //
    // 摘要: 
    //   Represents the CylinderClustered chart type.
    CylinderClustered = 52,
    //
    // 摘要: 
    //   Represents the CylinderStacked chart type.
    CylinderStacked = 53,
    //
    // 摘要: 
    //   Represents the Cylinder100PercentStacked chart type.
    Cylinder100PercentStacked = 54,
    //
    // 摘要: 
    //   Represents the CylinderBarClustered chart type.
    CylinderBarClustered = 55,
    //
    // 摘要: 
    //   Represents the CylinderBarStacked chart type.
    CylinderBarStacked = 56,
    //
    // 摘要: 
    //   Represents the CylinderBar100PercentStacked chart type.
    CylinderBar100PercentStacked = 57,
    //
    // 摘要: 
    //   Represents the Cylinder3DClustered chart type.
    Cylinder3DClustered = 58,
    //
    // 摘要: 
    //   Represents the ConeClustered chart type.
    ConeClustered = 59,
    //
    // 摘要: 
    //   Represents the ConeStacked chart type.
    ConeStacked = 60,
    //
    // 摘要: 
    //   Represents the Cone100PercentStacked chart type.
    Cone100PercentStacked = 61,
    //
    // 摘要: 
    //   Represents the ConeBarClustered chart type.
    ConeBarClustered = 62,
    //
    // 摘要: 
    //   Represents the ConeBarStacked chart type.
    ConeBarStacked = 63,
    //
    // 摘要: 
    //   Represents the ConeBar100PercentStacked chart type.
    ConeBar100PercentStacked = 64,
    //
    // 摘要: 
    //   Represents the Cone3DClustered chart type.
    Cone3DClustered = 65,
    //
    // 摘要: 
    //   Represents the PyramidClustered chart type.
    PyramidClustered = 66,
    //
    // 摘要: 
    //   Represents the PyramidStacked chart type.
    PyramidStacked = 67,
    //
    // 摘要: 
    //   Represents the Pyramid100PercentStacked chart type.
    Pyramid100PercentStacked = 68,
    //
    // 摘要: 
    //   Represents the PyramidBarClustered chart type.
    PyramidBarClustered = 69,
    //
    // 摘要: 
    //   Represents the PyramidBarStacked chart type.
    PyramidBarStacked = 70,
    //
    // 摘要: 
    //   Represents the PyramidBar100PercentStacked chart type.
    PyramidBar100PercentStacked = 71,
    //
    // 摘要: 
    //   Represents the Pyramid3DClustered chart type.
    Pyramid3DClustered = 72,
    //
    // 摘要: 
    //   Represents the CombinationChart chart types.
    CombinationChart = 73,
  }
}