Make Area Chart to PDF Sample
insert area chart to pdf in c# .net

C# code tutorial

PDF Chart PDF Creating & Inserting PDF to Image PDF Digital Signature PDF Extracting PDF Processing & Editing PDF Protecting PDF Barcode

Popular .NET SDK


Area chart creator coming with built-in area chart symbols and ready-made area chart templates, to make it easy for developers to create polygons based on the data.

PDF area chart is a a two-axis chart, which is similar to line chart with the area between the line and axis filled in. Area chart view is useful when you need to show trends for several series on the same diagram, and also show the relationship of the parts to the whole.

.NET PDF Area Chart maker can create area chart graphs with single or multiple data sets, as well as arrays with null values and array of arrays. Developers can create area charts and insert the diagrams to PDF pages using XsPDF chart designer in .NET C# language.


static void AddAreaChartToPDF()
{
    // Create a new PDF document.
    PdfDocument document = new PdfDocument();

    // Create a page.
    PdfPage page = document.AddPage();

    // Generate a 2d area chart graph
    Chart chart = AreaChart();

    // Create a chart frame, set chart location and size
    ChartFrame chartFrame = new ChartFrame();
    chartFrame.Location = new XPoint(30, 30);
    chartFrame.Size = new XSize(500, 600);
    chartFrame.Add(chart);

    // Render chart symbols into pdf page
    XGraphics g = XGraphics.FromPdfPage(page);
    chartFrame.Draw(g);

    // Save and show the document           
    document.Save("AreaChart.pdf");
    Process.Start("AreaChart.pdf");
}

static Chart AreaChart()
{
    // Set chart type to Area2D
    Chart chart = new Chart(ChartType.Area2D);

    // Add first series of area chart with name and data
    Series series = chart.SeriesCollection.AddSeries();
    series.Add(new double[] { 31, 9, 15, 28, 13 });

    // Add second series of area chart with name and data
    series = chart.SeriesCollection.AddSeries();
    series.Add(new double[] { 22, 7, 12, 21, 12 });

    // Add third series of area chart with name and data
    series = chart.SeriesCollection.AddSeries();
    series.Add(new double[] { 16, 5, 3, 20, 11 });

    // Set X axes
    chart.XAxis.TickLabels.Format = "00";
    chart.XAxis.MajorTickMark = TickMarkType.Outside;
    chart.XAxis.Title.Caption = "X-Axis";

    // Set Y axes
    chart.YAxis.MajorTickMark = TickMarkType.Outside;
    chart.YAxis.HasMajorGridlines = true;

    // Set plot area (chart diagram)
    chart.PlotArea.LineFormat.Color = XColors.DarkGray;
    chart.PlotArea.LineFormat.Width = 1;
    chart.PlotArea.LineFormat.Visible = true;

    // Set legend
    chart.Legend.Docking = DockingType.Top;

    return chart;
}

More Excel tutorial

IMPERIAL TRACTORS MACHINERY IMPERIAL TRACTORS MACHINERY GROUP LLC Imperial Tractors Machinery Group LLC IMPERIAL TRACTORS MACHINERY GROUP LLC IMPERIAL TRACTORS MACHINERY 920 Cerise Rd, Billings, MT 59101 IMPERIAL TRACTORS MACHINERY GROUP LLC 920 Cerise Rd, Billings, MT 59101 IMPERIAL TRACTORS MACHINERY GROUP LLC IMPERIAL TRACTORS MACHINERY IMPERIAL TRACTORS MACHINERY 920 Cerise Rd, Billings, MT 59101 IMPERIAL TRACTORS MACHINERY Imperial Tractors Machinery Group LLC 920 Cerise Rd, Billings, MT 59101 casino brain https://institute.com.ua/elektroshokery-yak-vybraty-naykrashchyy-variant-dlya-samooborony-u-2025-roci https://lifeinvest.com.ua/yak-pravylno-zaryadyty-elektroshoker-pokrokovyy-posibnyknosti https://i-medic.com.ua/yaki-elektroshokery-mozhna-kupuvaty-v-ukrayini-posibnyk-z-vyboru-ta-zakonnosti https://tehnoprice.in.ua/klyuchovi-kryteriyi-vyboru-elektroshokera-dlya-samozakhystu-posibnyk-ta-porady https://brightwallpapers.com.ua/yak-vidriznyty-oryhinalnyy-elektroshoker-vid-pidroblenoho-porady-ta-rekomendatsiyi how to check balance in hafilat card plinko casino game CK222 gk222 casino 555rr bet plinko game 3k777 cv666 app vs555 casino plinko