Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
Fedor  
#1 Posted : Tuesday, February 18, 2003 2:59:00 AM(UTC)
Fedor

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 7/28/2003(UTC)
Posts: 1,558

Thanks: 5 times
Was thanked: 62 time(s) in 61 post(s)
Aurigma FlashChart was designed as ASP.NET control and should be used in .NET applications. However when Microsoft developed .NET Framework, they provided easy way to use .NET component in COM environment. It means that you can use .NET components not only in ASP.NET, but in classic ASP too (nevertheless you need have .NET Framework installed). This tutorial demonstrates how to use FlashChart at classic ASP.

Registering Aurigma.Charting.dll as ActiveX Server

If you used COM components, you should know that they should be registered with regsvr32.exe utility before use. To register .NET component as COM, you should use similar utility, called RegAsm.exe. You can find it among files of folder where .NET Framework was installed. Execute the following command in command prompt (from the same folder with Aurigma.Charting.dll):

Code:
regasm Aurigma.Charting.dll

You will get a message:

Code:
Types registered successfully

which indicates that your assembly was successfully registered as COM server. Now you can use it in any environment which supports COM and ActiveX (for example, classic ASP).

Using FlashChart in Classic ASP

We will modify our ASP.NET sample from QuickStart of FlashChart Help:

Code:
[Visual Basic]
<%@ Register tagprefix="FC" Namespace="Aurigma.Charting" Assembly="Aurigma.Charting" %>
<%
' Create an instance of the FlashChart
Dim objFlashChart As New FlashChart()

' Fill it with data
With objFlashChart.Data
	.SetDimension(3,1)
	.DataCategories(0).Caption = "Income"

	.DataSeries(0).Caption = "June"
	.DataSeries(0)(0) = 10

	.DataSeries(1).Caption = "July"
	.DataSeries(1)(0) = 20

	.DataSeries(2).Caption = "August"
	.DataSeries(2)(0) = 40

End With

' Save it to file
objFlashChart.Save(Server.MapPath("MyFirstFlashChart.swf"))

%>

To get this code working in classic ASP, we will modify it in the following way:

Code:
[VB Script]
<%
' Create an instance of the FlashChart
Dim objFlashChart 
Set objFlashChart = Server.CreateObject("Aurigma.Charting.FlashChart")

' Fill it with data
With objFlashChart.Data
	.SetDimension 3, 1
	.DataCategories.Item(0).Caption = "Income"

	.DataSeries.Item(0).Caption = "June"
	.DataSeries.Item(0)(0) = 10

	.DataSeries.Item(1).Caption = "July"
	.DataSeries.Item(1)(0) = 20

	.DataSeries.Item(2).Caption = "August"
	.DataSeries.Item(2)(0) = 40

End With

' Save it to file
objFlashChart.Save_2 Server.MapPath("MyFirstFlashChart.swf")

%>

As you see it is rather easy. Let's comment some places.

1. To create an object instance, you should specify full name of FlashChart component:

Code:
[VB Script]
Set objFlashChart = Server.CreateObject("Aurigma.Charting.FlashChart")

2. We should remember that Microsoft slightly changed a syntax of Visual Basic .NET. In particular when you call methods, you specify parameters in parentheses. In VBScript you should omit it and call methods without parentheses:

Code:
[VB Script]
	.SetDimension 3, 1

3. When COM wrapper is generating for .NET component, some features cannot be supported. For example enumerators are not translated into default properties. That's why you need specify property Item explicity instead of simplified syntax (when Item is omitted):

Code:
[VB Script]
	.DataCategories.Item(0).Caption = "Income"

4. ActiveX components does not support overloaded methods (unlike .NET ones). That's why when wrapper generator meets overloaded method, it adds suffix _N, where N is a number of overloaded method. First method does not have a suffix. This sample contains method Save, which is overloaded (you can pass filename, .NET Stream object or COM IStream interface). That's why when we save to file, we must call Save_2 method:

Code:
[VB Script]
objFlashChart.Save_2 Server.MapPath("MyFirstFlashChart.swf")

To save to stream, use Save method:

Code:
[VB Script]
objFlashChart.Save Response
Best regards,

Fedor Skvortsov

Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.