Example 4: Spline stacked area chart (ASP.NET web projects)
This example illustrates how to render a chart on a web browser. No temporary files are involved
(all processing is done in memory on the fly).
You need two web forms.
The first form will contain the chart.
Insert the following HTML tag wherever
you
want the chart to be drawn:
<img src="chart1.aspx"/>
The second web form
("chart1.aspx") will render the chart. The
output is "captured" by the HTML tag of the
first web form.
Steps:
1. Create a new ASP.NET
application project (VB.NET)
2. Add a web page (default.aspx)
to the web project and insert the
<img src="chart1.aspx">
between <body> and </body> tags.
3. 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)
4. Add a second web page
(chart1.aspx) to the web project project and
copy&paste the
following code in the
Page_Load event:
Form Code
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim oGraph As New Super2d3dGraphLibrary.Super2D3dGraph
' Get some random values ...
Dim arrSeries(2) As ArrayList
For k As Integer = 0 To UBound(arrSeries)
arrSeries(k) = New ArrayList
For j As Integer = 0 To 5
arrSeries(k).Add(Rnd() * 500)
Next
Next
' Assign properties to Super2d/3dGraphLibrary
control ...
With oGraph
.AutoRefresh = False ' This prevents
unnecessary redraws
.LicenseeIdentifier = "STAND"
.Series = arrSeries ' Assign
previous random values
.Title = "3d Spline Stacked Area" ' Title of the
chart
.Style = _
Super2d3dGraphLibrary.STYLE2D3D.STYLE3D_SPLINE_STACKED_AREA
.Width = 500
' Width of the output bitmap
.Height = 350 ' Height of the
output bitmap
.ShowValues = False ' Don't show
values over chart
.BackColor = Drawing.Color.LightGoldenrodYellow
.BackStyle = _
Super2d3dGraphLibrary.STYLEBACKGROUND.STYLEBACKGROUND_GRADIENT
.WallStyle = Super2d3dGraphLibrary.STYLEWALLS.STYLEWALLS_VISIBLE
.RefreshChart() ' Draw the chart on
internal buffer
End With
' Now, let's output the drawn chart...
' Change the response headers to output a JPEG image.
Response.Clear()
Response.ContentType = "image/jpeg"
' Write the image to the response stream in
JPEG format.
oGraph.Image.Save(Response.OutputStream, _
System.Drawing.Imaging.ImageFormat.Jpeg)
' Free memory
oGraph.Dispose()
End Sub
Result:

|