CATable::GraphToFile

Revision as of 08:45, 25 October 2015 by Jhuawen (talk | contribs) (Created page with "= 另请参考 =")

ADE User Guide > ADE Server Class Reference > CATable

Other languages:
English • ‎中文

bool GraphToFile(fileName, mimeType)

描述

Creates a graph image of the data contained in the CATable object formatted using the «mimeType» and writes it to file «fileName». It uses attribute settings for the CAObject from which the CATable was obtained to control graph settings, uncertainty settings, and number format. The GraphWidth and GraphHeight properties control the size of the graph image in pixels.

返回值

布尔值(成功)

参 数

  • fileName:字符串
  • mimeType :字符串, 使用以下代码之一:
    • "image/png"
    • "image/jpeg"
    • "image/bmp"
    • "image/tiff"

详细说明

These instructions are copied from the ADE User Guide: Using the Analytica Graphing Engine, in Chapter 4.

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:

  1. 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.
  2. From ADE, obtain a CATable with the result to be graphed.
  3. Set the GraphWidth and GraphHeight properties of the CATable object to indicate the desired size of the graph in pixels.
  4. 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).
  5. If you have more than one dimension, call SetIndexOrder to select the desired pivot for the graph.
  6. 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).
  7. 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").

用法

tab.GraphWidth = 350
tab.GraphHeight = 200
b = tab.GraphToFile( "C:\data\trends.png","image/png" )

另请参考

Comments


You are not allowed to post comments.