GetPicture Method

Microsoft Office Web Components Visual Basic

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("OWC11.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;" & _
                               "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)
   %>