This C# tutorial demonstrates how to create the Microsoft Radar Chart (both 2D and 3D Radar Chart), and insert the MS Radar Chart as image to PDF Page.
The following C# .NET demo code shows how to create and save Microsoft Radar Chart to PDF document programmatically.
Please note, before developers using the chart making code, the MS Chart Control should be referred to your .NET application:
- System.Windows.Forms.DataVisualization.Charting (for .NET WinForms project)
- System.Web.UI.DataVisualization.Charting (for ASP.NET application)
Generate and save Microsoft 2D Radar Chart to PDF in C# code.
public static void InsertMSChartToPDF() { // Create a new PDF document. PdfDocument document = new PdfDocument(); // Create an empty page in this document. PdfPage page = document.AddPage(); // Obtain an XGraphics object to render to XGraphics g = XGraphics.FromPdfPage(page); // Create radar chart stream object Stream chartStream = CreateMSRadarChart(); // Convert chart stream to XImage object XImage chartImage = XImage.FromStream(chartStream); // Insert the chart image to pdf page in any position g.DrawImage(chartImage, 50, 50); // Save and show the document document.Save("MSRadarChart.pdf"); Process.Start("MSRadarChart.pdf"); } public static Stream CreateMSRadarChart() { // Create ms chart object Chart chart = new Chart(); ChartArea chartArea = new ChartArea(); Series series1 = new Series(); Series series2 = new Series(); // Set series1 with width, maker, color, chart type and name series1.BorderColor = Color.FromArgb(180, 26, 59, 105); series1.ChartType = SeriesChartType.Radar; series1.Color = Color.FromArgb(220, 65, 140, 240); series1.MarkerBorderColor = Color.FromArgb(64, 64, 64); series1.MarkerSize = 9; series1.Name = "Series1"; // Set series2 with width, maker, color, chart type and name series2.BorderColor = Color.FromArgb(180, 26, 59, 105); series2.ChartType = SeriesChartType.Radar; series2.Color = Color.FromArgb(220, 252, 180, 65); series2.MarkerBorderColor = Color.FromArgb(64, 64, 64); series2.MarkerSize = 9; series2.Name = "Series2"; // Bind series to chart chart.Series.Add(series1); chart.Series.Add(series2); // Populate series data double[] yValues = { 65.62, 75.54, 60.45, 34.73, 85.42, 55.9, 63.6, 55.1, 77.2 }; double[] yValues2 = { 76.45, 23.78, 86.45, 30.76, 23.79, 35.67, 89.56, 67.45, 38.98 }; string[] xValues = { "France", "Canada", "Germany", "USA", "Italy", "Spain", "Russia", "Sweden", "Japan" }; chart.Series["Series1"].Points.DataBindXY(xValues, yValues); chart.Series["Series2"].Points.DataBindXY(xValues, yValues2); // Set chart 3D style chartArea.Area3DStyle.Enable3D = false; // Bind chart area to chart object chart.ChartAreas.Add(chartArea); // Modify chart size chart.Size = new Size(400, 300); // Render chart graphics to stream MemoryStream ms = new MemoryStream(); chart.SaveImage(ms, ChartImageFormat.Png); return ms; }
Make and insert MS 3D Radar Chart to PDF in C# code.
All the step and code are the same as above, only need change the chartArea.Area3DStyle.Enable3D = false; in the "CreateMSRadarChart()" to the C# code below.
chartArea.Area3DStyle.Enable3D = true; chartArea.Area3DStyle.Inclination = 15; chartArea.Area3DStyle.IsRightAngleAxes = false; chartArea.Area3DStyle.Perspective = 10; chartArea.Area3DStyle.Rotation = 10; chartArea.BackColor = Color.WhiteSmoke;
More MS Chart to PDF tutorial
- How to use XsPDF Component for .NET to add MS Polar chart to PDF page in C#.NET
- How to convert Microsoft 100% Stacked Column graphing to PDF document in WinForm Application using CSharp .NET
- Make MS Pyramid graphs to PDF in C#.NET
- Creating MS Range Column chart to PDF using Visual C# and XsPDF SDK
- Convert Microsoft Column diagram to PDF in .NET
- How to generate MS Spline Range graphing to PDF document in WPF using .NET C#
- Painting MS Funnel diagram to PDF using .NET C# and XsPDF source code
- How to use XsPDF Control for .NET to draw MS Stacked100 Bar graphing to PDF page in .NET C#
- .NET C# demo for adding Microsoft Stacked Area graphing to PDF file
- Visual Studio .NET framework online demo for drawing MS Pie graphing to PDF file
- Microsoft Point diagram created to PDF document - C#.NET demo
- Painting MS Stacked Bar diagram to PDF using C#.NET and XsPDF source code
- How to paint MS Doughnut graphing to PDF document in ASP.NET web application using .NET Visual C#
- MS Line chart exporting to PDF in C# is quite easy and quick using XsPDF Toolkit for .NET
- MS Range chart inserting to PDF in .NET C# is quite easy and quick using XsPDF DLL for .NET