Basic Use of WebChart Server-Side Components > Using the Server-Side Components |
The server-side charting components (one each for 2D and 3D) share a common API with the client-side ComponentOne Chart controls. The API has been slightly modified to suit the server-side needs. Specifically, the ability to explicitly set the chart's Width and Height properties has been added:
Example Title |
Copy Code
|
---|---|
Chart.Width = 600 Chart.Height = 500 |
If chart width and height are not specified, the component uses default values
Note: Currently the default is (300, 300), but this may change in a future release and should not be relied upon. |
All other top-level properties and methods of the ComponentOne Chart objects are exposed by the matching server-side component. This means that developers experienced with ComponentOne Chart will be able to leverage their existing knowledge and code when working with ComponentOne WebChart, a real time-saver and one more way WebChart increases your productivity!
Finally, the image or data must be generated, and appropriate HTML tag(s) must be included in the client-side HTML. To make this process simple yet flexible, we provide a set of script functions to generate tags in the files 2DGENTAG.INC and 3DGENTAG.INC. Functions are provided for both VBScript and JavaScript.
A complete (minimal) sample for a 2D ASP page is shown below. It produces a web page with a default chart. A 3D version requires only a global change from 2D to 3D.
Example Title |
Copy Code
|
---|---|
<%@ LANGUAGE="VBSCRIPT" %> <html> <!-- #INCLUDE VIRTUAL="/WebChart8/Include/VBS/2dgentag.inc" --> <head> <title>ComponentOne WebChart</title> </head> <body> <% Set Chart2D1 = Server.CreateObject("C1Chart2D8.ASPComponent") Chart2D1.Width = 610 Chart2D1.Height = 400 OlectraChart2D_GenerateTag_JPEG Chart2D1, "Chart2D1" %> </body> </html> |