GetPicture Method

GetPicture Method

Office 2003

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.


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


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("OWC11.ChartSpace")

   Response.Expires = 0
   Response.Buffer = True

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

   Set chConstants = NewChart.Constants

   NewChart.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=TRUE;" & _
                               "Integrated Security=SSPI;Initial Catalog=Northwind;" & _
                               "Data Source=servername;"
   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)


Applies to | ChartSpace Object

© 2015 Microsoft