C#: Create a Radar Chart in Excel

Excel radar charts, also known as spider charts or web charts, are used to compare multiple data series in different categories. By plotting data points on a multi-axis chart, radar charts provide a clear and intuitive representation of data balance and skewness. This makes them particularly useful for visualizing performance metrics, market analysis, and other situations where multiple dimensions need to be compared. In this article, you will learn how to create a radar chart in Excel in C# using Spire.XLS for .NET.

Install Spire.XLS for .NET

To begin with, you need to add the DLL files included in the Spire.XLS for .NET package as references in your .NET project. The DLL files can be either downloaded from this link or installed via NuGet.

PM> Install-Package Spire.XLS

Create a Simple Radar Chart in Excel in C#

Spire.XLS for .NET provides the Worksheet.Charts.Add(ExcelChartType.Radar) method to add a standard radar chart to an Excel worksheet. The following are the detailed steps:

  • Create a Workbook instance.
  • Get a specified worksheet using Workbook.Worksheets[sheetIndex] property.
  • Add the chart data to specified cells and set the cell styles.
  • Add a simple radar chart to the worksheet using Worksheet.Charts.Add(ExcelChartType.Radar) method.
  • Set data range for the chart using Chart.DataRange property.
  • Set the position, legend and title of the chart.
  • Save the result file using Workbook.SaveToFile() method.
  • C#
using Spire.Xls;
using System.Drawing;

namespace ExcelRadarChart
{
    class Program
    {
        static void Main(string[] args)
        {
            //Create a Workbook instance
            Workbook workbook = new Workbook();

            //Get the first worksheet
            Worksheet sheet = workbook.Worksheets[0];

            //Add chart data to specified cells
            sheet.Range["A1"].Value = "Rating";
            sheet.Range["A2"].Value = "Communication";
            sheet.Range["A3"].Value = "Experience";
            sheet.Range["A4"].Value = "Work Efficiency";
            sheet.Range["A5"].Value = "Leadership";
            sheet.Range["A6"].Value = "Problem-solving";
            sheet.Range["A7"].Value = "Teamwork";

            sheet.Range["B1"].Value = "Jonathan";
            sheet.Range["B2"].NumberValue = 4;
            sheet.Range["B3"].NumberValue = 3;
            sheet.Range["B4"].NumberValue = 4;
            sheet.Range["B5"].NumberValue = 3;
            sheet.Range["B6"].NumberValue = 5;
            sheet.Range["B7"].NumberValue = 5;

            sheet.Range["C1"].Value = "Ryan";
            sheet.Range["C2"].NumberValue = 2;
            sheet.Range["C3"].NumberValue = 5;
            sheet.Range["C4"].NumberValue = 4;
            sheet.Range["C5"].NumberValue = 4;
            sheet.Range["C6"].NumberValue = 3;
            sheet.Range["C7"].NumberValue = 3;

            //Set font styles
            sheet.Range["A1:C1"].Style.Font.IsBold = true;
            sheet.Range["A1:C1"].Style.Font.Size = 11;
            sheet.Range["A1:C1"].Style.Font.Color = Color.White;

            //Set row height and column width 
            sheet.Rows[0].RowHeight = 20;
            sheet.Range["A1:C7"].Columns[0].ColumnWidth = 15;

            //Set cell styles
            sheet.Range["A1:C1"].Style.Color = Color.DarkBlue;
            sheet.Range["A2:C7"].Borders[BordersLineType.EdgeBottom].LineStyle = LineStyleType.Thin;
            sheet.Range["A2:C7"].Style.Borders[BordersLineType.EdgeBottom].Color = Color.DarkBlue;
            sheet.Range["B1:C7"].HorizontalAlignment = HorizontalAlignType.Center;
            sheet.Range["A1:C7"].VerticalAlignment = VerticalAlignType.Center;

            //Add a radar chart to the worksheet
            Chart chart = sheet.Charts.Add(ExcelChartType.Radar);

            //Set position of chart
            chart.LeftColumn = 4;
            chart.TopRow = 4;
            chart.RightColumn = 14;
            chart.BottomRow = 29;

            //Set data range for the chart
            chart.DataRange = sheet.Range["A1:C7"];
            chart.SeriesDataFromRange = false;

            //Set and format chart title
            chart.ChartTitle = "Employee Performance Appraisal";
            chart.ChartTitleArea.IsBold = true;
            chart.ChartTitleArea.Size = 14;

            //Set position of chart legend
            chart.Legend.Position = LegendPositionType.Corner;

            //Save the result file
            workbook.SaveToFile("ExcelRadarChart.xlsx", ExcelVersion.Version2016);

        }
    }
}

Create a radar chart in Excel to compare the performance of two employees

Create a Filled Radar Chart in Excel in C#

A filled radar chart is a variation of a standard radar chart, with the difference that the area between each data point is filled with color. The following are the steps to create a filled radar chart using C#:

  • Create a Workbook instance.
  • Get a specified worksheet using Workbook.Worksheets[sheetIndex] property.
  • Add the chart data to specified cells and set the cell styles.
  • Add a filled radar chart to the worksheet using Worksheet.Charts.Add(ExcelChartType.RadarFilled) method.
  • Set data range for the chart using Chart.DataRange property.
  • Set the position, legend and title of the chart.
  • Save the result file using Workbook.SaveToFile() method.
  • C#
using Spire.Xls;
using System.Drawing;

namespace ExcelRadarChart
{
    class Program
    {
        static void Main(string[] args)
        {
            //Create a Workbook instance
            Workbook workbook = new Workbook();

            //Get the first worksheet
            Worksheet sheet = workbook.Worksheets[0];

            //Add chart data to specified cells
            sheet.Range["A1"].Value = "Rating";
            sheet.Range["A2"].Value = "Communication";
            sheet.Range["A3"].Value = "Experience";
            sheet.Range["A4"].Value = "Work Efficiency";
            sheet.Range["A5"].Value = "Leadership";
            sheet.Range["A6"].Value = "Problem-solving";
            sheet.Range["A7"].Value = "Teamwork";

            sheet.Range["B1"].Value = "Jonathan";
            sheet.Range["B2"].NumberValue = 4;
            sheet.Range["B3"].NumberValue = 3;
            sheet.Range["B4"].NumberValue = 4;
            sheet.Range["B5"].NumberValue = 3;
            sheet.Range["B6"].NumberValue = 5;
            sheet.Range["B7"].NumberValue = 5;

            sheet.Range["C1"].Value = "Ryan";
            sheet.Range["C2"].NumberValue = 2;
            sheet.Range["C3"].NumberValue = 5;
            sheet.Range["C4"].NumberValue = 4;
            sheet.Range["C5"].NumberValue = 4;
            sheet.Range["C6"].NumberValue = 3;
            sheet.Range["C7"].NumberValue = 3;

            //Set font styles
            sheet.Range["A1:C1"].Style.Font.IsBold = true;
            sheet.Range["A1:C1"].Style.Font.Size = 11;
            sheet.Range["A1:C1"].Style.Font.Color = Color.White;

            //Set row height and column width 
            sheet.Rows[0].RowHeight = 20;
            sheet.Range["A1:C7"].Columns[0].ColumnWidth = 15;

            //Set cell styles
            sheet.Range["A1:C1"].Style.Color = Color.DarkBlue;
            sheet.Range["A2:C7"].Borders[BordersLineType.EdgeBottom].LineStyle = LineStyleType.Thin;
            sheet.Range["A2:C7"].Style.Borders[BordersLineType.EdgeBottom].Color = Color.DarkBlue;
            sheet.Range["B1:C7"].HorizontalAlignment = HorizontalAlignType.Center;
            sheet.Range["A1:C7"].VerticalAlignment = VerticalAlignType.Center;

            //Add a filled radar chart to the worksheet
            Chart chart = sheet.Charts.Add(ExcelChartType.RadarFilled);

            //Set position of chart
            chart.LeftColumn = 4;
            chart.TopRow = 4;
            chart.RightColumn = 14;
            chart.BottomRow = 29;

            //Set data range for the chart
            chart.DataRange = sheet.Range["A1:C7"];
            chart.SeriesDataFromRange = false;

            //Set and format chart title
            chart.ChartTitle = "Employee Performance Appraisal";
            chart.ChartTitleArea.IsBold = true;
            chart.ChartTitleArea.Size = 14;

            //Set position of chart legend
            chart.Legend.Position = LegendPositionType.Corner;

            //Save the result file
            workbook.SaveToFile("FilledRadarChart.xlsx", ExcelVersion.Version2016);

        }
    }
}

Create a filled radar chart in Excel to compare the performance of two employees

Apply for a Temporary License

If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.