GetPicture Method

Microsoft Office Web Components Object Model

GetPicture Method

       

Returns a picture of a chart from a binary data stream.

expression.GetPicture(FilterName, Width, Height)

expression   Required. An expression that returns a ChartSpace object.

FilterName  Optional String. The name of the graphics filter to use. The default value is "GIF".

Width  Optional Long. The width of the chart in pixels.

Height  Optional Long. The height of the chart in pixels.

Remarks

You can use the BinaryWrite method to write the picture returned by this method to the current HTTP session.

Example

This example uses an ASP script to create a chart based on data in a SQL Server database. Once the chart has been created, an picture of the chart is displayed in the browser window.
   <%
   Dim PictType
   Dim NewChart
   Dim chConstants

   Set NewChart = CreateObject("OWC10.ChartSpace")

   Response.Expires = 0
   Response.Buffer = True
   Response.Clear

   PictType = "jpg"
   Response.ContentType = "image/" & PictType

   Set chConstants = NewChart.Constants

   NewChart.ConnectionString = "Provider=SQLOLEDB.1;persist Security Info=TRUE;User ID=sa;Initial " & _
                               "Catalog=Northwind;Data Source=servername;PASSWORD=;"
   NewChart.DataMember = "Order Details"

   NewChart.SetData chConstants.chDimCategories, chConstants.chDataBound, "ProductID"
   NewChart.SetData chConstants.chDimValues, chConstants.chDataBound, "Quantity"

   NewChart.Charts(0).Type = chConstants.chChartTypeColumn3D
   NewChart.Charts(0).HasTitle = True
   NewChart.Charts(0).Title.Caption = "Server-Rendered Chart"

   Response.BinaryWrite NewChart.GetPicture(PictType, 500, 400)
   %>