Super 2d/3d Graph Library

Enhance your .NET application adding nice charts within minutes! Save time and money!


Example 20: Create a PDF Report Sheet

This is a sample of CreatePDF_ReportSheet() method. This method was implemented to get a full page, portrait report of any chart. It calculates appropiates dimensions so legend and datatable fit without any distortion of the chart.

 

CreatePDF_ReportSheet is very useful when there's a lot of data and you want to print both chart and data.

 

Steps:

1. Create a new ASP.NET application project (VB.NET)

2. Add a reference to Super 2d/3d Graph Library and to System.Windows.Forms (this one is necessary for the library to operate on web environments)

3. Replace the code of the default web page (default.aspx) with the following one.

4. Run!


Form Code

Imports Super2d3dGraphLibrary
Imports
System.Drawing

Partial Public Class _Default
 
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

  Dim oChart As New Super2D3dGraph
  Dim sf As New SeriesFactory

  sf.AddTask(#1/1/2007#, #1/15/2007#, 0.1)
  sf.AddTask(#1/16/2007#, #1/31/2007#, 0.1)
  sf.AddTask(#2/1/2007#, #2/25/2007#, 0.85)
  sf.AddTask(#2/8/2007#, #3/29/2007#, 0.75)
  sf.AddTask(#4/8/2007#, #5/29/2007#, 0.6)
  sf.AddTask(#4/9/2007#, #7/22/2007#, 0.3)
  sf.AddTask(#5/8/2007#, #6/29/2007#, 0.3)
  sf.AddTask(#5/8/2007#, #7/29/2007#, 0.2)
  sf.AddTask(#5/16/2007#, #6/18/2007#, 0)
  sf.AddTask(#6/9/2007#, #6/22/2007#, 0)
  sf.AddTask(#6/1/2007#, #7/15/2007#, 0)
  sf.AddTask(#7/16/2007#, #8/31/2007#, 0)
  sf.AddTask(#7/1/2007#, #8/25/2007#, 0)
  sf.AddTask(#8/8/2007#, #8/29/2007#, 0)
  sf.AddTask(#8/8/2007#, #9/29/2007#, 0)
  sf.AddTask(#8/8/2007#, #9/29/2007#, 0)
  sf.AddTask(#9/8/2007#, #9/29/2007#, 0)
  sf.AddTask(#10/16/2007#, #11/18/2007#, 0)

  With oChart
    .LicenseeIdentifier = "PROF"
    .Title = "My test project"
    .Style = STYLE2D3D.STYLE2D_GANTT
    .Series = sf.Series
   
.SeriesColor =
New Color() {Color.LightYellow}

    .LegendText = "Product development cycle"
    .SeriesLegend = New String() {"V1.0"}
    .DataTableText = "Project tasks"
    .DataTableBackColor = Color.LightGray

    .ItemsLegend = New String() {"Brainstorm 1", "Brainstorm 1", "Q&A 1", "Q&A 2", "Planning", "Design 1", "Design 2", "Acquire materials", "Prepare resources", "Final planning", "Build 1", "Test 1", "Build 2", "Test 2", "Verify results", "Report results", "Deliver package", "Feedback"}

    .ShowXAxis = True ' Show date scale on x-axis
    .ShowDividerX = True
    .XAxisLabelsRotated = True
    .XAxisValuesFont = New Font("Arial", 8)

    .ShowSurface = True
    .ShowValues = False ' No values over bars
    .BorderColor = Color.White ' No border
  

    .GanttSetToday = #6/8/2007#
    .Resolution = 100 ' Default is 72. Increase for better printing quality

   End With

   ' Now, let's output the report sheet...
   Response.Clear()
   Response.ContentType = "Application/pdf"

   ' Get a byte array with the PDF report with a margin of 50 units
   Dim pdf As Byte() = oChart.CreatePDF_ReportSheet(50)
   Response.OutputStream.Write(pdf, 0, pdf.Length)

   ' Free memory
   oChart.Dispose()

End Sub

End Class



Result:


 

License & Purchase Info


Current version: 14

Super 2d/3d Graph Library is available as:
-Standard License (99€)
-Premium License (149€)
-Enterprise License (299€)

Click here for more details & purchase

Contact Info


Feel free to contact us
for questions related to any of our products or custom .Net development. We usually respond in the same labor day.

Software Siglo XXI

Main support service: support@softwaresigloxxi.com

Sales and other enquiries: contact@softwaresigloxxi.com