bool GraphToStream(stream, mimeType)
Creates a graph image of the data contained in the CATable object formatted using the mimeType, and writes it to stream, a Windows IStream. The size of the image in pixels is controlled by the GraphWidth and GraphHeight properties of the table.
- Note: Note: An IStream is not interchangeable with a .NET System.Io.Stream object (including a Response.OutputStream object in ASP.NET). A wrapper class is necessary for converting between these. TBD: The Wrapper class and more instructions should be included here.
- stream – string
- mimeType – string, usually one of:
When you have a CATable result with at least one dimension, you can obtain a graph of the result as an image. One use of this is to embed graphs as JPEG images in a web page that uses ADE on the back end.
Obtaining the graph of a result requires the following steps:
- Select the appropriate graph settings, such as chart type, axis range settings, colors, fonts,and so on. The easiest way is to open the model in Analytica Enterprise, and select the settings you want for each variable using the Graph Setup dialog.
The graph template you create using the Graph Setup dialog is stored in the GraphSetup attribute of the object. You can copy the GraphSetup attribute from an existing variable if you need to change the style template.
- From ADE, obtain a CATable with the result to be graphed.
- Set the GraphWidth and GraphHeight properties of the CATable object to indicate the desired size of the graph in pixels.
- If your result has more than two dimensions, call Slice or Subscript to reduce the dimensionality to the desired dimensionality for the plot (usually one dimension if there is no key or two dimensions if there is a key).
- If you have more than one dimension, call SetIndexOrder to select the desired pivot for the graph.
- If you are sending the graph to an output stream, obtain a Windows IStream interface to the stream. If you have a .NET Stream (
System.io.Stream), you need to use a wrapper class (see below).
- Call either the GraphToStream or GraphToFile methods of CATable, depending on where you want the graph written to. The graph can be created in different MIME types (e.g.,
tab.GraphWidth = 350 tab.GraphHeight = 200 dim outStream as StringConnector = _new StreamConnector(Response.OutputStream) b = tab.GraphToStream( outStream, "image/jpeg")