CATable::GraphToStream
ADE User Guide > ADE Server Class Reference > CATable
bool GraphToStream(stream, mimeType)
描述
建立一个数据包含在CATable对象中的图像,数据使用mimeType格式化并写入到文件stream(流)中。通过表格的GraphWidth和GraphHeight属性控制图形像素大小。
- 注意:一个IStream不可以同一个.NET System.Io.Stream对象互换。
返回值
布尔值(成功)
参 数
- stream:字符串
- mimeType :字符串, 使用以下代码之一:
"image/png"
"image/jpeg"
"image/bmp"
"image/tiff"
详细说明
这些说明从 ADE用户指南: 使用Analytica图形引擎第四章中拷贝而来。
当你获得一个最少包含一个维度的CATable 结果时,你可以以图像的方式获得该结果的图形。该用法之一就是将图形作为JPEG图像嵌入到在后端使用ADE的web页面中。
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.,
"image/JPEG"
).
用法
ab.GraphWidth = 350 tab.GraphHeight = 200 dim outStream as StringConnector = _new StreamConnector(Response.OutputStream) b = tab.GraphToStream( outStream, "image/jpeg")
另请参考
- ADE用户指南第四章中的使用Analytica图形引擎
- CATable::GraphToFile
Comments
Enable comment auto-refresher