|
|
ProEssentials
Web Graph WebForm is used to serve up dynamically
generated images and ActiveX binary states. The dynamic
images have the option of supporting image maps. Because
content is streamed directly to the browser, ProEssentials
can be used within scalable WebFarm environments.
Prerequisites:
ASP.NET
development is very similar to standard ASP development.
Generally, you will implement server side behavior in
pairs of files. One file, either .HTM, .ASP or .ASPX
will contain an image tag or ActiveX object tag with
source attributes pointing to a secondary .ASPX page
which will dynamically generate the respective binary
content.
We often get asked why two webform pages are needed.
The answer is that the first web form renders as viewable
ascii html and the second web form renders as non-viewable
binary data streamed directly to the browser. This architecture
allows for scalability and efficient processing without
the need for passing large amounts of viewstate information
back and forth between the client and server. The first
form usually contains a ProEssentials object with the
RenderingType set to ImageMap or ActiveX. The second
form then respectively has a ProEssentials object with
the RenderingType set to BinaryImageStream or BinaryActiveXStream.
The two forms work in unison to provide the complete
ProEssentials implementation. Note the first form can
include a ProEssentials object, or if a simple image
is needed, can optionally contain an IMG tag pointing
to the second form with the ProEssentials object's RenderingType
set to BinaryImageStream. Similarly, the first form
can optionally contain the simple Class ID to our ActiveX
and the second form would then contain a ProEssentials
object with its RenderingType set to BinaryActiveXStream. So technically, two aspx pages are not required, only the one that serves the binary content is mandatory. However, this example uses two aspx pages for simplicity.
The ProEssentials
WebForm interfaces have a few key properties and one
event which will control server-side specific functionality.
These are as follows:
|
RenderingType
|
This property controls how this
instance of the control is rendered into HTML.
Possible settings are:
- ImageMap, the control is rendered as
an image tag followed by an ImageMap tag.
- ActiveX, the control is rendered as an
ActiveX object tag.
- BinaryImageStream, render as binary data
representing image data.
- BinaryActiveXStream, render as binary
data representing an initial ActiveX binary state
upon the page loading.
- BinaryDataStream, render as ActiveX binary
state for use with the LoadFromUrl ActiveX method
via client-side script. This allows updating the
ActiveX without refreshing the page.
|
|
RenderedImageType
|
When RenderingType is set to BinaryImageStream,
this property controls the format of the binary
image data. Possible settings are PNG, and JPEG.
|
|
ImageUrl
|
When RenderingType is set to ImageMap,
this property must point to a URL identifying
an .ASPX page containing a ProEssentials control
with its RenderingType property set to BinaryImageStream.
When RenderingType is set to ActiveX, this property
must point to a URL identifying an .ASPX page
containing a ProEssentials control with its RenderingType
property set to BinaryActiveXStream.
|
|
CodebaseUrl
|
When RenderingType is set to ActiveX, this property may optionally
be used to point to a CAB file containing the
ActiveXs and DLL to support automatic installation
onto the client system.
|
Also,
there is one Event and one EventArgs which is used to
implement image map support.
|
PeImageMap
|
This event is only used when the RenderingType property is
set to ImageMap.
This event will be triggered (generally multiple
occurrences) during the image generation process
when hot spots have been enabled via properties
found within the PeUserInterface.HotSpot
namespace.
|
|
ImageMapEventArgs
|
This object is passed to the PeImageMap event to communicate
parameters with the developer.
Members include these properties:
- HotSpotType, defined as Gigasoft.ProEssentials.Enums.HotSpotType.
- Data1, its meaning is dependent upon
HotSpotType.
- Data2, its meaning is dependent upon
HotSpotType.
Members also include these write only properties:
- ToolTip, optionally set to assign tool
tip text to image map area.
- Href, optionally set to assign a URL
to image map area.
- Attributes, optionally set to assign
attributes to map area such as VBScript.
|
It is recommended that the namespace:
Gigasoft.ProEssentials.Enums be included at the
top of your source code files utilizing ProEssentials.
In C#.NET, use the usings keyword. For example:
using Gigasoft.ProEssentials.Enums;
Walk-Through:
Our .NET interfaces currently have limited design time
functionality. You will have to write a little code (simple, see below)
to develop your graphing solutions. In the end, you'll
prefer our .NET (property, method, event) interface. 99% of your code will set simple properties.
The
following information demonstrates how to create your
first ASP.NET / ProEssentials implementation using the
C Sharp language. It discusses using ASP.NET graphing interfaces to serve
up a dynamically generated PNG image. Other examples
are provided within the
product/evaluation.
Also refer to the "ReadMe.htm", "AspReadMe.htm",
and "AspNetReadMe.htm" files installed onto
your system with the eval/product (accessible via Start
menu).
1) Start Visual Studio.NET and create a new project
targeting an ASP.NET Web Application using C# as our
language. Accept the default name of [WebApplication1].
2) When the new project opens, you will be presented
the design view of "Webform1.aspx". Right
click anywhere inside the form, select [Properties], change the [Page
Layout]
setting to FlowLayout.
This is generally recommended as only advanced browsers
support GridLayout. select [Ok]
button to close property page.
|
3) Installing WinForm interfaces into Visual Studio.NET
VS2005 Instructions
- Under the Tools menu, select [Choose Toolbox Items...],
- If not selected, left click the [.NET Framework Components] tab,
- Left click the [Browse...] button and find the file "Gigasoft.ProEssentials.dll" found in the DotNet20 subdirectory where you installed ProEssentials. By default, this should be located at "C:\ProEssentials6\DotNet20\",
- Select the file "Gigasoft.ProEssentials.dll" and close the [Open File] dialog,
- The [Choose Toolbox Items] dialog should now show 5 highlighted controls: Pe3do, Pego, Pepco, Pepso, and Pesgo.
- Close the dialog and the 5 new ProEssentials components will be at the bottom of the toolbox.
VS2003 and Earlier Instructions
- Double check that the [Windows Forms] tab on the tool box is active (Pointer, Label, should be visible)
- Right click anywhere in the toolbox and select [Add/Remove Items... or Customize Toolbox...],
- Left click the [.NET Framework Components] tab,
- Left click the [Browse...] button and find the file "Gigasoft.ProEssentials.dll" found in the DotNet subdirectory where you installed ProEssentials. By default, this should be located at "C:\ProEssentials6\DotNet\",
- Select the file "Gigasoft.ProEssentials.dll" and close the [Open File] dialog,
- The [Customize Toolbox] dialog should now show 5 highlighted controls: Pe3do, Pego, Pepco, Pepso, and Pesgo.
- Close the [Customize Toolbox] dialog and the 5 new ProEssentials components will be at the bottom of the toolbox.
|
|
4) Double click the [PegoWeb]
tool within the toolbox. This places an instance
of the PegoWeb component within "Webform1.aspx".
The adjacent image shows what you see.
This
represents the default state of a ProEssentials
Graph. The default state has one subset with four
data points. In the course of constructing your
own graphs, you'll set the properties PeData.Subsets
and PeData.Points which define the quantity of data your graph will
hold. You'll then pass data via the PeData.Y(subset,
point)
two dimensional property array. The following
section shows example code of passing data.
ProEssentials uses the terms Subsets and Points
but you can think of these as Rows and Columns.
Passing data is as simple as filling each Subset
with Points worth of data.
|
|
|
|
5) Double check that the RenderingType property within the Properties window shows the
default state of ImageMap.
6) Within the Properties window, change the ImageUrl
property to "Webform2.aspx"
7) Within Visual Studio's main menu, select [Project]
and then [Add
Webform...] Accept the default name of "Webform2.aspx"
and left click the [Open] button.
8) Repeat the steps to change the page layout: right
click anywhere inside the form, select [Properties], change the [Page
Layout]
setting to FlowLayout. This is generally recommended
as only advanced browsers support GridLayout.
Select [OK]
button to close property page.
|
|
|
9) Again, double click the PegoWeb tool within the toolbox and this places an instance
of the PegoWeb component within "Webform2.aspx".
10) Within the Properties window, change the RenderingType
property to BinaryImageStream.
11) Within Visual Studio's main menu, select [View]
and then [HTML
Source]
12)
Remove
all HTML content from this page. The resulting content
for this file should be...
13) Within Visual Studio's main menu, select [View]
and then [Code].
14)
Add the following code to the Page_Load
event handler. Type it in manually to see examples of
embedded XML help and other Intellisense features.
|
PegoWeb1.PeString.MainTitle
= "Hello ASP.NET";
PegoWeb1.PeString.SubTitle
= "";
PegoWeb1.PeData.Subsets
= 1;
PegoWeb1.PeData.Points
= 6;
PegoWeb1.PeData.Y[0,
0] = 10;
PegoWeb1.PeData.Y[0,
1] = 30;
PegoWeb1.PeData.Y[0,
2] = 20;
PegoWeb1.PeData.Y[0,
3] = 40;
PegoWeb1.PeData.Y[0,
4] = 30;
PegoWeb1.PeData.Y[0,
5] = 50;
PegoWeb1.PePlot.Method
= Gigasoft.ProEssentials.Enums.GraphPlottingMethod.Bar;
PegoWeb1.PePlot.Option.GradientBars
= 8;
PegoWeb1.PeFont.FontSize
= Gigasoft.ProEssentials.Enums.FontSize.Large
|
Once
entered, select this code and copy it to clipboard.
15) Within Visual Studio's main menu, select [Window]
and then "Webform1.aspx"
16) Within Visual Studio's main menu, select [View]
and then [Code]
17) Paste the above code into the Page_Load
event handler for "WebForm1.aspx".
18) Add one additional line of code to the "Webform1.aspx.cs"
|
PegoWeb1.PeUserInterface.HotSpot.Data
= True;
|
So,
the Page_Load
handler within "Webform1.aspx.cs" should now
contain...
19) Within Visual
Studio's main menu, select [Window]
and then [Webform1.aspx]. Left click the PegoWeb control
within the form to give it the focus. Then left click
the [Event] icon within the [Properties]
window. Double click the PeImageMap
event which opens the file "Webform1.aspx.cs"
located at the PegoWeb1_PeImageMap event handler.
20) Add
the following code to the _PeImageMap handler...
|
if (e.HotSpotType
== Gigasoft.ProEssentials.Enums.HotSpotType.DataPoint)
{
e.ToolTip = "Point " + e.Data2.ToString()
+ " with a value of " + PegoWeb1.PeData.Y[0,
e.Data2].ToString();
}
|
21) Save
and run the project. Your browser will show an image
as follows. Move the mouse over bars to see the image
map content.
|
|
|
You'll
notice that nearly identical code was required for "Webform1.aspx.
cs" and "Webform2.aspx.cs" except for
the hot spot code which triggers the PeImageMap
event. Anytime you develop with image maps, you will
need to have similar initialization code for both forms.
Also, the control size on both forms must be set to
the same size.
This
completes this walkthrough. If you do not wish to support
image maps, ignore the PeUserInterface.HotSpot and the PeImageMap event handler code. If not using image maps, you
will only need code within "WebForm2.aspx.cs"
and could actually replace WebForm1's instance of a
ProEssentials WebForm control with a generic html image
tag.
Try This!
To modify
this example to work with ActiveXs, change the RenderingType
setting for "Webform1.aspx" to ActiveX,
and the RenderingType
setting on "Webform2.aspx" to BinaryActiveXStream.
Give it a try! The browser will contain a fully interactive
graphing control. Right click the control to access
the user interface.
|
|
|
|
|
Complete online technical reference to the ProEssentials
product. Chapter 2's .NET Reference is the best mechanism
to navigate the large quantity of properties and features.
Walk-Throughs of .NET graphing in VB.NET, C#.NET, ASP, VC,
VB6, and Delphi get you started quickly.
learn
more about web graphing, See Chapter 2
|
|
|
|