Article ID: 244049 - Last Review: February 22, 2007 - Revision: 3.5 How To Use Server-Side Charting to Generate Charts DynamicallyThis article was previously published under Q244049 On This PageSUMMARY In addition to using the Microsoft Office Chart Web
Component as a Component Object Model (COM) control hosted on a form, it is
possible to use the Chart Web Component as a non-visible, in-memory object.
This article illustrates how you can use the Chart Web Component on a server to
create a chart represented as a Graphics Interchange Format (GIF) image. You
can implement the strategy discussed in this article to generate chart images
that can be used across the Internet or in enterprises with heterogeneous
client desktops. MORE INFORMATION With the Chart Web Component, you can create charts using
data from various sources, such as arrays, a databases, spreadsheets, or any
custom data sources. Once you create a chart, you can use the ExportPicture
method of the Chart Component to generate a GIF image of that chart. To accomplish this, you can modify the global.asa file and create an ASP page with the code illustrated in the following steps. Steps to Create Project
When you create multiple charts based on different sets of data, each chart must be saved as a unique GIF file. In this sample, the Scripting Run-time library's FileSystemObject generates a temporary file for the GIF image. The file is placed in the same folder as the ASP page so that you can use the MapPath method of the Session object to get the location of the temporary file. The filename is saved as a session variable so that it is deleted when the session ends. Note that IIS executes the Session_OnEnd subroutine whenever the session has timed out. The session times out if the client has not requested a page within the timeout duration, which is set to one (1) minute at the beginning of the session. Additional NotesCurrently, the only filter available to the ExportPicture method is for "GIF" images.The ExportPicture method has two arguments that allow you to indicate the dimensions in pixels of the generated chart. In the sample code provided, the width and height dimensions are hard-coded. Instead, you can use dimensions that your client specifies. The OWC.Chart ProgID applies to Office Web Components 9.0. If you want to use version 10 of the components, change the ProgID from OWC.Chart to OWC10.ChartSpace or if you want to use version 11 of the components, change the ProgID from OWC.Chart to OWC11.ChartSpace. Problems with Server-Side UseYou should be aware that the Office 2000 Web Components are not designed for server-side use, and you may encounter problems if you use the components on a server with a high number of concurrent user connections. Many of these issue are addressed in the Office XP Web Components and Office 2003 Web Components, and you should consider using the Office XP Web Components or Office 2003 Web Components for large-scale server-side solutions.For additional information, click the article number below to view the article in the Microsoft Knowledge Base: 317316
(http://support.microsoft.com/kb/317316/EN-US/
)
INFO: Limitations of Office 2000 Web Components When Used Server-Side
REFERENCES Programming Microsoft Office Web Components by Dave Stearns
ISBN: 0-7356-0794-X For additional information about using the Chart Web Component, see the following Knowledge Base articles: 240263
(http://support.microsoft.com/kb/240263/EN-US/
)
How To Create a Combination Chart with the Chart Web Component
235885
(http://support.microsoft.com/kb/235885/EN-US/
)
How To Use the Office Chart Web Component With VB
243192
(http://support.microsoft.com/kb/243192/EN-US/
)
How To Use VBScript to Bind a Chart to a Spreadsheet Component
| Article Translations
|
Back to the top
