This C# tutorial demonstrates how to make the Microsoft Range Column Chart (both 2D and 3D style Range Column Chart), and insert the MS Range Column Chart as image to PDF Page.

Range Column chart usually works with time period, it shows one process's start/stop time. The following C# .NET demo code shows how to create and save Microsoft Range Column 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 Range Column 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 range-column chart stream object
    Stream chartStream = CreateMSRangeColumnChart();

    // 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

public static Stream CreateMSRangeColumnChart()
    // Create ms chart object
    Chart chart = new Chart();

    ChartArea chartArea = new ChartArea();
    Series series1 = new Series();
    // Bind series data to chart
    // If use range chart type, need bind the series to chart first

    DateTime currentData = DateTime.Now.Date;
    // Set series1 with data, color, chart type and name
    series1.BorderColor = Color.FromArgb(180, 26, 59, 105);
    series1.ChartType = SeriesChartType.RangeColumn;
    series1.Color = Color.FromArgb(180, 65, 140, 240);
    series1.Name = "Series1";
    series1.Points.AddXY(2, currentData, currentData.AddDays(4));
    series1.Points.AddXY(4, currentData.AddDays(5), currentData.AddDays(7));
    series1.Points.AddXY(3, currentData.AddDays(8), currentData.AddDays(10));
    series1.Points.AddXY(1, currentData.AddDays(12), currentData.AddDays(15));
    series1.Points.AddXY(4, currentData.AddDays(17), currentData.AddDays(22));
    // Set series2 with data, color, chart type and name
    series2.BorderColor = Color.FromArgb(180, 26, 59, 105);
    series2.ChartType = SeriesChartType.RangeColumn;
    series2.Color = Color.FromArgb(220, 252, 180, 65);
    series2.Name = "Series2";
    series2.Points.AddXY(1, currentData, currentData.AddDays(4));
    series2.Points.AddXY(2, currentData.AddDays(5), currentData.AddDays(7));
    series2.Points.AddXY(3, currentData.AddDays(8), currentData.AddDays(10));
    series2.Points.AddXY(5, currentData.AddDays(12), currentData.AddDays(13));
    series2.Points.AddXY(2, currentData.AddDays(12), currentData.AddDays(16));

    // Set chart 3D style
    chartArea.Area3DStyle.Enable3D = false;

    // Bind chart area to chart object

    // 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 Range Column 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 "CreateMSRangeColumnChart()" 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