We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How to create Excel combination chart in C#, VB.Net?

This article explains how to create combination chart in Excel using XlsIO.

 

What is a combination chart?

 

Combination charts combine two or more chart types to make the data easy to understand. These charts can be used charts when the numbers in your data vary widely from data series to data series, or you have mixed type of data.

 

C:\Users\kondurukeerthi.kondu\AppData\Local\Microsoft\Windows\INetCache\Content.Word\Combination_Chart.png

       Combination chart created using XlsIO

To create a combination chart in Excel using XlsIO, you need to do the following steps.

 

Steps to create combination chart

 

  1. Initialize chart

 

              Create a chart object by calling the worksheet.Charts.Add method.

             

 

  1. Assign data

 

Set a range of data from the worksheet to chart’s DataRange property. To plot the series values in column and categories in row, set chart’s IsSeriesInRows property to false.

 

  1. Select SerieType to create a combination chart

 

Set different SerieType value to the series. By doing this, chart type will be changed to combination chart type.

 

 

Note: For creating a combination chart, the chart must have minimum two series. Setting different SerieType property or UsePrimaryAxis property, the chart will be changed to combination chart type.

 

  1. Apply basic chart elements

 

Add the basic elements like chart title, data labels and legend.

 

  • ChartTitle of chart object.
  • Set DataLabels via DefaultDataPoints.
  • Set TRUE to chart’s HasLegend property, to show the legend.

 

 

Applicable ExcelChartType enum types to create combination chart using XlsIO

 

Below is the list of ExcelChartType enum values can be applied to the series to create a combination chart.

 

1.  Area

  • Area
  • Area_Stacked
  • Area_Stacked_100

2.  Bar

  • Bar_Clustered
  • Bar_Stacked
  • Bar_Stacked_100

3.  Column

  • Column_Clustered
  • Column_Stacked
  • Column_Stacked_100

4.  Line

  • Line
  • Line_Markers
  • Line_Stacked
  • Line_Stacked_100
  • Line_Markers_Stacked
  • Line_Markers_Stacked_100

5.  Pie

  • Pie
  • PieOfPie
  • Pie_Bar
  • Doughnut

6.  Radar

  • Radar
  • Radar_Markers
  • Radar_Filled

7.  Scatter

  • Scatter_Markers
  • Scatter_Line
  • Scatter_Line_Markers
  • Scatter_SmoothedLine
  • Scatter_SmoothedLine_Markers

 

NOTE:

  1. Applying properties apart from the mentioned list might throw exception or the generate incorrect output document.
  2. Combination_Chart type cannot be set to series type.

 

Download Complete Sample

 

Download input file with data

 

To know more about creating charts with various settings using XlsIO, please refer the documentation.

 

The following C#/ VB.NET complete code snippet shows the creation of combination of clustered column and line on secondary axis chart using XlsIO.

 

C#

 

VB

 

 

Article ID: Published Date: Last Revised Date: Platform: Control:
8411 02/14/2018 03/09/2018 Windows Forms XlsIO
Did you find this information helpful?
Add Comment
You must log in to leave a comment

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.