Please enable JavaScript to view this site.

QPR Knowledge Base 2023.1

  •      
  • Navigation: Developer's Guide > QPR API > The Object Model > QPR Metrics > SCModel Commands

    GetGraph

    Scroll Prev Top Next More

    Revision history:

    Introduced in QPR 7.3.1

    Last changed in QPR 2012

     

    Stores the graphical image of a selected element and period to the file GraphFileName. GraphFileName i.e. Graphics File Name with the full path is given as a parameter. This is useful e.g. for creating reports. Additional options can also be defined in the function call.

     

    Synopsis:

     

    SCModel.GetGraph(ElementId, GraphFileName, Options)

     

    Parameters:

     

    ElementId: Integer. ID of the desired element.

    GraphFileName: String. Graph file name with a full path included. In the case this parameter is empty, the graph is placed on the clipboard in BMP + metafile format.

    Options: String. A ";" separated list of additional options. The following options are supported:

    TYPE

    PNG

    BMP (bitmap)

    WMF (Windows metafile)

    JPG (Jpeg, default)

     

    GRAPHTYPE

    INDICATOR: Returns measure's graph area with indicators and history charts included

    CHART: Returns measure's graph area with indicators and history charts included

    SCORECARDVIEW: Returns scorecard's Hierarchy View.

    STRATEGYMAPVIEW: Returns scorecard's Dashboards view.

    TREND: Returns measure's trend arrow symbol. This requires that SERIES and PERIOD (or PERIODNAME) options are defined as well.

     

    SERIES

    -1 (default series)

    Series identifier

     

    PERIOD

    -1 (latest)

    -2 (current)

    -3 (latest for all)

    -4 (chart period, uses settings defined in QPR Metrics client)

    -5 (previous)

    -6 (next)

    Period's ID

     

    Note that the period defined either by the PERIOD or PERIODNAME option also defines the period level used. For example, if the period name is "2005", period level of "Year" is used.

     

    PERIODNAME: Name of the selected period. The PERIOD option (if defined) overrides this option.

     

    PERIODMIN: Offset of periods to show before the selected period. This option is applicable only if the GRAPHTYPE option is set to CHART. Also positive offset (i.e. referring to periods after the selected period) is allowed.

     

    PERIODMAX: Offset of periods to show after the selected period. This option is applicable only if the GRAPHTYPE option is set to CHART. Also negative offset (i.e. referring to periods before the selected period) is allowed.

     

    WIDTH: Graph's width in pixels. 640 by default.

     

    HEIGHT: Graph's height in pixels, 480 by default.

     

    TEMPLATE:  ID or name of a graph layout template. Selects the graph layout template that is used when creating the graph layout image. This option is applicable only if the GRAPHTYPE option is set to INDICATOR or CHART. In the case the TEMPLATE parameter is empty, the currently selected graph layout template is used.

     

    VIEW: ID or name of view settings to be used for the generated graph. This option is applicable only when the GRAPHTYPE option is set to SCORECARDVIEW or STRATEGYMAPVIEW. If this parameter is omitted, the default view settings are used.

     

    Required Rights:

     

    At least view rights for an element. In the case of Dashboards or Hierarchy View, at least Model Administrator rights for the SCModel.

     

    Return Values:

    Below are listed the return values that this function can return:

     

    RV_MODEL_NOT_OPEN

    RV_APPLICATION_QUIT_CALLED

    RV_NOT_CONNECTED_TO_SERVER

    RV_NOT_AUTHENTICATED

    RV_INVALID_PARAMETER

    RV_SUCCESS

    RV_NO_RIGHTS

    RV_ELEMENT_NOT_FOUND

    RV_CANNOT_OPEN_FILE

    RV_UNKNOWN_ERROR

    RV_SERIES_NOT_FOUND

    RV_NO_TREND

    RV_NO_TREND_IMAGE

    RV_CANNOT_COPY_TO_CLIPBOARD

     

    Example Procedure:

     

    iResult = SCModel.GetGraph(98765,"C:\temp\graph.jpg", _

     "GRAPHTYPE=STRATEGYMAPVIEW;PERIOD=-2;WIDTH=200;HEIGHT=100")