This C# tutorial demonstrates how to generate the Microsoft Funnel Chart (both 2D and 3D Funnel Chart), and insert the MS Funnel Chart as image to PDF Page.
Funnel chart take a opposite view of Pyramid diagram, the bigger shape is on the top of chart graphics. The following C# .NET demo code shows how to create and save Microsoft Funnel 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 draw Microsoft 2D Funnel 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 funnel chart stream object Stream chartStream = CreateMSFunnelChart(); // 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("MSFunnelChart.pdf"); Process.Start("MSFunnelChart.pdf"); } public static Stream CreateMSFunnelChart() { // Create ms chart object Chart chart = new Chart(); ChartArea chartArea = new ChartArea(); Series series1 = new Series(); // Input Data Point DataPoint dataPoint1 = new DataPoint(0, 39); DataPoint dataPoint2 = new DataPoint(0, 18); DataPoint dataPoint3 = new DataPoint(0, 15); DataPoint dataPoint4 = new DataPoint(0, 12); DataPoint dataPoint5 = new DataPoint(0, 5); // Set series1 with data, color, chart type and name series1.BorderColor = Color.FromArgb(64, 64, 64, 64); series1.ChartType = SeriesChartType.Funnel; series1.BorderWidth = 3; series1.Color = Color.FromArgb(180, 65, 140, 240); series1.Name = "Series1"; series1.Points.Add(dataPoint1); series1.Points.Add(dataPoint2); series1.Points.Add(dataPoint3); series1.Points.Add(dataPoint4); series1.Points.Add(dataPoint5); // Bind series to chart chart.Series.Add(series1); // 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 paint MS 3D Funnel Chart to PDF in C# code.
All the steps are the same as above, only need change one line code chartArea.Area3DStyle.Enable3D = false; in the "CreateMSFunnelChart()" 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
- C#.NET tutorial for creation Microsoft Point graphs to PDF file
- Microsoft Area graphs painted to PDF document - C#.NET tutorial
- .NET Visual C# guide for making Microsoft Stacked Area graphs to PDF file
- How to use XsPDF DLL for .NET to convert Microsoft Polar graphs to PDF page in CSharp .NET
- MS Range graphs generation to PDF in .NET is quite easy and quick using XsPDF Component for .NET
- Generate Microsoft Doughnut chart to PDF in Visual Studio .NET framework
- How to add Microsoft Bubble graphs to PDF document in Azure cloud service using Visual C#
- MS Pie graphs creating to PDF in .NET is quite easy and quick using XsPDF SDK for .NET
- CSharp .NET online guide for drawing MS Spline Range graphs to PDF file
- Visual Studio .NET framework online sample for saving MS 100% Stacked Bar graphs to PDF file
- Creating Microsoft Bar diagram to PDF using C#.NET and XsPDF Library
- Visual C# demo for drawing Microsoft Range Bar diagram to PDF file
- How to create MS Radar graphing to PDF document in Azure cloud service using Visual C#
- Making Microsoft Line diagram to PDF using .NET C# and XsPDF Library
- Microsoft Pyramid chart converted to PDF document - .NET C# demo