CHARTrunner 3.0 Software Developer's Kit

Reference Manual

Date: 5-July-2007
Copyright © 1999-2007 PQ Systems, Inc.

Introduction

This document applies only to CHARTrunner version 3.0.  It does not apply to earlier versions.

CHARTrunner is a software application for creating, displaying, and publishing statistical process control (SPC) charts. The charts may use data from a wide variety of sources including Microsoft Access, SQL Server, Microsoft Excel, Oracle, and even simple text files. It runs on Microsoft Windows 98 and above. CHARTrunner may be used as an SPC charting component that is integrated with other systems or applications. This document describes many of the classes, methods and properties available for performing this integration.

CHARTrunner-e is the web server version of CHARTrunner. It may be used to publish charts defined in CHARTrunner so that the charts may be viewed by anyone with a web browser and access to the web server where CHARTrunner-e is installed.

CHARTrunner was created by PQ Systems, Inc. the developers of SQCpack™. To learn more about PQ Systems, visit:

    http://www.pqsystems.com

To learn more about CHARTrunner, visit:

    http://www.chartrunner.com and http://www.chartrunner.com/sdk

Licensing

If you install CHARTrunner or any CHARTrunner component on a computer, you must purchase a CHARTrunner license for that computer. CHARTrunner and/or CHARTrunner components are licensed on a per-computer basis. Any system or application derived from CHARTrunner and/or CHARTrunner components may be used only on computers for which a CHARTrunner license has been purchased. Please review the complete terms of the license agreement at: 

    http://www.chartrunner.com/license

Programmer's Guide

Click here for the Programmer's Guide which provides an overview of programming using the CHARTrunner ActiveX components. Click here for the most recent version on the web.

API Changes

The changes that have been made to the API (Application Programming Interface) for the CHARTrunner 3.0 SDK are detailed in CrSDK_API_Changes.htm.


CHARTrunner30.Application Properties

CHARTrunner30.Application Methods

CHARTrunner30.Application Events

PQCrDef Properties

PQCrDef Methods

CHARTrunner Charting Control Properties

CHARTrunner Charting Control Methods

CHARTrunner Charting Control Events


CHARTrunner30.Application Properties

bCanceledByUser Property

Returns a Boolean indicating if the user cancelled the definition edit during Me.EditDefinition().

Data type

Boolean

bChangedDuringEdit Property

Returns a Boolean indicating if the user modified the definition during Me.EditDefinition().

Data type

Boolean

bIsLicensed Property

Returns a Boolean indicating if the CHARTrunner30.Application object could find the appropriate license file.

Data type

Boolean

bNoChartNameInWindowTitle Property

Returns or sets whether the chart name will be displayed as part of the chart window title.

Data type

Boolean

bPrintBlackAndWhite Property

Returns or sets whether "Black and White" printing mode is enabled.  On some black & white printers lines and text are not printed visibly due to the way the printer driver converts colors to the black and white space. This boolean forces all chart lines and text to be printed as Black. Fills still behave as expected and show up as a shade of gray.

Data type

Boolean

bShowProgressBar Property

Returns or sets whether the progress bar will be displayed as part of a lengthy charting operation.

Data type

Boolean

bSilentMode Property

Returns or sets whether message boxes will be displayed when errors occur. Set this to True to suppress messages boxes. This is useful for unattended or batch processing where you do not want a single error to put up a message box and prevent the rest of the batch from processing.

Data type

Boolean

Default value

False

Env Property

The Env property is of type AppEnv and contains properties and methods related to CHARTrunner's operating environment. Among other things, this object handles language localization and registry information management.

Data type

AppEnv (object)

fPrintMarginBottom
fPrintMarginLeft
fPrintMarginRight
fPrintMarginTop    Properties

These properties return or set the printer margins to be used when printing charts. These will default to values set by users of the CHARTrunner application.

Data type

Single

oChartListCRF Property

This property is returns a PqStrList object which contains a list of strings, one string for each .CRF chart definition in the current chart folder. Each string entry contains the full path to the .CRF chart definition file. This list is populated by CHARTrunner30.Application.GetPeerChartLists().

Data type

PqStrList (object)

oChartListCRM Property

This property is returns a PqStrList object which contains a list of strings, one string for each .CRM Multi-chart definition in the current chart folder. Each string entry contains the full path to the .CRM Multi-chart definition file. This list is populated by CHARTrunner30.Application.GetPeerChartLists().

Data type

PqStrList (object)

oOocTests Property

An SqcOOC object. This object contains a list of out-of-control test rules that will be used to evaluate data for out-of-control conditions. These rules are used when any control chart is created that has the ControlChartSettings.bDoOOCTests property set to True. The SqcOOC object contains a list of tests. The tests take the following form:

1 Point beyond limits
7 Points ascending
2 of 3 above 2 sigma

Data type

SqcOOC

Remarks

In CHARTrunner the user can choose Setup | Out-of-control tests to set the active set of test rules; these rules are stored in the CHARTrunner30.Application.oOocTests property.  In CHARTrunner 1.1 this set of test rules was applied to all control charts when the chart was drawn.  

Starting in CHARTrunner 1.5 the active set of test rules is copied into the PQCrDef.oOocTests property when a PQCrDef object is created. Also, the Boolean CHARTrunner30.Application.bUseMasterOocTests is copied into PQCrDef.bUseMasterOocTests when a PQCrDef object is created.

If PQCrDef.bUseMasterOocTests is False then the test rules stored in PQCrDef.oOocTests are used to evaluate "out-of-control" conditions when a chart is drawn. If a chart definition file doesn't contain any test rules (e.g. a CHARTrunner 1.1 chart definition) then the rules from CHARTrunner30.Application.oOocTests will apply to the chart (because these rules were copied into PQCrDef.oOocTests when the PQCrDef object was created and were never replaced by rules from the chart definition file).

If PQCrDef.bUseMasterOocTests is True then the test rules stored in CHARTrunner30.Application.oOocTests are used to evaluate "out-of-control" conditions when a chart is drawn.

See also: CHARTrunner30.Application.ReadOocDefinition, PQCrDef.ReadOocDefinition.

Example

Dim bRtn As Boolean
Dim j As Integer
Dim oChRunApp As New CHARTrunner30.Application
 
   ' Display the current set of test rules.
   For j = 1 To oChRunApp.oOocTests.Tests.Count
      MsgBox oChRunApp.oOocTests.Tests(j)
   Next j
 
   ' Load a new set of test rules from a disk file. This will replace any existing
   ' tests with those from the file.
   bRtn = oChRunApp.ReadOocDefinition("C:\MyRules\OocTests1.ooc")

   ' Add a new test rule to those we loaded from the file.
   oChRunApp.oOocTests.Tests.Append "2 of 3 above 2 sigma"

sAdoTemplatePath Property

Sets or returns the full path to the file containing templates for ADO data sources. Used primarily by the CHARTrunner application and not generally useful in scripting applications.

Data type

String 

sAppPath Property

Sets or returns the full path to the folder where CHARTrunner is installed.


The CHARTrunner30.Application object needs access to certain files located in the folder where CHARTrunner is installed.  Setting this property to a folder path causes the sSysDataFolder, sStyleFolder and sLogFile, properties to be updated if they have not already been set.

Data type

String 

sChartFolder Property

Sets or returns the full path to the current folder containing the chart definition files. 

Data type

String

ScreenHeight Property

Returns the current height of the screen in twips as reported by Screen.Height.

Data type

Integer

ScreenWidth Property

Returns the current width of the screen in twips as reported by Screen.Width.

Data type

Integer

sCurLocaleID Property

This read-only property returns the current hex Locale ID that is in effect

Data type

String

sDefPrinter Property

Sets or returns a string that is the name of the printer that will be used (by default) for printing charts. If this is an empty string, the Windows default printer will be used. Note that the printer dialog box will allow the user to override this printer before charts are printed.

Data type

String

Default value

An empty string or the name of the printer selected by the CHARTrunner user. 

sLastCpkOutputFolder Property

Sets or returns the full path to the last output web page folder used for a Cpk analysis.

Data type

String 

sLastError Property

Many methods return a Boolean value. When the return value of False indicates an error, this property may be examined for a description of the error. This is a read-only property.

Data type

String 

sLicenseFile Property

A read-only property that returns the full path to the CHARTrunner license file.

Data type

String 

sLicenseNameOnly Property

A read-only property that returns only the filename portion of the CHARTrunner license file.

Data type

String 

sLogFile Property

Sets or returns the full path to the log file. If the property bSilentMode is True, no message boxes will be displayed when errors occur. However, if errors occur, the messages will be written into the file specified by this property.

Data type

String

sRegLocaleID Property

Sets or returns the current hex Locale ID that is stored in LocaleID in the CHARTrunner section of the Registry. In CHARTrunner if the current language is set to a language other than U.S. English then this property holds the Locale ID of the specified language.

Data type

String

sStyleFolder Property

Sets or returns the full path to the folder that contains the chart style definitions. A chart style definition contains information about colors, fonts, and styles that will be used when charts are drawn.

Data type

String

sSysDataFolder Property

Sets or returns the full path to the folder that is the SysData folder for the current CHARTrunner installation. This folder is used to store out-of-control test files, default chart files, and other system level files used by CHARTrunner. This property will default to the correct folder and is generally not changed by scripting code.

Data type

String


CHARTrunner30.Application Methods

BrowseForChartDefs Method

Displays a dialog box allowing the user to browse for and select CHARTrunner chart definitions. If the user selects one or more definitions, the full path to each definition is returned to the caller as an element of the returned string array.

Syntax

Public Function BrowseForChartDefs(ByVal bShowCRF As Boolean, _
    ByVal bShowCRM As Boolean, ByVal bShowCRW As Boolean) _
    As String()

Returns

An array of String where each element in the array is the path to a selected CHARTrunner definition.

Example

Dim oChRunApp As New CHARTrunner30.Application
Dim sDefPathArray() As String

   sDefPathArray() = oChRunApp.BrowseForChartDefs(True, True, True)

Remarks

If bShowCRF is True then regular Chart files will be shown. If bShowCRM is True then MultiChart files will be shown.  If bShowCRW is True then Workspace files will be shown.

CheckLicense Method

Check to see if the CHARTrunner license is valid.

Syntax

Public Function CheckLicense(Optional ByVal sLicFile as String = “”) as Boolean

Remarks

Note that sLicFile is an optional argument that defaults to an empty string.  If present it specifies the full path to the license file.

Returns

True = Success.
False = Failure (see sLastError).

Example

Dim oChRunApp As New CHARTrunner30.Application
Dim bRtn As Boolean
 
   bRtn = oChRunApp.CheckLicense()

CloseAllCharts Method

Close all currently open chart display windows.

Syntax

Public Sub CloseAllCharts()

CreatePqObject Method

This method is used to create various CHARTrunner objects and returns a reference to the created object. Many objects used by the CHARTrunner30.Application may not be created directly. Instead, use this method to instantiate these objects.

Syntax

Public Function CreatePqObject(eObjType As CrObjTypeEnum) As Object

Returns

An object reference to an object of the type requested.

Nothing = Failure (see sLastError)

Example

Dim oChRunApp As New CHARTrunner30.Application
Dim oCrDef as PQCrDef

   Set oCrDef = oChRunApp.CreatePqObject(eObjPQCrDef)

Remarks

A table of valid object types follows. Notice that the object variable being Set is usually declared as an object of the type you are asking to create.

 

eObjPQCrDef

1

Chart definition object

eObjPQCrDefDesc

2

File descriptor object

eObjPQCrColDef

3

Column definition object

eObjPQCrLimit

4

Control limit object

eObjCrRsViewer

5

Recordset viewer object

eObjSqcControlChartStyle

6

Control chart style object

eObjSqcHistogramStyle

7

Histogram chart style object

eObjSqcParetoStyle

8

Pareto chart style object

eObjSqcOOC

9

Out-of-control test object

eObjSqcOOCMgr

10

Out-of-control test manager object

eObjPQCrWeb

13

Save as web page object

eObjPQCrDashboard

14

Dashboard definition object

eObjPQCrIndicator

15

Dashboard Indicator definition object

DisplayChart Method

Displays a CHARTrunner chart from an existing chart definition file. sChartPath specifies the full path to an existing CHARTrunner chart definition.

Syntax

Public Function DisplayChart(ByVal sChartPath As String, _
   Optional ByVal bShowModal As Boolean = False, _
   Optional ByVal bReadOnly As Boolean = False, _
   Optional ByVal bAllowRefresh As Boolean = True, _
   Optional ByVal vTagVariant As Variant) As Boolean

Remarks

When the chart is displayed the user may use the Edit | Chart definition menu to alter the definition of the chart. They may also highlight subgroups and compute new sets of control limits. If you prefer that the user only view the chart and not have the ability to change it, set the bReadOnly argument to True. Some scripting environments do not allow a non-modal form to be displayed. If this is the case, you must set the bShowModal argument to True. If you do not want to allow the user to Refresh (F5) the chart then set bAllowRefresh to False. If vTagVariant is specified then it will be used to set the PQCrDef.TagVariant property.

Returns

True = Success.
False = Failure (see sLastError).

Example

Dim oChRunApp As New CHARTrunner30.Application
Dim bRtn as Boolean
 
  bRtn = oChRunApp.DisplayChart("C:\MyCharts\MyChart.crf")
  If Not bRtn then
     Msgbox oChRunApp.sLastError
  End if

DisplayChartFromClipboard Method

Display a CHARTrunner chart using data currently on the Windows clipboard.

Syntax

Public Sub DisplayChartFromClipboard()

Remarks

The user is prompted to specify the type of chart and other information, then the chart is displayed.

In versions prior to 2.5, this method took a chart type argument and did not prompt the user for any further information. This was changed in 2.5. The chart type parameter was eliminated, and a form prompts the user for the information needed to create a chart from data on the clipboard, then DisplayChartFromTextData() is called to actually display the chart.

DisplayChartFromTextData Method

Display a CHARTrunner chart using text data in the specified string.

Syntax

Public Function DisplayChartFromTextData(ByVal sTextData As String, ByVal eChartType As CrChartTypeEnum, _
   Optional ByVal sSeparatorChars As String, _
   Optional ByVal bConsecutiveSeparatorsAsOne As Boolean = False) As Boolean

Remarks

Display a chart of type 'eChartType' from the text data in 'sTextData'.

If 'bSeparatorChars' contains any characters these will be treated as separator characters when deciding how to form columns of data from the data on the clipboard. The default characters are Tab and Comma.

If 'bConsecutiveSeparatorsAsOne' is True then consecutive separators found in the clipboard data will be treated as if they were one single separator.

Returns

True = Success.
False = Failure (see sLastError).

DisplayDashboard Method

Display a preview of the Indicators contained in the Dashboard having storage path 'sDefPath'.

Syntax

Public Function DisplayDashboard(ByVal sDefPath As String) As Boolean

Remarks

Display the first indicator in the specified dashboard. Subsequent indicators in the dashboard can be viewed using the supplied controls on the viewing window.

Returns

True = Success.
False = Failure (see sLastError).

DisplayOocSummary Method

Display the out-of-control summary form for the workspace having storage path 'sDefPath'.

Syntax

Public Function DisplayOocSummary(ByVal sDefPath As String) As Boolean

Returns

True = Success.
False = Failure (see sLastError).

DisplayHelp Method

CHARTrunner is installed with several on-line help files. Use this method to launch the on-line help file of your choice.

Syntax

Public Function DisplayHelp(eHelpFileType As CrHelpFileTypeEnum, _
   hWndParent As Long, eCmdType As HelpCommandTypeEnum, _
   Optional lTopic As Long = 0) As Boolean

The enum definitions used for the parameters are:

Public Enum CrHelpFileTypeEnum
   eCrHelpFileChartRunner = 1
   eCrHelpFileAdvisor
End Enum 'CrHelpFileTypeEnum'
 
Public Enum HelpCommandTypeEnum
   eHlpCmdTypeContext = cdlHelpContext
   eHlpCmdTypeQuit = cdlHelpQuit
   eHlpCmdTypeIndex = cdlHelpIndex
   eHlpCmdTypeContents = cdlHelpContents
   eHlpCmdTypeHelpOnHelp = cdlHelpHelpOnHelp
   eHlpCmdTypeSetIndex = cdlHelpSetIndex
   eHlpCmdTypeSetContents = cdlHelpSetContents
   eHlpCmdTypeSetContextPopup = cdlHelpContextPopup
   eHlpCmdTypeForceFile = cdlHelpForceFile
   eHlpCmdTypeHelpKey = cdlHelpKey
   eHlpCmdTypeCommandHelp = cdlHelpCommandHelp
   eHlpCmdTypePartialKey = cdlHelpPartialKey
End Enum 'HelpCommandTypeEnum'

hWndParent is the window handle of the parent window that launches the help.

Returns

True = Success.
False = Failure (see sLastError).

Example

Dim oChRunApp As New CHARTrunner30.Application
Dim bRtn as Boolean
 
  bRtn = oChRunApp.DisplayHelp(eCrHelpFileChartRunner, Me.hWnd, eHlpCmdTypeContents)

EditDefinition Method

This method lets the user edit the chart, dashboard or style  definition specified by sDefPath.

Syntax

Public Function EditDefinition(ByVal sDefPath As String, Optional ByVal bAllowNameChange As Boolean=False, _
   ByVal oDefDesc As _PQCrDefDesc) As Boolean

Remarks

The user will be allowed to change the name of the definition if bAllowNameChange is True.

If the definition name is changed, the new name will be available in Me.sNewDefinitionName. If the definition name was not changed, then
Me.sNewDefinitionName = "". If the old definition was deleted then Me.bOldDefinitionDeleted will be True, else False.

If the user saved changes to the definition then Me.bChangedDuringEdit will be True, else False.

If the user cancels the definition edit then Me.bCanceledByUser will be True, else False.

Returns

True = Success.
False = Failure (see sLastError).

GetImageInfoFromUser Method

This method displays a dialog box that provides information about a chart image file that a user wants to generate. The caller must provide arguments for file name, image type, width, and height. Returns True if user specifies all valid information and clicks OK. Returns False if the user cancels or if information is invalid or incomplete. This method changes the contents of its arguments. If the method returns True, the arguments will contain the user selections from the dialog box.

Syntax

Public Function GetImageInfoFromUser(sFileName As String, _
   eType As CrImageTypeEnum, lWidthInPixels As Long, _
   lHeightInPixels As Long) As Boolean

Remarks

Can be used before calling SaveChartAsImage to allow the programmer to override parameters such as image type and image size that are stored in the chart definition file.

Returns

True = Success.
False = Failure (see sLastError).

GetPeerChartLists Method

Syntax

Public Sub GetPeerChartLists(ByVal eWhichList As PeerListEnum, _
   ByVal sChartFolder As String)

Remarks

This method fills CHARTrunner30.Application.oChartListCRF and/or CHARTrunner30.Application.oChartListCRM with a list of the available peer charts that are found in the chart folder specified by sChartFolder.  The parameter eWhichList specifies which list (or both) to be filled.

PrintChart Method

Print the CHARTrunner chart definition specified by sChartPath.

Syntax

Public Function PrintChart(ByVal sChartPath As String, _
   Optional ByVal bPrintWithDialog As Boolean = True, _
   Optional ByVal bPrnMCSep As Boolean = False, _
   Optional ByVal sPrinterName As String) As Boolean

Parameters
 

sChartPath Full path to the chart definition to be printed
bPrintWithDialog Show a printer dialog?
bPrnMCSep Print Multi-Chart children on separate pages?
sPrinterName Name of the printer to send the output to

Remarks

Note that like the DisplayChart and SaveChartAsImage methods, this method will query the chart's data source and create a fresh chart based on the current data. If this method returns False, the caller should check the contents of sLastError for a description of the problem.

Returns

True = Success.
False = Failure (see sLastError).

ReadOocDefinition Method

This method reads an out-of-control test definition file and stores the rules into the CHARTrunner30.Application.oOocTests object. An out-of-control test definition is a text file containing out-of-control test rules. Here is an example of an out-of-control test rule:

1 Point beyond limits

This means that if a data point is beyond the control limits (on a control chart) it will be considered an “out-of-control” data point. Several example OOC files can be found in the SysData folder where CHARTrunner is installed.

Syntax

Public Function ReadOocDefinition(ByVal sOocPath As String) As Boolean

Remarks

If sOocPath contains valid out-of-control test rules, they will be read and will become the current out-of-control tests stored in CHARTrunner30.Application.oOocTests. 

In CHARTrunner the user can choose Setup > Out-of-control tests to set the active set of test rules; these rules are stored in the CHARTrunner30.Application.oOocTests property.  In CHARTrunner 1.1 this set of test rules was applied to all control charts when the chart was drawn.  

Starting in CHARTrunner 1.5 the active set of test rules is copied into the PQCrDef.oOocTests property when a PQCrDef object is created. Also, the Boolean CHARTrunner30.Application.bUseMasterOocTests is copied into PQCrDef.bUseMasterOocTests when a PQCrDef object is created.

If PQCrDef.bUseMasterOocTests is False then the test rules stored in PQCrDef.oOocTests are used to evaluate "out-of-control" conditions when a chart is drawn. If a chart definition file doesn't contain any test rules (e.g. a CHARTrunner 1.1 chart definition) then the rules from CHARTrunner30.Application.oOocTests will apply to the chart (because these rules were copied into PQCrDef.oOocTests when the PQCrDef object was created and were never replaced by rules from the chart definition).

If PQCrDef.bUseMasterOocTests is True then the test rules stored in CHARTrunner30.Application.oOocTests are used to evaluate "out-of-control" conditions when a chart is drawn.

Returns

True = Success.
False = Failure (see sLastError).

SaveChartAsClipChart Method

Save the chart definition specified by the full storage path sChartPath as a clipCHART file specified by sClipChartPath.

Syntax

Function Public Function SaveChartAsClipChart(ByVal sChartPath As String, _
   Optional ByVal sClipChartPath As String) As Boolean

Remarks

If sClipChartPath is a zero length string then prompt the user for the clipCHART file. If the user cancels then True is returned since no error occurred.

See also: PQCrDef.CreateClipChart

Returns

True = Success.
False = Failure (see sLastError).

Example

Dim oChRunApp As New CHARTrunner30.Application
Dim bRtn As Boolean
 
   bRtn = oChRunApp.SaveChartAsClipChart("C:\MyCharts\MyChart.crf", "C:\ClipCharts\MyChart.ccf")

SaveChartAsCpkAnalysis Method

Save the chart definition specified by 'sChartPath' as a Cpk analysis web page.

Syntax

Function Public Function SaveChartAsCpkAnalysis(ByVal sChartPath As String, _
    Optional ByVal oAnalysis As CrCpkAnalysis = Nothing, _
    Optional bInteractive As Boolean = False) As Boolean

Remarks

The properties of the analysis are defined by 'oAnalysis'.

If 'oAnalysis' is not passed into this method, then use the specs from 'Me' and the output path will be defined by sLastCpkOutputFolder.

If 'bInteractive' is True then allow the user to edit the parameters of 'oAnalysis' prior to creating the Cpk analysis.

Returns

True = Success.
False = Failure (see sLastError).

SaveChartAsImage Method

Generate an image file based on an existing CHARTrunner chart definition. The image will be either a Windows bitmap file (*.bmp), a Windows enhanced metafile (*.emf), a Portable Network Graphic (*.png) or a JPEG compressed image file (*.jpg).

Syntax

Public Function SaveChartAsImage(ByVal sChartPath As String, _
   Optional ByVal sOutputImagePath As String = "", _
   Optional ByVal eType As CrImageTypeEnum = 0, _
   Optional ByVal lWidthInPixels As Long = 0, _
   Optional ByVal lHeightInPixels As Long = 0) As Boolean

Remarks

The sChartPath argument specifies the full path to an existing CHARTrunner chart (*.crf) or multi-chart (*.crm) definition.

The only required argument to this method is sChartPath. All the other arguments have corresponding settings stored in the chart definition file itself. If the caller does not specify these arguments, the contents of the chart definition will determine the settings used for the optional arguments. 

Returns

True = Success.
False = Failure (see sLastError).

SaveChartAsWebPage Method

This method saves the chart definition specified by sChartPath as a web page.

The configuration of the web page is defined by the properties of oPage. If oPage is not passed into this method, then use the chart's default web page parameters in PQCrDef.oWebPage.

Syntax

Public Function SaveChartAsWebPage(ByVal sChartPath As String, _
   Optional ByVal oPage As PQCrWeb = Nothing) As Boolean

Returns

True = Success.
False = Failure (see sLastError).

SaveDashboardImages Method

This method generates images of the indicators contained in the dashboard having storage path 'sDefPath'.

Syntax

Public Function SaveDashboardImages(ByVal sDefPath As String, _
   Optional ByVal sFolder As String, _
   Optional ByVal eImageType As CrImageTypeEnum = 0, _
   Optional ByVal lWidth As Long = -1, _
   Optional ByVal lHeight As Long = -1) As Boolean

Returns

True = Success.
False = Failure (see sLastError).

Remarks

If 'eImageType' is zero then the user will be prompted to specify the image type to use.

If 'lWidth' or 'lHeight' is less than zero then the user will be prompted to specify the height and width to be used for all indicator images.

If the value specified for 'lWidth' or 'lHeight' is zero then the value of height or width specified by each Indicator definition will be used,
else these specify the size of the images to create.

The images will be generated in the folder specified by 'sFolder'.

If 'sFolder' is a zero length string then the user will be prompted to specify the folder where the images will be created.

It is possible that this routine will generate one or more images (from the Dashboard) successfully but return False because one or more of the images encountered an error. So the caller should examine Me.sLastError if this function returns False.

SaveOOCSummary Method

Saves the results of an OOC summary to the specified output file.

Syntax

Public Function SaveOOCSummary(ByVal sDefPath As String, _
    ByVal sOutPath As String, _
    ByVal eOutFmt As OocSummaryOutputFmtEnum, _
    Optional ByVal eRowOpt As OocRowOptionEnum = eAllRows, _
    Optional ByVal iRows As Integer) As Boolean

Parameters

    sDefPath - Full path to the workspace definition to evaluate.

    sOutPath - Full path for the output results file.

    eOutFmt - Results file format: eTextFile or eExcelFile.

    eRowOpt - Whether to evaluate all rows (eAllRows) or only the last N rows (eLastNRows).

    iRows - Specifies the last N rows to evaluate when eRowOpt=eLastNRows.

Returns

True = Success.
False = Failure (see sLastError).

SaveWorkspaceImages Method

This method generates a chart image file for each chart defined in the chart workspace definition specified by sChartPath.

A chart workspace is a collection of one or more CHARTrunner charts.

Syntax

Public Function SaveWorkspaceImages(ByVal sChartPath As String, _
   Optional ByVal eImageType As CrImageTypeEnum = 0, _
   Optional ByVal lChartWidth As Long = 0, _
   Optional ByVal lChartHeight As Long = 0, _
   Optional ByVal sFolder As String) As Boolean

Returns

True = Success.
False = Failure (see sLastError).

Remarks

As with DisplayChart and PrintChart, this method will query the data source for each chart and generate a fresh chart based on current data each time it is called. If you create image files for a number of charts on a regular basis, this method allows you to automate and/or streamline this task by handling all the charts in the workspace with one call.

SaveWorkspaceWebPages Method

This method generates a web page for each chart defined in the chart workspace definition specified by sChartPath.

A chart workspace is a collection of one or more CHARTrunner charts.

Syntax

Public Function SaveWorkspaceWebPages(ByVal sChartPath As String, _
   Optional ByVal sOutputFolder As String) As Boolean

Returns

True = Success.
False = Failure (see sLastError).

Remarks

The configuration of the web pages is defined by each child chart definition.

However, if sOutputFolder is specified, then all web pages will be saved in that folder, rather than the output folder specified in each child chart definition.

It is possible that this routine will generate one or more web pages (from the Workspace) successfully but return False because one or more of the child charts encountered an error. So the caller should examine sLastError if this function returns False.

As with DisplayChart and PrintChart, this method will query the data source for each chart and generate a fresh web page based on current data each time it is called. If you create web pages for a number of charts on a regular basis, this method allows you to automate and/or streamline this task by handling all the charts in the workspace with one call.

SendChartImageAsEmail Method

E-mail the chart image(s) specified by the sChartDef chart definition.

Syntax

Function SendChartImageAsEmail(ByVal sChartDef As String) As Boolean

Remarks

This method always interacts with the user to allow the user to specify or change the parameters via a dialog.  Use the PQCrDef.SendChartImageAsEmail method if you do not want interaction with the user.

If an error occurs the error message will be displayed to the user.

Multiple e-mail addresses must be separated by a comma, e.g. "a@abc.com,b@abc.com". At least one destination e-mail address must be specified.

If the chart definition in Me specifies a Workspace then all child chart image files will be sent as attachments in a single e-mail message. If an error is encountered while generating a child chart image then False will be returned but the e-mail will still be sent if possible. A progress bar will be displayed as the child chart images are generated.

Returns

True = Success.
False = Failure (see sLastError).

SetLocale Method

Setup the application to localize for the locale specified by sLocaleID.

Syntax

Function SetLocale(Optional ByVal sLocaleID As String = "") As Boolean

Returns

True = Success (see sHexLocaleID for the current Hex Locale ID).
False = Failure (see sLastError).

Remarks

Normally sLocaleID specifies a locale ID that looks like "080A" (a standard hex Windows LCID) or "PQHC" (a PQ special ID).  If the LLD file that corresponds to sLocaleID is not found, then no localization will be done and the active language defaults to U.S. English.

However, sLocaleID can also specify one of these special values:

""

Do not localize.

"="

Localize based upon the current windows Locale ID.

"@"

Localize based upon LocaleID in the Registry.

"!"

Localize in "Test String Width" mode.

SetupLanguage Method

Open the specified sLanguageDB language database and use the specified sLanguageColumn column for the foreign language. Setup the Env.lg localization engine object as appropriate for the chosen language.

If either sLanguageDB or sLanguageColumn are zero length strings then the application will use the native language (U.S. English) because the current language database (if any) will be closed.

Syntax

Function SetupLanguage(sLanguageDB As String, sLanguageColumn As String) _
   As Boolean

Returns

True = Success.
False = Failure.

UpdateDashboardImages Method

Update the images in folder 'sFolder' from the Indicators contained in the Dashboard having storage path 'sDefPath'.

Syntax

Public Function UpdateDashboardImages(ByVal sDefPath As String, _
    Optional ByVal sFolder As String) As Boolean

If 'sFolder' is not specified or doesn't exist, the user will be prompted to specify the image folder.

All image files of type EMF or PNG in 'sFolder' will be updated if the image filename matches an indicator name in the specified Dashboard. The width and height of the newly created indicator image will match that of the image file being replaced.

It is possible that this routine will generate one or more images (from the Dashboard) successfully but return False because one or more of the images encountered an error. So the caller should examine Me.sLastError if this function returns False.

Returns

True = Success.
False = Failure (see Me.sLastError).

UpdateDashboardStats Method

Update the indicator statistics for the dashboard specified by 'sDefPath'.

Syntax

Function UpdateDashboardStats(ByVal sDefPath As String) As Boolean

If an error occurs while updating an individual indicator statistic value then that indicator will not be updated and this method will return False. However, the dashboard definition will always be saved back to storage whether or not any errors occurred while updating the individual indicators.

Returns

True = Success.
False = Failure (see Me.sLastError).

 


CHARTrunner30.Application Events

ChartUnload Event

This event is raised from the Form_Unload event of a frmChartDisplay form that is used to display a chart in a window.  A reference to the frmChartDisplay is passed as the oFrmChart argument.  If Cancel is set to a non-zero value the unload of the form will be canceled.  

This event is supported in version 1.6.68 and higher.

Syntax

Public Event ChartUnload(oFrmChart As Object, Cancel As Integer)

Example

Private WithEvents oChRunApp As New CHARTrunner30.Application

Public Sub DrawMyChart()

Dim bRtn as Boolean
 
  bRtn = oChRunApp.DisplayChart("C:\MyCharts\MyChart.crf")
  If Not bRtn then
     Msgbox oChRunApp.sLastError
  End if

End Sub 'DrawMyChart'

Private Sub oChRunApp_ChartUnload(oFrmChart As Object, Cancel As Integer)

   MsgBox "The chart " & oFrmChart.mCrDef.sChartName & " is unloading."

End Sub 'oChRunApp_ChartUnload'

PQCrDef Properties

A PQCrDef is a chart definition object. It is the in-memory representation of a CHARTrunner chart definition file. The following describe the properties and methods of the PQCrDef object.

bAlwaysOnTop Property

This property sets or returns a Boolean indicating if the chart window should always be on top of other windows.

Data type

Boolean

Default value

False

bArsEnabled Property

Use this property to return or set a value indicating whether Advanced Row Selection is enabled. The checkbox to the left of the Advanced button on the data definition tab (when editing a chart definition in CHARTrunner) corresponds to this bArsEnabled property. See also: eArsMode, eArsUseTheseRows, eArsChooseRowsUnit, eArsRowsToLookAt, lArsLookAtEveryNRows, lArsUseFirstLastXRows, sArsColChangeColName.

Data type

Boolean

bAutoXAxisScatter Property

This property sets or returns a Boolean that determines whether automatic scaling of the scattergram chart's X-axis is performed.

Data type

Boolean

Default value

False

bAutoYAxisControlChart Property

This property sets or returns a Boolean that determines whether automatic scaling of the control chart's Y-axis is performed.

Data type

Boolean

Default value

False

bAutoYAxisHistogram Property

This property sets or returns a Boolean that determines whether automatic scaling of the histogram chart's Y-axis is performed.

Data type

Boolean

Default value

False

bAutoYAxisMultiLineChart Property

This property sets or returns a Boolean that determines whether automatic scaling of the Multi-line chart's Y-axis is performed.

Data type

Boolean

Default value

False

bAutoYAxisScatter Property

This property sets or returns a Boolean that determines whether automatic scaling of the scattergram chart's Y-axis is performed.

Data type

Boolean

Default value

False

bCanCalculateStatistic Property

Get whether 'eStatistic' can be returned by Me.GetStatisticValue() or Me.GetStatisticAsText() for the chart definition in 'Me'..

Syntax

Public Property Get bCanCalculateStatistic(ByVal eStatistic As pqEnumChartStat) As Boolean

Data type

Boolean

bCanceledByUser Property

This property sets or returns a Boolean that determines whether the user canceled the operation.

Data type

Boolean

Default value

False

bChanged Property

This property is set False by the ReadChartDefinition and Initialize methods. It is set True by the Edit method if the chart definition is modified during the edit session, else it is set False.  The bChangedDuringEdit property lets you know if the chart definition was changed during the last call to the Edit method, whereas the bChanged property lets you know if the chart definition has been changed during any call to the Edit method.

Data type

Boolean

Default value

False

bChangedDuringEdit Property

This property sets or returns a Boolean that determines whether the user changed the chart definition during the previous call to the Edit method. If no change is made during Edit this will be False. This property is set False by the ReadChartDefinition and Initialize methods. 

Data type

Boolean

Default value

False

bCloseDbAfter Property

This property sets or returns a Boolean that determines whether the connection to the chart's data source is closed immediately after the chart data has been fetched. This property corresponds to the Close data source after drawing chart? checkbox on the Misc tab of the chart definition form in CHARTrunner.

Setting this property to True will eliminate the problem where CHARTrunner locks a data source (such as Excel or a text file) while the chart is displayed so that other users are unable to open or edit the data source. It also corrects the problem where changes made to the chart data are not seen in the chart after the chart is refreshed. Even though CHARTrunner opens all data sources for "read-only" this results in a lock on some data sources which may prevent other users from opening the data source once CHARTrunner has displayed the chart. With bCloseDbAfter set to True CHARTrunner will open the data source only long enough to get the chart data and then the data source is closed. If the chart has a refresh interval, it will re-open the data source only when needed to refresh and then close it immediately.

This makes the Excel chart refresh problem much less frequent. However, it might still occur if CHARTrunner and another user try to access the data source at exactly the same time. For customers who are charting Excel data best results will be obtained when the Close data source after drawing chart? option is checked in the CHARTrunner chart definition and the Excel spreadsheet is setup in Shared Workbook mode.

When charting from a database like SQL Server or Oracle it is a good idea to set bCloseDbAfter to True so that connections to the database, which typically are a limited resource, are not held open while the chart is being displayed.

Data type

Boolean

Default value

True

bDenySaveToDisk Property

This property sets or returns a Boolean that determines whether the chart definition can be saved to disk.  New in CHARTrunner 2.0.

When this property is True, both SaveChartDefinition() and SaveChartDefinitionAs() return True but do not actually save the chart definition to disk.

Data type

Boolean

Default value

False

bEmbedStyleDef Property

This property sets or returns a Boolean that determines whether the current chart style definition (contained in oControlChartStyle, oHistogramStyle or oParetoStyle) is embedded into the XML chart definition (returned by the sXmlDefinition property).  When bEmbedStyleDef is False the XML chart definition contains only the name of the chart style that is to be used with the chart.

Data type

Boolean

Default value

False

bExternalRecordsetAllowFiltering Property

This property sets or returns a Boolean that determines whether to allow the filter definition (if any) to be applied to an external recordset.  New in CHARTrunner 2.0.

Data type

Boolean

Default value

True

bFilterEnabled Property

This property sets or returns a Boolean that determines whether the current filter definition (as defined by the FilterDef property) is applied to the chart.

Data type

Boolean

Default value

False

bIsDbOpen Property

This is a read-only property. A PQCrDef contains several properties that together define the data that will be used for this chart. This property returns True if the database for this PQCrDef is currently open. Scripting code which instantiates a PQCrDef object will not directly open the database. Instead, other methods such as GetChartRecordset will open the database internally.

Data type

Boolean

Default value

False 

bKeepDataObjects Property

This property sets or returns a Boolean that determines whether to retain the data object(s) used by a chart generation method such as PrintChart() or SaveChartAsImage().

If True, then a call to GetDataObject() allows you to get a reference to the data object(s) used by the last chart generation method such as PrintChart(). The data object for a chart gives you access to statistics such as Grand Mean, Sigma and Kurtosis for the chart.

Any change made to this property for a Multi-chart definition will be applied to all the child charts of that Multi-chart.

This property is available in version 1.6.68 and higher.  See the VBScript example file Sample9.vbs for an example of using GetDataObject() to get access to chart statistics.

Data type

Boolean

Default value

False 

bNoChartNameInWindowTitle Property

Returns or sets whether the chart name will be displayed as part of the chart window title.

Data type

Boolean 

bParetoCountMissing Property

This property sets or returns a Boolean indicating if this PQCrDef (which describes a Pareto chart) should count records where the category name is missing or blank.

Data type

Boolean 

bParetoIncludeMissingBar Property

This feature sets or returns a Boolean indicating whether this PQCrDef (which describes a Pareto chart) should display a bar on the chart indicating how many records contained a blank or missing category.

Data type

Boolean 

bParetoShowTotalsChart Property

This property sets or returns a Boolean that determines whether a Pareto Totals Chart is shown.

Data type

Boolean

bParOrderDescending Property

If this PQCrDef is a Pareto chart, this property sets or returns a value indicating that the Pareto bars should be displayed in Descending order. See also: eParOrderBy

Data type

Boolean

bPromptForParameters Property

This property sets or returns a Boolean indicating whether to prompt the user to update the parameter query values prior to rendering the chart. See also: cQueryParameters

Data type

Boolean

bPromptUserPswd Property

This property sets or returns a value indicating whether the user should be prompted for user name and password when opening the database associated with this chart definition. This is generally an issue when the source database requires all users to login with a name and password. See also: sAdoOdbcConnect, sAdoOdbcUser, and  sAdoOdbcPassword.

Data type

Boolean

bReadOnlyChart Property

Use this property to return or set a Boolean indicating whether the chart definition may be edited while the chart is displayed.

Data type

Boolean

bSrcColDefsCurrent Property

This Read-Only property indicates whether the cSrcColDefs collection has been filled via the GetSrcColDefsCollection method.

Data type

Boolean

bTitleGridLines Property

Charts may be defined with 10 rows and 3 columns of titles both above and below the chart. If you want these titles to be formatted with grid lines between the rows and columns, set this to True; otherwise, set it to False.

Data type

Boolean

bUseBracketsInSql Property

Use this command to return or set a value indicating whether SQL statements should surround table names and column names with brackets.  For example:

If True: SELECT * FROM [Data Table]

If False: SELECT * FROM Data Table

This property works in conjunction with the sSQLBracketLeft and sSQLBracketRight properties, which specify the character that should be used for bracketing. Note that these will almost always be the [ and ] characters. If your table names and/or column names contain spaces, this must usually be set to True.

Data type

Boolean

bUseExternalRecordset Property

This property returns a Boolean that determines whether an external (i.e. programmer supplied) recordset is being used to fetch the chart's data. See also: eRecSelectType

Data type

Boolean

bUseMasterOocTests Property

This property sets or returns a Boolean that determines which set of Out-of-Control tests are used when a chart is drawn for this PQCrDef object.

Remarks

In CHARTrunner the user can choose Setup | Out-of-control tests to set the active set of test rules; these rules are stored in the CHARTrunner30.Application.oOocTests property.  In CHARTrunner 1.1 this set of test rules was applied to all control charts when the chart was drawn.  

Starting in CHARTrunner 1.5 the active set of test rules is copied into the PQCrDef.oOocTests property when a PQCrDef object is created. Also, the Boolean CHARTrunner30.Application.bUseMasterOocTests is copied into PQCrDef.bUseMasterOocTests when a PQCrDef object is created.

If PQCrDef.bUseMasterOocTests is False then the test rules stored in PQCrDef.oOocTests are used to evaluate "out-of-control" conditions when a chart is drawn. If a chart definition file doesn't contain any test rules (e.g. a CHARTrunner 1.1 chart definition) then the rules from CHARTrunner30.Application.oOocTests will apply to the chart (because these rules were copied into PQCrDef.oOocTests when the PQCrDef object was created and were never replaced by rules from the chart definition file).

If PQCrDef.bUseMasterOocTests is True then the test rules stored in CHARTrunner30.Application.oOocTests are used to evaluate "out-of-control" conditions when a chart is drawn.

Data type

Boolean

cColDefs Property

A collection of PqCrColDef objects, each member of this collection describes a column from the data source recordset and information about how CHARTrunner should treat or use this column when creating the chart. When running CHARTrunner, this collection is created based on information the user specifies on the Data definition tab. This collection is highly coupled to the data source definition for the chart. In other words, each member of this collection must describe a column from the current data source recordset.

Data type

Collection

Example 1

Dim oChRunApp As New CHARTrunner30.Application
Dim oCrDef As PQCrDef
Dim oCrCol As PQCrColDef
 
   ' Assume you have a data table with 2 columns
   ' named: Date, DownTimeMinutes
  
   ' Create a chart definition object.
   Set oCrDef = oChRunApp.CreatePqObject(eObjPQCrDef)
  
   ' Create the first column object.
   Set oCrCol = oChRunApp.CreatePqObject(eObjPQCrColDef)
  
   ' Set some properties of the column object.
   oCrCol.sName = "Date"
   oCrCol.eTreatColAs = eCrColId
  
   ' Add it to the charts collection of column definition objects.
   oCrDef.cColDefs.Add oCrCol
  
   ' Create the second column object.
   Set oCrCol = oChRunApp.CreatePqObject(eObjPQCrColDef)
  
   ' Set some properties of the column object.
   oCrCol.sName = "DownTimeMinutes"
   oCrCol.eTreatColAs = eCrColMeasurement
  
   ' Add it to the charts collection of column definition objects.
   oCrDef.cColDefs.Add oCrCol

Example 2

Dim bRtn As Boolean
Dim oChRunApp As New CHARTrunner30.Application
Dim oCrDef As PQCrDef
Dim oCrCol As PQCrColDef

   ' Create a chart definition object.
   Set oCrDef = oChRunApp.CreatePqObject(eObjPQCrDef)
  
   ' Read a chart definition file.
   bRtn = oCrDef.ReadChartDefinition("C:\MyCharts\Machine1.crf", eCrPathFull)
  
   ' Look at each member of the cColDefs collection.
   For Each oCrCol In oCrDef.cColDefs
      MsgBox "Column name is: " & oCrCol.sName
   Next

cQueryParameters Property

A collection of ADODB.Parameter objects.  Each member of this collection describes an input query parameter that is used with the parameterized query associated with the data source for the chart.  

Only the name and value properties of the ADODB.Parameter object are used to store the name and value of the query parameter.

See the example code below for sample code that demonstrates the proper method of adding a new query parameter to the cQueryParameters collection. The important item to note is that the parameter name MUST be passed as the second argument to the Add() method.

If bPromptForParameters is True then CHARTrunner will prompt the user to enter query parameter values when the data source for the chart is opened.

Data type

Collection

Example

Dim oChRunApp As New CHARTrunner30.Application
Dim oCrDef As PQCrDef
Dim oParm as ADODB.Parameter

   ' Create a chart definition object.
   Set oCrDef = oChRunApp.CreatePqObject(eObjPQCrDef)
  
   ' Read a chart definition file that uses a parameterized query.
   bRtn = oCrDef.ReadChartDefinition("C:\MyCharts\MyQueryParmChart.crf", eCrPathFull)

   ' Here is an example of how to add a new query parameter to the chart definition.
   ' In this case the query parameter that is added is not actually used by this chart,
   ' but that's not a problem since CHARTrunner ignores query parameters that don't apply.
   Set oParm = New ADODB.Parameter
   oParm.Name = "[Added By Code]"
   oParm.Value = 44
   ' When you add the parameter to the oCrDef.cQueryParameters collection, you MUST pass
   ' the parameter name as the second argument!
   Call oCrDef.cQueryParameters.Add(oParm, oParm.Name)
  
   ' Look at each member of the cQueryParameters collection.
   For Each oParm In oCrDef.cQueryParameters
      MsgBox "Query parameter name is: " & oParm.name _
           & ", value is: " & oParm.value
   Next 

cSrcColDefs Property

This property returns a reference to a collection of PqCrColDef objects that describe the current chart data source.  This collection is created as a result of calling the GetSrcColDefsCollection method.  See also: bSrcColDefsCurrent

Data type

Collection

ChartPositionList Property

List of PQCrChartSize objects that describe the chart window size and position for each chart of a Workspace. If the chart is a Multi-Chart or normal single chart then ChartPositionList(1) contains the information for the single chart window. 

When a chart display window of a Workspace is closed the current chart window size and position information is written back to the parent Workspace chart definition file.

When the chart display window of a normal single chart or a Multi-chart is closed the current chart window size and position information is written back to the chart definition file for that chart.

The following code fragment demonstrates how to set the size and position of a chart window using the ChartPositionList property.

   Dim oChartSize As New PQCrChartSize

   ' Specify the size and position for the chart display window using the
   ' oChartSize object that was instantiated earlier in this routine.  This
   ' object lets you specify chart size and position information either in
   ' normalized units or twips.  The normalized units represent the chart window
   ' size and position in normalized percent of the screen.  The units are
   ' (FractionalPercent * 10000), i.e. 40% ==> (0.40 * 10000) = 4000.
   #If True Then
   ' Make the chart 60% of screen height and width and in the upper right corner
   ' of the screen using the "normalized units" properties.
   oChartSize.lNormTop = 0
   oChartSize.lNormLeft = 4000
   oChartSize.lNormHeight = 6000
   oChartSize.lNormWidth = 6000
   #Else
   ' Alternatively, you could use this code which sets the size and position
   ' of the chart as above, i.e. 60% of screen height and width and in the upper
   ' right corner of the screen, but uses "absolute" units of Twips.  Setting one of
   ' these "absolute" properties results in the corresponding "normalized" property
   ' being changed to the appropriate value, i.e. the value for .lTop is actually
   ' stored as a normalized number in the .lNormTop property.
   oChartSize.lTop = 0
   oChartSize.lLeft = Screen.Width * 0.4
   oChartSize.lHeight = Screen.Height * 0.6
   oChartSize.lWidth = Screen.Width * 0.6
   #End If
   ' Specify whether or not to maximize the chart window.
   oChartSize.bMaximized = False
   
   ' Give the chart size/position object to the chart definition so that it can
   ' properly size and position the chart display window on the screen.  For a
   ' normal chart (CRF) or Multi-Chart (CRM) the first position in the list, i.e.
   ' ChartPositionList(1), contains the size/position information for the chart.
   ' A new PQCrDef object will have ChartPositionList(1) equal to Nothing, which
   ' defaults to a centered chart occupying 80% of the screen height and width.
   Set oCrDef.ChartPositionList(1) = oChartSize

   ' Display the chart.  The chart size/position specified by oCrDef.ChartPositionList(1)
   ' defines the size and position of the chart display window on the screen.
   bRtn = oCrDef.Display()
   If Not bRtn Then
      MsgBox oCrDef.sLastError, vbExclamation
   End If

Data type

PqObjList (object)

ChildChartList Property

This property is returns a PqStrList object which contains a list of strings, one string for each child chart that is a member of a MultiChart or Workspace. Each string entry contains the full path to the child CHARTrunner chart definition file. This property is only relevant for Multi-Charts and Workspaces. A PqStrList is similar to a collection in that it has a .Count property.

Data type

PqStrList (object)

Example

Dim oChRunApp As New CHARTrunner30.Application
Dim oCrDef As PQCrDef
Dim bRtn As Boolean
Dim j As Integer

' Create a chart definition object.
Set oCrDef = oChRunApp.CreatePqObject(eObjPQCrDef)
  
' Open a chart definition file that is a multi-chart.
bRtn = oCrDef.ReadChartDefinition("C:\Charts\MyMultiChart.crm", eCrPathFull)
  
For j = 1 To oCrDef.ChartFileList.Count
   MsgBox "The file for child chart " & j & " is " & oCrDef.ChildChartList(j)
Next j

cLimits Property

Each member of this collection of PQCrLimitSet objects is a set of control limits. This collection is relevant only if the chart is defined as a control chart. A set of control limits has a name and several values that represent the limits to be used on the chart. Note that the chart type determines what limits exist. For example, a set of limits for an X-bar and Range chart contains upper, center, and lower limit values for both the X-bar chart and the Range chart. A chart may be defined with zero or more sets of control limits in this collection. This collection is filled by calling the ReadChartDefinition method.

Data type

Collection (of PqCrLimitSet objects)

ControlChartSettings
HistogramSettings
MlChartSettings
ParetoChartSettings
ScatterChartSettings
 Properties

Each of these properties represents a different type of settings object. Depending on the type of chart, only one of these objects will contain properties that are relevant to the current chart. For example, if the chart is an X-bar chart, only the ControlChartSettings object will be used; if the chart is a Pareto chart, only the ParetoChartSettings will be used. These are documented together because their use is identical for all charts; the only difference being which object is used.

There are many properties contained by each of these settings objects. See Interface_PQCM.html for more detailed information about the public properties of each type of settings object. 

Each type of settings object shares the overall design of being a "bag" where chart settings are stored.  Each chart setting is identified in the "bag" by its enum identifier.  For instance, the enum identifier for a PqControlChartSettings object is the pqEnumChartSetting type.  Many of the most frequently used chart settings are explicitly exposed via a property of the settings object, such as oCrDef.ControlChartSettings.bDoOOCTests.  All the chart settings in the "bag" are accessible via the Prop property as shown in the example below.

Data Type

ControlChartSettings is a PqControlChartSettings object.

HistogramSettings is a PQHistogramChartSettings object.

MlChartSettings is a PqControlChartSettings object (Multi-line charts use this)

ParetoChartSettings is a PQCategoryChartSettings object.

ScatterChartSettings is a PQScattergramChartSettings object.

Example

Dim bRtn As Boolean
Dim oChRunApp As New CHARTrunner30.Application
Dim oCrDef As PQCrDef

' Create a chart definition object.
Set oCrDef = oChRunApp.CreatePqObject(eObjPQCrDef)
  
' Open a chart definition file.
bRtn = oCrDef.ReadChartDefinition("C:\MyCharts\Sample 01.crf", eCrPathFull)
  
' Change some chart settings via properties of the ControlChartSettings object.
oCrDef.ControlChartSettings.bDoOOCTests = False
oCrDef.ControlChartSettings.bDrawDataPoints = False
oCrDef.ControlChartSettings.bDrawVerticalGrid = True
oCrDef.ControlChartSettings.bDrawHorizontalGrid = True 

' Change the same chart settings via the Prop property of the ControlChartSettings object.
oCrDef.ControlChartSettings.Prop(eControlChart_bDoOOCTests) = False
oCrDef.ControlChartSettings.Prop(eControlChart_bDrawDataPoints) = False
oCrDef.ControlChartSettings.Prop(eControlChart_bDrawVerticalGrid) = True
oCrDef.ControlChartSettings.Prop(eControlChart_bDrawHorizontalGrid) = True

eArsMode Property

If the chart is defined to use Advanced Row Selection, i.e. bArsEnabled is True, this property determines whether sampling or grouping is performed on the "rows to look at" specified by eArsRowsToLookAt

Grouping creates a subgroup out of each group of "used rows".  Sampling passes only the "used rows" of data to the chart. See also: eArsRowsToLookAt.

Data type

Public Enum pqEnumTreatARSRows
   eTreatARSRowsGroup = 0
   eTreatARSRowsSample = 1
End Enum 'pqEnumTreatARSRows'

eArsChooseRowsUnit Property

If the chart is defined to use Advanced Row Selection, i.e. bArsEnabled is True, and eArsRowsToLookAt = eCrArsSelectRowsOnColChange, and the recordset column specified by sArsColChangeColName is a date or date/time column, then the eArsChooseRowsUnit property specifies the interval of time over which each "group of rows" is formed.

After a "group of rows" has been formed, then depending on the values of eArsUseTheseRows and lArsUseFirstLastXRows, either "All the rows in the group of rows are used", "The first X rows in the group of rows are used", or "The last X rows in the group of rows are used".

Finally, if eArsMode = eTreatARSRowsSample the "used rows" are passed to the chart.  And if eArsMode = eTreatARSRowsGroup the "used rows" are grouped together to form a subgroup for the chart.

Data type

Public Enum CrDateGroupingUnitEnum
   eCrDateGroupNone = 0
   eCrDateGroupMinute = 1
   eCrDateGroupHour = 2
   eCrDateGroupDay = 3
   eCrDateGroupWeek = 4
   eCrDateGroupMonth = 5
   eCrDateGroupQuarter = 6
   eCrDateGroupYear = 7
End Enum 'CrDateGroupingUnitEnum'

eArsRowsToLookAt Property

Sets or returns a value indicating how to look at rows when the bArsEnabled property is set to True, i.e. Advanced Row Selection is enabled.

This property corresponds to the "Look at every N rows of data, where N =" and the "Look at every row of data until column Y data changes" radio buttons on the Advanced Row Selection dialog box.

If eArsRowsToLookAt = eCrArsSelectEveryNRows then each N consecutive rows of the recordset are "looked at as a group", where N is defined by lArsLookAtEveryNRows.

If eArsRowsToLookAt = eCrArsSelectRowsOnColChange then consecutive rows of the recordset are "looked at as a group" as long as the column specified by sArsColChangeColName contains the same value.  In other words, a new "group of rows" is formed whenever this column's value changes. If the column is a date or date/time column then eArsChooseRowsUnit allows you to specify the units of the "form a group of rows" interval, e.g. by day, week, month, etc.

After a "group of rows" has been "looked at", then depending on the values of eArsUseTheseRows and lArsUseFirstLastXRows, either "All the rows in the group of rows are used", "The first X rows in the group of rows are used", or "The last X rows in the group of rows are used".

Finally, if eArsMode = eTreatARSRowsSample the "used rows" are passed to the chart.  And if eArsMode = eTreatARSRowsGroup the "used rows" are grouped together to form a subgroup for the chart.

Data type

' Options for how rows are selected in Advanced Row Selection.
Public Enum CrAdvRowSelectEnum
   eCrArsSelectEveryNRows = 1
   eCrArsSelectRowsOnColChange = 2
End Enum 'CrAdvRowSelectEnum'

eArsUseTheseRows Property

If the chart is defined to use Advanced Row Selection, i.e. bArsEnabled is True, this property determines whether "All the rows in the group of rows are used", "The first X rows in the group of rows are used", or "The last X rows in the group of rows are used".

If the value of eArsUseTheseRows is eCrRowsToUseFirstX or eCrRowsToUseLastX then lArsUseFirstLastXRows determines the value of X.

Data type

' Which rows to use in Advanced Row Selection.
Public Enum CrAdvRowsToUseEnum
   eCrRowsToUseAll = 1
   eCrRowsToUseFirstX = 2
   eCrRowsToUseLastX = 3
End Enum 'CrAdvRowsToUseEnum'

eCanceledMode Property

Sets or returns the enum value that describes what operation was in progress when the user canceled the operation.

Data type

CrCanceledEnum

eChartType Property

Sets or returns the current chart type enum value.

Data type

CrChartTypeEnum

Remarks

Note that setting this property will automatically set the sChartType read-only property which will return a human readable version of the chart type. For example, if eChartType = eCrTypeXbarRange then sChartType will be “X-bar and Range”.

eDefType Property

This property sets or returns the CHARTrunner chart definition type.

A PQCrDef object may only be one of these definition types:

Data type

Public Enum CrDefTypeEnum
   eCrDefTypeChart = 1
   eCrDefTypeMultiChart = 2
   eCrDefTypeWorkspace = 3
   eCrDefTypeControlChartStyle = 4
   eCrDefTypeHistogramStyle = 5
   eCrDefTypeParetoStyle = 6
   eCrDefTypeOOC = 7
   eCrDefTypeOldStyle_CST = 8       ' 05-11-04 RBS To handle old .CST style files.
   eCrDefTypeDashboard = 9          ' 03-30-06 RBS Add dashboards in 2.5.
End Enum 'CrDefTypeEnum'

eDataSourceType Property

This property specifies the type of data source to be used for this chart.

Data type

CrDataSourceTypeEnum

eImageType Property

This sets or returns a value indicating the type of graphic image that will be generated. See also: SaveChartAsImage

Data type

CrImageTypeEnum

eJetDataType Property

When eDataSourceType is eCrDataSourceTypeJet this property specifies what type of Jet data source will be used to fetch chart data.

Data type

Public Enum CrJetDataTypeEnum
   eCrJetDataNotUsed = 0
   eCrJetDataAccess = 1
   eCrJetDataExcel3 = 2
   eCrJetDataExcel4 = 3
   eCrJetDataExcel5 = 4             ' Excel 95 / 5.0.
   eCrJetDataExcel8 = 5             ' Excel 97 / 8.0.
   eCrJetDataText = 6
   eCrJetDataParadox3 = 7
   eCrJetDataParadox4 = 8
   eCrJetDataParadox5 = 9
   eCrJetDataDBase3 = 10
   eCrJetDataDBase4 = 11
   eCrJetDataDBase5 = 12
   eCrJetDataLotus123_WK1 = 13
   eCrJetDataLotus123_WK3 = 14
   eCrJetDataLotus123_WK4 = 15
End Enum 'CrJetDataSourceTypeEnum'

eLimitOption Property

For control charts, this property sets or returns a value indicating which control limit option should be used. If the option eCrAllSavedLimits is selected and there are no members in the cLimits collection, the chart will be displayed with no control limits.

Data type

Public Enum CrLimitOptionEnum
   eCrNoLimits = 0
   eCrTempLimits = 1
   eCrAllSavedLimits = 2
End Enum 'CrLimitOptionEnum'

eLimitParBarsBy Property

For Pareto charts, this property sets or returns a value describing if and how the number of bars appearing on a Pareto chart should be limited. If you set this to eCrLimitParBarsByCount and you set the sParBarCountCutoff  property to 10, this results in a Pareto chart that includes only the top ten categories. If you set this to eCrLimitParBarsByPercent and you set the sParBarPerCentCutoff to “80%”, this results in a Pareto chart that inlcudes only the top 80% of the categories.

Data type

Public Enum CrParBarLimitByEnum
   eCrLimitParBarsByCount = 1
   eCrLimitParBarsByPercent = 2
End Enum 'CrParBarLimitByEnum'

eMultiChartTiling Property

How to arrange the child charts of a Multi-chart, e.g. tile horizontally or vertically. See also: iMultiChartColumns, iMultiChartRows

Data type

FormArrangeConstants (only vbTileHorizontal and vbTileVertical are used)

eMultiLinePlotValues Property

Sets or returns a value indicating how data points should be plotted on a Multi-line chart. A Multi-line chart can display up to ten separate data lines. Depending on how the data source is defined, the lines may plot either raw data values (eMultiLinePlotIndividuals), averages, ranges, or sigmas.

Data type

Public Enum CrMultiLinePlotEnum
   eMultiLinePlotNotSet = 0
   eMultiLinePlotIndividuals = 1
   eMultiLinePlotAverages = 2
   eMultiLinePlotRanges = 3
   eMultiLinePlotSigmas = 4
End Enum 'CrMultiLinePlotEnum'

Env Property

This is an AppEnv object. It contains properties and methods related to the environment in which CHARTrunner is operating. Among other things, this object manages language localization and registry information management.

Data type

AppEnv (object)

eParOrderBy Property

This property sets or returns a value indicating how the bars on a Pareto chart should be ordered. A standard Pareto chart orders the bars by value with the largest values appearing first. See also: bParOrderDescending.

Data type

pqEnumOrderBy (enumeration from PQDM5.DLL)

pqEnumOrderBy Enumeration Values

   eOrderByNone = 0
   eOrderByCategories = 1
   eOrderByValues = 2

ePrintOrientation Property

This property sets or returns a value indicating whether the chart should be printed in portrait or landscape orientation.

Data type

pqEnumPrintOrientation (enumeration from PQCM5.DLL)

pqEnumPrintOrientation Enumeration Values

   ePrintOrientationNone = 0
   ePrintOrientationPortrait = 1
   ePrintOrientationLandscape = 2

eRecSelectType Property

Use this property set or return a value indicating the type of record selection that will be used to fetch data for the chart. When an external recordset is used as the source of records for the chart, do not explicitly set eRecSelectType to eCrRecSetExternal; in that case the UseExternalRecordset method will set eRecSelectType to eCrRecSetExternal. See also sSqlSelect, sTableName, UseExternalRecordset

Data type

Public Enum CrRecSelectTypeEnum
   eCrRecSetExternal = 0               ' External recordset. (Added in 2.5)
   eCrRecSetTable = 1                  ' Standard table.
   eCrRecSetNamedQuery = 2             ' Query or view.
   eCrRecSetStoredProc = 3             ' Stored procedure.
   eCrRecSetCustomQuery = 4            ' Custom query.
End Enum 'CrRecSelectTypeEnum'

eResultRecSelectType Property

Sets or returns a value indicating which data points to display on the chart.

This property corresponds to the Result records to include field on the Data definition tab.

When set to eUseFirstN or eUseLastN, the value of N is specified by the sResultRecSelectN property.

The number of data points to display on the chart is determined after any filtering or Advanced Row Selection processing has been applied to the data.

For example, if a filter is set to include only SHIFT1 data, and Result records to include is set at Last 25, the chart would display the last 25 data points that were formed from the SHIFT1 data.

Likewise, if Advanced Row Selection is used to group the data into days and Result records to include is set to Last 30, then the chart will show the last 30 data points, where each data point represents a day's worth of data.

Data type

pqEnumUseRows (enumeration from PQDM5.DLL)

pqEnumUseRows Enumeration Values

   eUseAll = 0
   eUseFirstN = 1
   eUseLastN = 2

eValidationError Property

Returns the enum value indicating the validation error that occurred during the Validate method.

This property is available in version 1.6.68 and higher.

Data type

CrDefValidateErrorEnum 

FilterDef Property

The FilterDef property is a PqCrSqlFilterDef object. This object specifies filter conditions to use when the data source is a single table. Filtering allows you to select subsets of the data contained in a table. The PqCrSqlFilterDef mirrors the information on the Filter form that is displayed from the data definition tab when running CHARTrunner.

Data type

PqCrSqlFilterDef

iChildChartIndex Property

Read-Only child index for when this chart is a child of a Workspace or MultiChart. Always 1 for a CRF type of chart. Used to get the proper chart window size and position info from the chart definition. This gets set by ReadChartDefinition.

Data type

Integer

iControlChartDecimalDigits
iHistogramDecimalDigits
iScatterChartDecimalDigits  Properties

Use this property to set or return a value indicating how many decimal places should be used to display computed statistics on the chart.

Data type

Integer

iJpgImageQuality Property

Sets or returns the JPEG image quality value (1 - 99).  The default value is 75.  Setting this higher results in a better quality image with a larger image file size.

Data type

Integer

iMultiChartColumns Property

Sets or returns the number of columns to use when tiling Multi-charts.  See also: eMultiChartTiling, iMultiChartRows.

Data type

Integer

iMultiChartRows Property

Sets or returns the number of rows to use when tiling Multi-charts.  See also: eMultiChartTiling, iMultiChartColumns.

Data type

Integer

iSubgroupSize Property

This method returns the subgroup size (usually 1 to 40) that a variables control chart will use based on the current definition of columns as described by the cColDefs collection. This method is useful only when the chart is defined as one of the variables control charts. It represents the number of columns which are being treated as a Measurement.

Data type

Integer

LastRefreshTime Property

This property sets or returns a date/time value indicating the last time a chart (with a refresh interval) was refreshed.

Data type

Date

lDefaultImageHeight
lDefaultImageWidth   Properties

This property sets or returns a value indicating the default size (in pixels) of the image file created by the SaveChartAsImage method.

Data type

Long

lArsLookAtEveryNRows Property

When the property eArsRowsToLookAt is set to eCrRowSelectEveryN, this property sets or returns a value that represents N. See also: bArsEnabled

Data type

Long

lArsUseFirstLastXRows Property

This property sets or returns a value that represents X when the property eArsUseTheseRows is set to either eCrRowsToUseFirstX or eCrRowsToUseLastX. See also: bArsEnabled

Data type

Long

lRefreshInterval Property

This property sets or returns a value that represents the number of seconds in a refresh interval. If a chart with a refresh interval is displayed, it will be automatically refreshed (with any new data) each time this number of seconds passes.

Data type

Long

oControlChartStyle
oHistogramStyle
oParetoStyle Properties

Each of these properties represents a different type of chart style object. Depending on the type of chart, only one of these objects will contain properties that are relevant to the chart. For example, if the chart is a control chart, the oControlChartStyle object will be used. If the chart is a histogram, the oHistogramStyle will be used. These are documented together because their use is identical for all charts; the only difference is which object is used.

These contain many properties all of which are used to affect the appearance of the chart. Line colors, line styles, font sizes, chart colors, and many other properties are contained in one of these objects. Think of these as bags of style properties.

These properties are set during the ReadChartDefinition method. Each chart has an sChartStyleName property which (if set) specifies the name of the style definition to use. Style files prior to 2.0 had a .cst file extension, and style files in 2.0 and higher have a .csc (Control chart style), .csh (Histogram style) or .csp (Pareto style) extension. The ReadStyleDefinition method may be used to read a style definition file.

Generally speaking, it will be easier to manipulate individual chart styles by running the CHARTrunner application than it will be to do so in scripting code.

Data Type

oControlChartStyle is an SqcStyleControl object.

oHistogramStyle is an SqcStyleHistogram object.

oParetoStyle is an SqcStylePareto object.

oOocTests Property

An SqcOOC object. This object contains the list of out-of-control test rules that will be used to evaluate out-of-control conditions for this PQCrDef object. These rules are used when any control chart is drawn that has the ControlChartSettings.bDoOOCTests property set to True. The SqcOOC object contains a list of tests. The tests take the following form (see the CHARTrunner help file for more information on the syntax of these tests):

1 Point beyond limits

7 Points ascending

2 of 3 above 2 sigma

Data type

SqcOOC

Remarks

In CHARTrunner the user can choose Setup | Out-of-control tests to set the active set of test rules; these rules are stored in the CHARTrunner30.Application.oOocTests property.  In CHARTrunner 1.1 this set of test rules was applied to all control charts when the chart was drawn.  

Starting in CHARTrunner 1.5 the active set of test rules is copied into the PQCrDef.oOocTests property when a PQCrDef object is created. Also, the Boolean CHARTrunner30.Application.bUseMasterOocTests is copied into PQCrDef.bUseMasterOocTests when a PQCrDef object is created.

If PQCrDef.bUseMasterOocTests is False then the test rules stored in PQCrDef.oOocTests are used to evaluate "out-of-control" conditions when a chart is drawn. If a chart definition file doesn't contain any test rules (e.g. a CHARTrunner 1.1 chart definition) then the rules from CHARTrunner30.Application.oOocTests will apply to the chart (because these rules were copied into PQCrDef.oOocTests when the PQCrDef object was created and were never replaced by rules from the chart definition file).

If PQCrDef.bUseMasterOocTests is True then the test rules stored in CHARTrunner30.Application.oOocTests are used to evaluate "out-of-control" conditions when a chart is drawn.

See also: CHARTrunner30.Application.ReadOocDefinition.

Example

Dim bRtn As Boolean
Dim j As Integer
Dim oChRunApp As New CHARTrunner30.Application
Dim oCrDef as PQCrDef

   ' Create a chart definition object.
   Set oCrDef = oChRunApp.CreatePqObject(eObjPQCrDef)

   ' At this point the oCrDef.oOocTests property will contain the test rules
   ' currently stored in oChRunApp.oOocTests.

   ' Read a chart definition file. If the chart definition file contains test rules
   ' they will replace any existing test rules in oCrDef.oOocTests.
   bRtn = oCrDef.ReadChartDefinition("C:\MyCharts\Sample 01.crf", eCrPathFull)

   ' Display the current set of test rules.
   For j = 1 To oCrDef.oOocTests.Tests.Count
      MsgBox oCrDef.oOocTests.Tests(j)
   Next j

   ' Load a new set of test rules from a disk file. This will replace any existing
   ' test rules with those from the file.
   bRtn = oCrDef.ReadOocDefinition("C:\MyRules\OocTests1.ooc")

   ' Add a new test rule to those we loaded from the file.
   oCrDef.oOocTests.Tests.Append "2 of 3 above 2 sigma"

oWebPage Property

A PQCrWeb object that determines how and where a chart is saved as a web page. The SaveChartAsWebPage method uses the properties of PQCrWeb object to generate a web page from a chart.

The values of the properties of this object correspond to the settings on the Misc > Web Page Defaults tab of the chart definition.

Data type

PQCrWeb

PeerChartList Property

This property is a PqStrList object which contains a list of strings, where each string is the full path to a peer chart for "Chart Review". A PqStrList is similar to a collection in that it has a .Count property.

This property is used by the Display method to specify a list of peer charts for "Chart Review".

Data type

PqStrList (object)

rsDataADO
rsDataJet Properties

Each of these properties is a recordset object. If the property CrDataSourceTypeEnum is set to eCrDataSourceTypeJet, you should reference rsDataJet, otherwise, you should reference rsDataADO. Note that only one of these recordset objects will be valid for any given chart. This recordset contains the data that will be charted.

The appropriate recordset is made current by calling the GetChartRecordSet method after all the other data source properties have been set. Note that even though this is a public property that you could set directly, you should not do so. See also: eDataSourceType, sDataSourceFile.

Data Type

Recordset

sAdjAtrLimitsPct Property

This property sets or returns a string representing the percentage by which the subgroup size must change before control limits are adjusted on attributes control charts.

Data Type

String

sAdoOdbcConnect Property

This property sets or returns a string used as the ConnectionString to open the database when the data source is either an ODBC driver or an ADO provider.

Data Type

String

sAdoOdbcName Property

This property sets or returns a string that is the name of an ODBC data source. This is only set for ODBC data sources. For all others it is an empty string.

Data Type

String

sAdoOdbcPassword Property

This property sets or returns a string used as a password when opening a database for either ODBC or ADO. If this is saved with the CHARTrunner file, it is encrypted. However, this property is the plain text version of the password.

Data Type

String

sAdoOdbcUser Property

This property sets or returns a string used as a user login name when opening a database for either ODBC or ADO.

Data Type

String

sAnnotations Property

This packed string holds all the chart annotations that are associated with this chart. Contact PQ Systems if you have a need to define your own chart annotations.

Data type

String

sArsColChangeColName Property

Use this property to set or return a string specifying a column name from the data source. This column name is used in conjunction with the Advanced Row Selection option eArsRowsToLookAt that says to form subgroups whenever the contents of the specified column changes. This must be set to a valid column name for the current data source when eArsRowsToLookAt is set to eCrArsSelectRowsOnColChangeSee also: bArsEnabled.

Data Type

String

sAtrConstNumInspected Property

This property sets or returns a string used as a constant number inspected for np charts (an attributes control chart.) Setting this property to a number allows you create the chart from a data source that does not include a column for storing this number.

Data Type

String

SBottomTitle
sTopTitle Properties

This property sets or returns title strings in an array property. CHARTrunner allows for ten rows of titles above the chart and ten rows of titles below the chart. Further, you may specify a left, center, and right title for each row.  An empty cell may be filled with the "~" (tilde) character to prevent the cell from being collapsed. See also: ClearTitles, sBottomTitleFont, sTopTitleFont.

Data Type

String  (two dimensional array)

Example

Dim oChRunApp As New CHARTrunner30.Application
Dim oCrDef As PQCrDef
Dim bRtn As Boolean

   ' Create a chart definition object.
   Set oCrDef = oChRunApp.CreatePqObject(eObjPQCrDef)

   ' Open a chart definition file.
   bRtn = oCrDef.ReadChartDefinition("C:\MyCharts\Sample 01.crf", eCrPathFull)
  
   oCrDef.sTopTitle(1, 1) = "Top left title"
   oCrDef.sTopTitle(1, 2) = "Top center title"
   oCrDef.sTopTitle(1, 3) = "Top right title"
  
   oCrDef.sBottomTitle(1, 2) = "Bottom center title"
   oCrDef.sBottomTitle(2, 2) = "2nd Bottom center title"

sBottomTitleFont
sTopTitleFont Properties

This property sets or returns strings in an array property that specifies custom fonts for titles in each allowable position. The font name, size, style, and alignment have default values that come from the current chart style. However, this property allows you to override the defaults on a per-title basis. The format for specifying these font strings must be followed precisely, as in the example below. See also: ClearTitles, sBottomTitle, sTopTitle.

Data Type

String  (two dimensional array)

Example

Dim oChRunApp As New CHARTrunner30.Application
Dim oCrDef As PQCrDef
Dim bRtn As Boolean

   ' Create a chart definition object.
   Set oCrDef = oChRunApp.CreatePqObject(eObjPQCrDef)

   ' Open a chart definition file.
   bRtn = oCrDef.ReadChartDefinition("C:\MyCharts\Sample 01.crf", eCrPathFull)

   ' Set a chart title.
   oCrDef.sTopTitle(1, 1) = "Top left title"
                                            
   ' Set the font for the chart title.
   oCrDef.sTopTitleFont(1, 1) = "Arial,18,I,B,C"

The general form of a title font should be:

FontName,Size,italic,bold,alignment

If you want italic, put an I in place of italic, or omit this position.

If you want bold, put a B in place of bold, or omit this position.

For alignment, use L for left, C for center, R for right.

Examples

"Courier,12,C"
"Tahoma,14,B,C"

sChartDefPath Property

This read-only property returns a string specifying the full path to the chart definition. It may not be set directly.

Data Type

String

sChartDefVersion Property

This property returns a string that represents the current CHARTrunner chart definition file version. In the XML chart definition file the file version is stored in the <Version> element under the <General> element.

Data Type

String

sChartName Property

This property sets or returns a string specifying the name of the chart. This is the name as it will appear to a CHARTrunner user.

Data Type

String

sChartStyleName Property

Use this property to set or return a string specifying the name of the style to be used for this chart. This can be an empty string but the default appearance of most charts will probably encourage you to set this to the name of an existing chart style. This is the style name as it appears to the CHARTrunner user. Note that all chart style definitions are stored in the Sysdata folder where CHARTrunner is installed. This property is usually set only to the style name; however you can specify a full path to a style definition.

Data Type

String

sChartStylePath Property

The Read-Only property returns the full path to the style definition for the chart.

Here are the rules for where CHARTrunner looks for a style definition:

  1. If no style name has been specified, then use a style definition in the chart folder having the same name as the chart definition, if it exists. This is the "per-chart" style definition.

  2. If a style name has been specified, and it specifies the full path to the style definition, then use it.

  3. If a style name has been specified, but it doesn't specify the full path, then assume the style definition is found in the chart folder. If found, then use it.

  4. If a style name has been specified, but it doesn't specify the full path, and it wasn't found by Rule #3, then assume the style definition exists in the CHARTrunner Styles folder.

  5. If no style definition was found by any of the preceeding rules then a zero length string is returned.

Data type

String

sChartType Property

This is a read-only property that returns a string specifying the chart type. It is set automatically when the eChartType property is set to a valid chart type. This provides a human readable chart type such as X-bar and Range.

Data Type

String

sDataSourceFile Property

Set or return a string specifying a file name to use for the data source. If the chart refers to data in an Excel spreadsheet or Access database, this will be the full path to the data file. For some data sources such a text files, FoxPro, and Paradox, this will contain only a full path to the folder that contains one or more of the appropriate files.

Data Type

String

sDataSourceType Property

This property is obsolete but still supported. In its place the eDataSourceType and eJetDataType should be used.

Use this property to set or return a string specifying a data source type. The data source type must be one of the following:

"Microsoft Access"

"Microsoft Excel"

"Text File"

"FoxPro"

"Paradox"

"Dbase"

"ODBC; Open database connectivity"

"ADO; OLE DB provider"

"ADO; XML recordset"

Data Type

String

sDateFormat Property

Sets or returns a string that defines how to format a date when it is displayed. This will be passed into the Visual Basic Format() function as its second argument.

Data type

String

sDescription Property

Use this property to set or return a string specifying a description for the chart. This is the description as it will appear to a CHARTrunner user.

Data Type

String

sImageFileName Property

Sets or returns a string that is the full path/file name for the image file to be created when this chart is saved as a graphic image file. See also SaveChartAsImage.

Data Type

String

sLastError Property

A read-only property. When any method of the PQCrDef object returns False to indicate that it failed, check this property for a description of errors which may have occurred.

Data Type

String

sLowerSpec
sTargetSpec
sUpperSpec  Properties

Use this property to set or return a string that represents a specification related to the characteristic being charted. These are usually engineering specifications or tolerances. Although these are string properties, they should be set to string versions of numeric values that represent the specifications. The values of these properties affect several statistics related to histograms and capability analysis.

Data Type

String

sLeftTitle
sRightTitle Properties

This property sets or returns a string to be used as a chart title positioned vertically on either the left or right side of the chart.

Data Type

String

sOrderByColName Property

This property sets or returns a string that names the Order By column in the data table. This column will be used in the ORDER BY clause when selecting records from a table. This property is meaningful only when eRecSelectType is set to eCrRecSetTable.

Data Type

String

sParBarCountCutoff Property

This property sets or returns a string that determines how many bars (categories) will be included in a Pareto chart. Setting this to “10” will create a chart showing only the first 10 categories (based on count) that appear in the data. The purpose of a Pareto chart is to help focus on the most common problems. Note that setting this option may make it appear that not all the data from your data source is included in the analysis. See also: eLimitParBarsBy, bParetoIncludeMissingBar, bParetoCountMissing, sParBarPercentCutoff.

Data Type

String

sParBarPercentCutoff Property

This property sets or returns a string that determines a percentage at which a Pareto chart will be cut off. Setting this to “80%” will create a chart where only the top 80% of the categories (based on count) will be shown. See also: eLimitParBarsBy, bParetoIncludeMissingBar, bParetoCountMissing, sParBarPercentCutoff.

Data Type

String

sParentChartDef Property

Returns the full path to the parent chart definition file.  If the PQCrDef object specifies a child chart of a Workspace or MultiChart then return the full path to the Workspace/MultiChart chart definition, otherwise return sChartDefPath.

Data type

String

sResultRecSelectN Property

This property is used in conjunction with the eResultRecSelectType property to specify N, the number of data points to display on the chart, when eResultRecSelectType is set to eUseFirstN or eUseLastN.

This property corresponds to the Result records to include field on the Data definition tab.

The number of data points to display on the chart is determined after any filtering or Advanced Row Selection processing has been applied to the data.

Data Type

String

sSqlBracketLeft Property

Specifies the left-side character to be used to enclose or bracket database object names.  See also: bUseBracketsInSql, sSqlBracketRight

Data type

String

sSqlBracketRight Property

Specifies the right-side character to be used to enclose or bracket database object names.  See also: bUseBracketsInSql, sSqlBracketLeft.

Data type

String

sSqlSelect Property

This property sets or returns a string that contains the SQL SELECT statement used to fetch data for the chart. When eRecSelectType is set to eCrRecSetCustomQuery use this property to specify the SQL SELECT statement that will be used for the custom query. When eRecSelectType is set to something other than eCrRecSetCustomQuery this property should be ignored.

Data Type

String

sTableName Property

This property sets or returns the name of the Table (when eRecSelectType = eCrRecSetTable), Query or view (when eRecSelectType = eCrRecSetNamedQuery) or Stored procedure (when eRecSelectType = eCrRecSetStoredProc) used to fetch data from the data source.

Data Type

String

sTimeFormat Property

Sets or returns a string that defines how to format a time when it is displayed. This will be passed into the Visual Basic Format() function as its second argument.

Data type

String

sXmlDefinition Property

Returns the XML chart definition currently defined by the PQCrDef object.

Data type

String

 


PQCrDef Methods

AddExtraLine Method

Syntax

Public Function AddExtraLine(ByVal eType As pqEnumExtraLineType, _

   ByVal eCollectionType As ELCollectionEnum, _

   Optional ByVal sLineLabel As String, Optional ByVal dLinePosition As Double, _

   Optional ByVal eHowToLabel As pqEnumHowToLabelLines = eLabelLinesNameOnly) _

   As PQCrExtraLine

Remarks

Create a PQCrExtraLine "extra line" of the type specified by 'eType' and place it in the appropriate collection as specified by 'eCollectionType'.

This routine can be used to add an "extra line" to the chart definition. If the caller wishes to set any "extra line" parameters that are not handled by this routine then he is free to do so using the returned reference to the "extra line" object.

If eType = eExtraLineTypeCustom then 'dLinePosition' must be present to specify the Y-axis position of the line. No checking is done, it is the caller's responsibility to provide an appropriate value. Also, the custom line can be optionally labeled with the 'sLineLabel' text.

This routine is used in the CHARTrunner code for adding "extra lines" defined in chart definitions prior to 2.0. But it can also be used by SDK programmers to add "extra lines".

Returns

True = Success.
False = Failure (see sLastError).

ClearTitles Method

Clears all chart titles from the chart definition.

Syntax

Public Sub ClearTitles()

Display Method

Display the chart defined by the PQCrDef chart definition in a chart window.

Use this method after you have called the ReadChartDefinition method (to read all the chart's properties from a chart definition) or after you have defined the chart definition in PQCrDef in code.

Syntax

Public Function Display(Optional ByVal bShowModal As Boolean = False, _
   Optional ByVal bReadOnly As Boolean = False, _
   Optional ByVal bReview As Boolean) As Boolean

Remarks

When the chart is displayed the user may use the Edit > Chart definition menu to alter the definition of the chart. They may also highlight subgroups and compute new sets of control limits. 

If you prefer that the user only view the chart and not have the ability to change it, set the bReadOnly argument to True. 

Set the bShowModal argument to True so that the chart display form is displayed modally. Some scripting environments do not allow a non-modal form to be displayed.

If the chart definition is a Workspace, a new chart display window will be created for each child chart in the Workspace unless bReview is True, in which case only the first child chart is displayed in a new chart window, and the rest of the charts in the Workspace may be viewed via "Chart Review".  If the chart definition is not a Workspace, bReview is True, and the PeerChartList property specifies a list of peer charts, then "Chart Review" will operate in the context of the peer charts specified by PeerChartList.

Returns

True = Success.
False = Failure (see sLastError).

Edit Method

Display a form which allows the user to modify the chart definition defined by this PQCrDef object. 

Syntax

Public Function Edit(Optional ByVal eEditMode As CrEditModeEnum = eCrEditExistingDef, _
   Optional ByVal bAllowNameChange As Boolean = True) _
   As Boolean

Remarks

The eEditMode parameter specifies whether a new chart, a copy of an existing chart, or an existing chart is being edited. For a new chart, or a copy of an existing chart, the user is prevented from giving the chart definition the same name as a currently existing chart definition.

Set bAllowNameChange to True if you want to allow the user the ability to change the name of the chart. 

See bChangedDuringEdit to determine if the user changed the chart definition during this edit session. See bChanged to determine if this chart definition has been changed since ReadChartDefinition or Initialize was last called.

See Me.bCanceledByUser to determine if the user canceled the edit.

Note: This routine does not save any changes to disk. If you intend to save changes to the disk, call the SaveChartDefinition method when Edit returns a True for bDidChartChange. If this method returns False, examine sLastError for details. See also: Validate.

Returns

True = Success.
False = Failure (see sLastError).

GetChartRecordset Method

Generally speaking, this method should not be used by Software Developer's Kit programmers.  It is called internally by other methods such as Display and PrintChart. This method retrieves the recordset that will be used for the chart, based on several related properties. If successful, then either rsDataADO or rsDataJET will contain the newly created recordset.  If a parameter query is used in the chart's data source, and the user cancels on the "Parameter Query" form, then the bCanceledByUser property will be set to True and False is returned. See also: eDataSourceType, sDataSourceFile, sTableName, UseExternalRecordset.

Syntax

Public Function GetChartRecordSet() As Boolean

Returns

True = Success.
False = Failure (see sLastError).

GetDataObject Method

Return a reference to the "Data Object" for the chart so that you can access chart statistics.

Syntax

Public Function GetDataObject(Optional ByVal iChartNumber As Integer = 1, _
   Optional ByVal iLineNumber As Integer = 1) As Object

Remarks

If the current chart is a Multi-Chart, then use iChartNumber argument to get the "Data Object" for the appropriate child chart of the Multi-Chart.

Use the iLineNumber argument to specify which line of a Multi-Line chart to use.

If the current chart is a Workspace, then Nothing is returned.

If bKeepDataObjects is True, then calling PrintChart() or SaveChartAsImage() causes the PQCrDef to save a reference to the temporary "Data Object" that was used to render the chart, so that this routine can return a reference to that "Data Object".

If bKeepDataObjects is False, or no previous call to PrintChart() or SaveChartAsImage() has been performed, then a new "Data Object" is created for the chart so that the "Data Object" reference can be returned.

Note that if the last charting operation was Display() then the GetDataObject() method will always return a reference to a new "Data Object" because the "Data Object" that is used to display the chart form is destroyed when the chart form is closed.

The type of the returned "Data Object" depends upon the type of chart.  For an attributes chart a PQCountData object is returned.  For a pareto chart a PQCategoryData object is returned.  For a scattergram a PQCorrelationData object is returned.  All other chart types, including control, multi-line, and histogram, return a PQMeasurementData object. See Interface_PQDM.html for more information about the chart statistic properties for each type of "Data Object".

This method is available in version 1.6.68 and higher.  See the VBScript example file Sample9.vbs for an example of using bKeepDataObjects and GetDataObject() to gain access to chart statistics.

Returns

Reference to the "Data Object".
Nothing = Failure (see sLastError).

SrcColDefsCollection Method

Build a collection containing one PqCrColDef object for each column in the current chart data source.

If cCols is passed by the caller, then that collection will be updated and bSrcColDefsCurrent will NOT be changed.  Otherwise the cSrcColDefs collection will be updated and bSrcColDefsCurrent will be updated to reflect that the collection is current.
 

Syntax

Public Function GetSrcColDefsCollection( _
   Optional ByRef cCols As Collection = Nothing) As Boolean

Returns

True = Success.
False = Failure (see sLastError).

GetStatisticValue Method

Calculate the statistic specified by 'eStatistic' from the chart defined by 'Me' and return the statistic value.

If the statistic cannot be calculated for the chart specified by 'Me' then MISSING_FLOAT will be returned. However, if an error occurs, an error will be raised back to the caller.

See Me.bCanCalculateStatistic(eStatistic) to determine if 'eStatistic' can be calculated for the chart definition in 'Me'.

Syntax

Public Function GetStatisticValue(ByVal eStatistic As pqEnumChartStat) As Double

Returns

The calculated statistic value.
MISSING_FLOAT = The statistic cannot be calculated for the chart in 'Me'.

GetStatisticAsText Method

Fetch the statistic specified by 'eStatistic' from the chart defined by 'Me' and return the statistic value as a string.

If 'iDecimalDigits' is defined then format the returned statistic string using the specified number of decimal digits, else use the chart's default number of decimal digits for the statistic.

See Me.bCanCalculateStatistic(eStatistic) to determine if 'eStatistic' can be calculated for the chart definition in 'Me'. If 'eStatistic' cannot be calculated, then a zero-length string will be returned.

Syntax

Public Function GetStatisticAsText(ByVal eStatistic As pqEnumChartStat, _
Optional ByVal iDecimalDigits As Integer = -1) As String

Returns

Statistic value as a string.
"" = Inappropriate 'eStatistic' was specified for this chart.

Initialize Method

Initialize the properties of this PQCrDef object to the "New Chart Definition" state.

Syntax

Public Sub Initialize()

PrintChart Method

Print the chart defined by this PQCrDef chart definition.

When printing a Multi-Chart where you want each chart to print on its own page, set bPrnMCSep to True.

To print without displaying the printer dialog box, set bPrinterDialog to False.

Specify the name of the output printer to use in sPrinterName. If sPrinterName is not specified then the default CHARTrunner printer will be used if it has been defined, else the default windows printer will be used.

If the user cancels while on the printer dialog then Me.bCanceledByUser = True and Me.eCanceledMode = eCrCancelPrinting and False is returned.

Syntax

Function PrintChart(Optional ByVal bPrnMCSep As Boolean = False, _
    Optional ByVal bPrinterDialog As Boolean = True, _
    Optional ByVal sPrinterName As String) As Boolean

Returns

True = Success.
False (with Me.bCanceledByUser = True) = User canceled the print operation.
False (with Me.bCanceledByUser = False) = Error (see Me.sLastError).

ReadChartDefinition Method

Read the chart definition specified by sChartDef from the disk and update the properties of this PQCrDef object.

Syntax

Public Function ReadChartDefinition(ByVal sChartDef As String, _
   Optional ByVal ePathType As CrPathTypeEnum = eCrPathRelative, _
   Optional ByVal sParentChartDef As String, _
   Optional ByVal iChildChartNum = 1) _
   As Boolean

Remarks

Depending on ePathType we treat sChartDef either as the name of a chart definition in the current working folder or the full path for a chart definition file.

If sChartDef specifies a child chart of a parent MultiChart or Workspace then both sParentChartDef and iChildChartNum should be specified. sParentChartDef specifies the full path to the parent MultiChart or Workspace chart definition file. iChildChartNum (having a value of 1 to N) specifies the index of this child chart in the parent MultiChart or Workspace.

Returns

True = Success.
False = Failure (see sLastError).

ReadStyle Method

Read the style properties from sStyleDef into the appropriate style object. Note that sStyleDef can specify either the full path to a style definition or it may contain an XML style definition string. Depending on style type, this method will store the style definition into the oControlChartStyle, oHistogramStyle, or oParetoStyle object. See also: ReadStyleDefinition.

Syntax

Public Function ReadStyle(ByVal sStyleDef As String) As Boolean

Remarks

sStyleDef can specify the full path to an XML or INI formatted style definition file (.CSC, .CSH or .CSP).  Or, it can contain the XML style definition.

Returns

True = Success.
False = Failure (see sLastError).

ReadStyleDefinition Method

Read the contents of the CHARTrunner chart style definition specified by sStyleDef into the appropriate chart style object in this PQCrDef. Depending on chart type, this method will store the style definition into the oControlChartStyle, oHistogramStyle, or oParetoStyle object. Note that if the sChartStyleName property is already set when the ReadChartDefinition method is called, this method will be automatically called. See also: ReadStyle, SaveStyleDefinition.

Syntax

Public Function ReadStyleDefinition(ByVal sStyleDef As String, ByVal ePathType As CrPathTypeEnum) As Boolean

Returns

True = Success.
False = Failure (see sLastError).

ReadOocDefinition Method

This method reads out-of-control test definitions from sOocPath into Me.oOocTests.

An out-of-control test file is a text file containing out-of-control test rules. Here is an example of an out-of-control test rule:

1 Point beyond limits

This means that if a data point is beyond the control limits (on a control chart) it will be considered an “out-of-control” data point. Several example OOC files can be found in the SysData folder where CHARTrunner is installed.

Syntax

Public Function ReadOocDefinition(ByVal sOocPath As String) As Boolean

Remarks

If sOocPath exists and contains valid out-of-control test rules, the test rules will replace any out-of-control test rules stored in Me.oOocTests.

In CHARTrunner the user can choose Setup > Out-of-control tests to set the active set of test rules; these rules are stored in the CHARTrunner30.Application.oOocTests property.  In CHARTrunner 1.1 this set of test rules was applied to all control charts when the chart was drawn.  

Starting in CHARTrunner 1.5 the active set of test rules is copied into the PQCrDef.oOocTests property when a PQCrDef object is created. Also, the Boolean CHARTrunner30.Application.bUseMasterOocTests is copied into PQCrDef.bUseMasterOocTests when a PQCrDef object is created.

If PQCrDef.bUseMasterOocTests is False then the test rules stored in PQCrDef.oOocTests are used to evaluate "out-of-control" conditions when a chart is drawn. If a chart definition file doesn't contain any test rules (e.g. a CHARTrunner 1.1 chart definition) then the rules from CHARTrunner30.Application.oOocTests will apply to the chart (because these rules were copied into PQCrDef.oOocTests when the PQCrDef object was created and were never replaced by rules from the chart definition).

If PQCrDef.bUseMasterOocTests is True then the test rules stored in CHARTrunner30.Application.oOocTests are used to evaluate "out-of-control" conditions when a chart is drawn.

See also: CHARTrunner30.Application.ReadOocDefinition.

Returns

True = Success.
False = Failure (see sLastError).

ReadXmlDefinition Method

Read and parse the XML chart definition in sXml.

Syntax

Public Function ReadXmlDefinition(ByVal sXml As String) As Boolean

Remarks

sXml can specify the URL to the XML chart definition, or it can contain the XML chart definition. If "<" is found at the beginning of sXml then it is assumed that it contains the XML chart definition rather than pointing to it. This results in the properties of this PQCrDef object being updated as the elements of sXml are parsed.

The XML does not have to specify a complete chart definition. For example, it might only specify the chart type.

Returns

True = Success.
False = Failure (see sLastError).

SaveChartAsClipChart Method

Save the current chart definition in this PQCrDef object as a clipCHART file specified by sClipChartPath.

Syntax

Public Function SaveChartAsClipChart(ByVal sClipChartPath As String) As Boolean

Remarks

This method is similar to the CHARTrunner30.Application.SaveChartAsClipChart method, however that method can only create a clipCHART from a chart definition on disk.  The PQCrDef.CreateClipChart method creates a clipCHART based upon the chart definition currently specified by the PQCrDef object (i.e. Me).

Example

Dim bRtn As Boolean
Dim oChRunApp As New CHARTrunner30.Application
Dim oCrDef As PQCrDef

' Create a chart definition object.
Set oCrDef = oChRunApp.CreatePqObject(eObjPQCrDef)

' Read the chart definition file.
bRtn = oCrDef.ReadChartDefinition("C:\MyCharts\Sample 01.crf", eCrPathFull)

' Specify some chart titles so that the chart definition in oCrDef is different
' from that in "C:\MyCharts\Sample 01.crf".
oCrDef.sTopTitle(1, 2) = "Example clipCHART Created using PQCrDef.CreateClipChart"
oCrDef.sTopTitleFont(1, 2) = "Arial,14,B,C"
oCrDef.sTopTitle(2, 2) = "~"
oCrDef.sBottomTitle(2, 2) = "~"
oCrDef.sBottomTitle(3, 2) = "http://www.chartrunner.com"
oCrDef.sBottomTitleFont(3, 2) = "Arial,14,B,C"
  
' Generate a clipCHART having the custom titles we specified above.
bRtn = oCrDef.CreateClipChart("C:\MyCharts\Sample 01.ccf")

Returns

True = Success.
False = Failure (see sLastError).

SaveChartAsImage Method

Generate an image file based this PQCrDef chart definition.

eImageType specifies the type of image requested.

sImageFile is the filename to use for saving the image file. If it specifies a relative path, then the image will be generated relative to the location of the chart definition file. If it specifies only a folder, then the image will be generated in that folder using the default image filename or the chart name if no image filename is specified in sImageFileName.

lWidthInPixels and lHeightInPixels define the size of the image in pixels. If zero, then the chart default width (see lDefaultImageWidth) or height (see lDefaultImageHeight) will be used.

This function DOES NOT handle a chart Workspace. Use Application.SaveWorkspaceImages() for Workspaces.

Syntax

Public Function SaveChartAsImage(ByVal eImageType As CrImageTypeEnum, _
   ByVal sImageFile As String, _
   Optional ByVal lWidthInPixels As Long = 0, _
   Optional ByVal lHeightInPixels As Long = 0) As Boolean

Returns

True = Success.
False = Failure (see sLastError).

Remarks

Note that a PQCrDef object has properties that you may use as the arguments to this method. For example:

Example 

Dim bRtn As Boolean
Dim oChRunApp As New CHARTrunner30.Application
Dim oCrDef As PQCrDef

' Create a chart definition object.
Set oCrDef = oChRunApp.CreatePqObject(eObjPQCrDef)

' Read the chart definition.
bRtn = oCrDef.ReadChartDefinition("C:\MyCharts\Sample 01.crf", eCrPathFull)
  
' Generate the image as a PNG file.
bRtn = oCrDef.SaveChartAsImage(eCrImagePng, "C:\MyImages\Sample 01.png", 640, 480)

SaveChartAsWebPage Method

Save the chart definition defined by the PQCrDef object as a web page.

The configuration of the web page is defined by the properties of oPage. If oPage is not passed into this method, then the chart's default web page parameters in Me.oWebPage are used (which correspond to the settings on the Misc > Web Page Defaults tab of the chart definition).

Syntax

Public Function SaveChartAsWebPage(Optional ByVal oPage As PQCrWeb = Nothing) _
   As Boolean

Returns

True = Success.
False = Failure (see sLastError).

Example 

Dim bRtn As Boolean
Dim oChRunApp As New CHARTrunner30.Application
Dim oCrDef As PQCrDef
Dim oPage As PQCrWeb

' Create a chart definition object.
Set oCrDef = oChRunApp.CreatePqObject(eObjPQCrDef)

' Create a web page definition object.
Set oPage = oChRunApp.CreatePqObject(eObjPQCrWeb)

' Read the chart definition.
bRtn = oCrDef.ReadChartDefinition("C:\MyCharts\Sample 01.crf", eCrPathFull)
  
' Get a copy of the web page defaults from the chart definition.
Call oCrDef.oWebPage.CopyTo(oPage)

' Set the default output path where the web page will be created.
' Since the output path doesn't specify the name of the HTML document
' it will default to the chart definition name.
oPage.sWebPagePath = "C:\InetPub\wwwroot\CHARTrunner\WebPages\"
  
' Copy the chart's current default image size into 'oPage' so that the
' user can see what size the chart image will default to.
If oPage.lImageHeight = 0 Then
   oPage.lImageHeight = oCrDef.lDefaultImageHeight
End If
If oPage.lImageWidth = 0 Then
   oPage.lImageWidth = oCrDef.lDefaultImageWidth
End If
  
' Allow the user to edit the "Web Page" parameters in oPage.
bRtn = oPage.Edit()

If bRtn Then
   ' User didn't cancel, so save the chart as a web page.

   ' Save the chart as a web page using the web page parameters in oPage.
  bRtn = oCrDef.SaveChartAsWebPage(oPage)
End If

SaveChartDefinition Method

Save the XML chart definition defined by this PQCrDef to the definition path specified by the sChartDefPath property.

It is recommended that you successfully call the Validate method before calling SaveChartDefinition. The Validate method returns False if any errors occur, in which case check the contents of sLastError for details.

Syntax

Public Function SaveChartDefinition() As Boolean

Returns

True = Success.
False = Failure (see sLastError).

SaveChartDefinitionAs Method

Save the XML chart definition defined by this PQCrDef to the path specified by sSaveChartAs.

If bSaveAsCopy is True then the Me.sChartName and Me.sChartDefPath properties are not updated to reflect saved chart definition; in this case sSaveChartAs is truly a copy of the current chart definition. If bSaveAsCopy is False then both Me.sChartName and Me.sChartDefPath are updated to reflect the newly saved chart definition.

Syntax

Public Function SaveChartDefinitionAs(ByVal sSaveChartAs As String, _
   Optional ByVal bSaveAsCopy As Boolean = True) _
   As Boolean

Returns

True = Success.
False = Failure (see sLastError).

SaveChartPosition Method

Save the chart window size and position information to the XML chart definition file specified by sParentChartDef.

When a chart window is closed the size and postion of the window is saved to the XML chart definition so that the next time the chart is displayed it will use the same chart window size and position. 

This method is automatically called by CHARTrunner when a chart display window is closed.

Syntax

Public Function SaveChartPosition() As Boolean

Returns

True = Success.
False = Failure (see sLastError).

SaveStyleDefinition Method

Save the current style properties in this PQCrDef object to the style definition specified by sStyle.

Syntax

Public Function SaveStyleDefinition(ByVal sStyle As String, _
   Optional ByVal ePathType As CrPathTypeEnum = eCrPathRelative) _
   As Boolean

Remarks

sStyle specifies the name of a style in the Styles folder or the full path to a style file.

If ePathType = eCrPathRelative then sStyle specifies the name (only) of a style in the Styles folder. 

If ePathType = eCrPathFull then sStyle specifies the full path to the style definition.

Depending on the type of chart currently defined by this PQCrDef object the style definition will be written from one of these style objects: oControlChartStyle, oHistogramStyle, or oParetoStyle.  See also: ReadStyleDefinition

Returns

True = Success.
False = Failure (see sLastError).

SendChartImageAsEmail Method

E-mail an image file of the chart(s) defined by Me to the specified destination addresses.

Syntax

Public Function SendChartImageAsEmail(Optional ByVal bInteractive As Boolean = True, _
   Optional ByVal sFrom As String, Optional ByVal sTo As String, _
   Optional ByVal sCc As String, Optional ByVal sSubject As String, _
   Optional ByVal sMessage As String, _
   Optional ByVal eImageType As CrImageTypeEnum = eCrImageJpg, _
   Optional ByVal lWidthInPixels As Long = 0, _
   Optional ByVal lHeightInPixels As Long = 0) _
   As Boolean

Remarks

If bInteractive is True then allow the user to specify or change the parameters via a dialog, otherwise just attempt to send the e-mail using the specified input parameters. If an input parameter is not specified then use the default from the chart definition in Me. If the image file type is not valid (not .jpg, .bmp, etc.) then it will default to the last used image type (eCrImageJpg if no previous interactive image type has been specified). If bInteractive is True and the user clicks Cancel on the form then return False with Me.bCanceledByUser = True.

Multiple e-mail addresses must be separated by a comma, e.g. "a@abc.com,b@abc.com". At least one destination e-mail address must be specified.

If the chart definition in Me specifies a Workspace then all child chart image files will be sent as attachments in a single e-mail message. If an error is encountered while generating a child chart image then False will be returned but the e-mail will still be sent if possible. If bInteractive is True then a progress bar will be displayed as the child chart images are generated.

Returns

True = Success.
False = Failure (see sLastError).

UseExternalRecordset Method

Setup the PQCrDef object to use the programmer supplied recordset specified by rsExtData as the source of the chart's data. rsExtData may specify either an ADO or DAO recordset.  It is the programmer's responsibility to properly setup the cColDefs collection when an external recordset is specified so that the columns of the recordset are properly mapped.  If rsExtData is Nothing then the chart will not use an external recordset.

When an external recordset is specified as the source of records for the chart, this method will set eRecSelectType to eCrRecSetExternal. See also: bUseExternalRecordset, cColDefs, eRecSelectType

Syntax

Sub UseExternalRecordset(ByVal rsExtData As Object)

Remarks

The rsExtData parameter was changed to ByVal for better scripting compatibility in version 1.6.68 and higher.

Validate Method

Check to see if the current chart definition is valid.

It is a good idea to use this method to validate a chart definition before writing it to disk.

The parameters to this method changed in 2.0. They now are the same as the Validate2() method that existed in 1.7, however the Validate2() method has been deleted in 2.0. These changes were made so that there is a single Validate() method that can be called from script code.

Syntax

Public Function Validate(Optional ByVal bCheckDuplicateName As Boolean = False, _
    Optional ByVal bCheckRecordset As Boolean = False) As Boolean

Remarks

bCheckDuplicateName (Input) If True, then do not allow duplicate chart definition names in the current chart folder.
bCheckRecordset (Input) Verify that the recordset can be fetched and is valid.

Returns

True = Chart definition is valid.
False = Chart definition is not valid (see Me.eValidationError for the error condition and Me.sLastError for the error message).

ValidateCustomQuery Method

Execute the custom query defined in the PQCrDef object in order to validate it.

Syntax

Public Function ValidateCustomQuery() As Boolean

Returns

True if the query appears to be valid.
False if any query errors occur (see sLastError).

 


CHARTrunner Charting Control Properties

bAllowEditing Property

Returns/sets a value that determines whether the chart definition can be edited.

Data type

Boolean

bAllowNameChange Property

Returns/sets a value that determines whether the chart name can be changed.

Data type

Boolean

bAutoUpdateChartDef Property

Returns/sets a value that determines whether the chart definition is automatically saved after an edit session.

The default value of bAutoUpdateChartDef is False.

The primary reason this property was added starting with version 2.0.99 was to automatically save the chart definition back to the disk after an edit session when using the CHARTrunner Charting Control on a web page in Internet Explorer.

If bAutoUpdateChartDef is True when the chart definition is edited via a call to EditChart() or via the user right-clicking on the charting control and selecting Edit Chart Definition, then if the user ends the edit session by clicking the OK button the chart definition changes are immediately and automatically saved back to the chart definition file, and the bChartDefinitionChanged property will be False (because the chart definition is no longer in a changed state).

Data type

Boolean

bChartDefinitionChanged Property

Returns/sets the flag that indicates whether the chart definition has been changed during an edit session.

If this property is True then the chart definition contains changes that have not yet been saved back to the storage system via SaveChartChanges().

Data type

Boolean

sLastError Property

This property may be examined for a description of the last error that occurred.

Many methods return a Boolean value. When the return value of False indicates an error the error description is available in sLastError.

Data type

String 


CHARTrunner Charting Control Methods

SaveChartChanges Method

Save the changed chart definition(s) associated with this chart.

If a Multi-chart is being displayed, then any child chart definitions of the Multi-chart that have been edited will be saved to the storage system.

If the chart definition(s) are successfully saved then bChartDefinitionChanged is set to False.

Syntax

Public Function SaveChartChanges() As Boolean

Returns

True = Success.
False = Failure (see sLastError, plus the user will be notified via a message box about the error).

 


CHARTrunner Charting Control Events

The events raised by the CHARTrunner Charting Control are typically not used by application programmers, so they will not be documented.


Other Definitions

CrCanceledEnum Enumeration

Public Enum CrCanceledEnum
   eCrCancelDialog
   eCrCancelPrinting
   eCrCancelQueryParameters
End Enum 'CrCanceledEnum'

CrChartTypeEnum Enumeration

Public Enum CrChartTypeEnum
   eCrTypeNone = -1
   eCrTypeXbarRange = 0
   eCrTypeXbarSigma = 1
   eCrTypeIndMovRange = 2
   eCrTypeIndMovSigma = 3
   eCrTypeMovAvgMovRange = 4
   eCrTypeXbar = 5
   eCrTypeRange = 6
   eCrTypeSigma = 7
   eCrTypeInd = 8
   eCrTypeMedian = 9
   eCrTypeRun = 10
   eCrTypeHistogram = 11
   eCrTypePchart = 12
   eCrTypeNPchart = 13
   eCrTypeCchart = 14
   eCrTypeUchart = 15
   eCrTypeParetoBar = 16		' eCrTypePareto prior to version 2.0.
   eCrTypeScatter = 17
   eCrTypeMultiLine = 18
   eCrTypeCusum = 19
   eCrTypeThreeWay = 20
   eCrTypeMovAvg = 21
   eCrTypeShortRunDiffMR = 22
   eCrTypeShortRunZedW = 23
   eCrTypeShortRunZedStarWStar = 24
   eCrTypeShortRunDiffXbarR = 25
   eCrTypeShortRunZedBarW = 26
   eCrTypeShortRunZedBarStarWStar = 27
   eCrTypeShortRunMeanRanges = 28
   eCrTypeBoxAndWhisker = 29
   eCrTypeParetoColumn = 30
   eCrTypeParetoPie = 31
   eCrTypeGchart = 32
   eCrTypeTchart = 33
End Enum 'CrChartTypeEnum'

CrDataSourceTypeEnum Enumeration

Public Enum CrDataSourceTypeEnum
   eCrDataSourceTypeJet = 1
   eCrDataSourceTypeODBC = 2
   eCrDataSourceTypeAdo = 3
   eCrDataSourceTypeAdoXML = 4
End Enum 'CrDataSourceTypeEnum'

CrDefValidateErrorEnum Enumeration

Public Enum CrDefValidateErrorEnum
   eCrAdvRowInvalidN1
   eCrAdvRowMismatchOrderGroupBy
   eCrAttributesAmbiguousNumInsp
   eCrAttributesCchartCountColInvalid
   eCrAttributesInvalidCountCol
   eCrAttributesMultipleNumInspColumns
   eCrAtrributesNoNumInspDefined
   eCrBwAdvRowSelectGrouping
   eCrChartImageFilenameReqd
   eCrChartImageSizeTooSmall
   eCrChartInvalidName
   eCrChartInvalidLastN
   eCrChartInvalidSpecs
   eCrChartNameDuplicate
   eCrChartNameMissing
   eCrChartNeedsMoreThanOneObs
   eCrChartMaxMeasureColsExceeded
   eCrChartMultipleCauseNoteCols
   eCrChartNoColumnsMapped
   eCrChartNoMeasurementColumns
   eCrChartOrderByColumnNotMapped
   eCrChartRefreshIntervalTooShort
   eCrChartTooManyLimitsWithNoOrderBy
   eCrCusumInvalidParameter
   eCrDataInvalidCountColumn
   eCrDataInvalidPercentColumn
   eCrDataInvalidRatioColumn
   eCrDataInvalidVariableNumInsp
   eCrDataNoRecordsReturned
   eCrDataFailedToGetRecordSet
   eCrHistogramInvalidCells
   eCrHistogramInvalidDefectsPerValue
   eCrHistogramInvalidNumCells
   eCrHistogramInvalidYMax
   eCrHistogramMovingNErr
   eCrHistogramNoMeasureCols
   eCrHistogramSigmaShiftValueInvalid
   eCrHistogramSigmaShiftValueRequired
   eCrIndivChartInvalidColumns
   eCrIndivChartInvalidMovingN
   eCrMultiChartInvalidTileSettings
   eCrMultiLineInvalidColumns
   eCrMultiLinePlotValueInvalid
   eCrMultiLinePlotValueNotSet
   eCrInvalidCauseColumn
   eCrInvalidCustomYScale
   eCrInvalidDecimalDigits
   eCrParetoGroupByColumnNotPermitted
   eCrParetoMultipleCategoryColumns
   eCrParetoMultipleGroupByColumns
   eCrParetoNeedCategoryOrCountColumn
   eCrScatterInvalidColumns
   eCrShortRunOnlyOneProduct
   eCrShortRunOnlyOneTarget
   eCrShortRunProductRequired
   eCrShortRunReq1Subgroup                      ' n=1 required.
   eCrShortRunReqMultiSubgroups                 ' n>1 required.
   eCrShortRunTargetRequired
   eCrShortRunUserEnteredTargets
   eCrShortRunUserSpecifiedAndTargetColumn
End Enum 'CrDefValidateErrorEnum'

CrPathTypeEnum Enumeration

Public Enum CrPathTypeEnum
   eCrPathFull = 1
   eCrPathRelative = 2
End Enum 'CrPathTypeEnum'

CrEditModeEnum Enumeration

' CrEditModeEnum = Used by Me.Edit() to determine what mode of
' chart editing is taking place.
Public Enum CrEditModeEnum
   eCrEditExistingDef
   eCrEditNewDef
   eCrEditCopyOfDef
End Enum 'CrEditModeEnum'

CrImageTypeEnum Enumeration

Public Enum CrImageTypeEnum
   eCrImageJpg = 1 ' JPEG image.
   eCrImageBmp = 2 ' Bitmap image.
   eCrImageEmf = 3 ' Windows enhanced metafile.
   eCrImagePng = 4 ' Portable network graphic.
End Enum 'CrImageTypeEnum'

CrTreatColAsEnum Enumeration

' CrTreatColAsEnum = How a column is treated in the data recordset.
Public Enum CrTreatColAsEnum
   eCrColUnMapped = 0
   eCrColCategories = 1          ' Pareto.
   eCrColCause = 2               ' Cause (many charts).
   eCrColCount = 3               ' Attribute & Pareto.
   eCrColData = 4                ' Box & Whisker.
   eCrColData1 = 5               ' Multi-Line.
   eCrColData2 = 6               ' Multi-Line.
   eCrColData3 = 7               ' Multi-Line.
   eCrColData4 = 8               ' Multi-Line.
   eCrColDependentVar = 9        ' Scattergram.
   eCrColGroupBy = 10            ' Pareto.
   eCrColId = 11                 ' Identifier (all charts).
   eCrColIgnore = 12             ' Ignore (all charts).
   eCrColIndependentVar = 13     ' Scattergram.
   eCrColMeasurement = 14        ' Observation (Variables, Histogram).
   eCrColNote = 15               ' Note (many charts).
   eCrColNumInspected = 16       ' Attributes (P, NP, U).
   eCrColOrderBy = 17            ' Never used in any version.
   eCrColPercent = 18            ' Attributes (P).
   eCrColRatio = 19              ' Attributes (P, NP, U).
   eCrColData5 = 20              ' Multi-Line.
   eCrColData6 = 21              ' Multi-Line.
   eCrColData7 = 22              ' Multi-Line.
   eCrColData8 = 23              ' Multi-Line.
   eCrColData9 = 24              ' Multi-Line.
   eCrColData10 = 25             ' Multi-Line.
   eCrColProduct = 26            ' Short-Run.
   eCrColLowerSpec = 27          ' Variables, Run, Histogram, Multi-Line, B&W.
   eCrColTargetSpec = 28         ' Variables, Run, Histogram, Multi-Line, B&W.
   eCrColUpperSpec = 29          ' Variables, Run, Histogram, Multi-Line, B&W.
   eCrColTimeBetweenEvents = 30  ' t charts.
End Enum 'CrTreatColAsEnum'

PqCrColDef Object

 

PQCrColDef Object

PropertyTypeDescription
bUniqueIDBooleanThis column is a "Unique Identifier" column?
bDisplayInChartGridBooleanDisplay in the grid above the chart?
bDisplayInWebTableBooleanDisplay in the web page data table?
eColTypeLongADO or DAO recordset column type enum value.
eDataSourceTypeCrDataSourceTypeEnumJet, ODBC or ADO data source.
eTreatColAsCrTreatColAsEnumHow this column is treated as data for charting.
sColTypeStringText version of the eColType property.
sDisplayNameStringThe Display As name for the column.
sNameStringThe column name.
sTreatColAsStringText version of the eTreatColAs property.

PqCrSqlFilterDef Object

 

PqCrSqlFilterDef Object

PropertyTypeDescription
sDateTimeColNameStringDate/Time column name used to establish the time boundaries.
sDateTimeStartStringStarting Date/Time value.
sDateTimeStopStringEnding Date/Time value.
bInclusiveBooleanAre the Date/Time boundaries inclusive?
sF1ColNameStringFilter condition #1 column name.
sF1OpStringFilter condition #1 operator. (=, <, >, <>, etc.)
sF1ConstStringFilter condition #1 comparison value.
sF12CombineStringAND or OR - How to combine filter condition #1 and #2.
sF2ColNameStringFilter condition #2 column name.
sF2OpStringFilter condition #2 operator. (=, <, >, <>, etc.)
sF2ConstStringFilter condition #2 comparison value.
sF23CombineStringAND or OR - How to combine filter condition #2 and #3.
sF3ColNameStringFilter condition #3 column name.
sF3OpStringFilter condition #3 operator. (=, <, >, <>, etc.)
sF3ConstStringFilter condition #3 comparison value.
sAcCombineStringAND or OR - How to combine with "Additional Conditions" if present.
sAdditionConditionsStringSQL WHERE clause statements for "Additional Conditions".
bUseBracketsInSqlBooleanDo column names need to be surrounded by brackets?
sSqlBracketLeftStringThe left bracket character.
sSqlBracketRightStringThe right bracket character.

PqCrWeb Object

 

PqCrWeb Object

PropertyTypeDescription
bCreateChartImageBooleanWhether create the chart image file.
bShowChartImgTagBooleanWhether to expand the chart image tag <!--CHART_IMG_TAG--> on the web page.
bShowCausesBooleanWhether to show causes in the web data table.
bShowNotesBooleanWhether to show notes in the web data table.
bShowOocTestsBooleanWhether to show failed Out-Of-Control tests in the web data table.
bViewInBrowserBooleanWhether to view the web page in the default browser.
sWebPagePathStringFull path to the web page HTML file to be created. This can also just specify the folder path with no filename, in which case the HTML output filename will be specified from the chart name.
sTemplatePathStringStorage path to the web page HTML template file to use in creating the web page.
lImageHeightLongSize in pixels of the chart image height to be used on the web page.
lImageWidthLongSize in pixels of the chart image width to be used on the web page.
eImageTypeCrImageTypeEnumType of image file to generate for the web page.
sTableWidthStringThe maximum length of text to display in an Identifier column of the data table in the output HTML web page. If blank then we don't limit the Identifier text length.
sLastErrorStringThis contains an error message string that is set when errors occur within methods of this class.
 
Public MethodDescription
Function Edit() As BooleanDisplay a dialog box which allows the user to edit the web page parameters in 'Me'.  Returns True if the web page parameters are valid and the user clicked the OK button, otherwise False is returned.
Sub CopyTo(ByVal oCopyTo As PQCrWeb)Copy the properties of 'Me' to the oCopyTo object. This creates a copy of 'Me' in oCopyTo.
Sub InitFromRegistry()Initialize 'Me' with default values from the Registry.
Sub Initialize()Initialize 'Me' to the "New Web Page Definition" state.
Function SaveWebPage(ByVal oCrDef As PQCrDef) As BooleanSave the chart defined by oCrDef as a web page according to the properties defined in 'Me'. This method fails if oCrDef is a chart Workspace. Returns True if successful, otherwise False (see sLastError).

PqStrList Object

The PqStrList object is used to hold a list of strings.  It is similar to an array of String objects, and it also has some characteristics of the VB Collection object.  The elements of the list start at 1 and go to PqStrList.Count.

Example

Dim oList As New PqStrList
Dim s As String
oList.Append  "Robert"
oList.Append  "Lee"
oList.Append  "Carol"
Call oList.Sort(ePqStrListSortAscending)
' Read the string in the first element of the list.
s = oList(1)
' Replace the string in the third element of the list.
oList(3) = "Replacement String"
' Store a string in the fifth element of the list.  Now element 4 contains a zero length string
' and oList.Count is 5.
oList(5) = "Bob"

PqStrList Object

PropertyTypeDescription
CountLongCount of the number of strings stored in the list.
Value(ByVal Index As Long)StringYou can read and write the string located at the specified 'Index'.  It is permissible to assign a string to an index that is beyond the current Count of elements in the list.
MethodDescription
Append(sItem As String) As LongAppends 'sItem' to the end of the list and return the current 'Count' of strings in the list.
Sub Clear()Clears all elements from the list.  Afterwards 'Count' is zero.
Sub Remove(ByVal Index As Long)Removes the element specified by 'Index' from the list. Any elements in the list beyond the element specified by 'Index' will be shifted up to occupy the deleted slot. Thus, after each call to Remove() the Count property will decrease by one.
Sub Insert(Index As Long, sData As String)Inserts the string specified by 'sData' into the 'Index' element of the list. Any elements in the list beyond the element specified by 'Index' will be shifted down to accomodate the inserted slot. Thus, after each call to Insert() the Count property will increase by one. However, you cannot insert past the current end of the list.
Sub Sort(eSortType As ePqStrListSortType, Optional vFirst As Variant, Optional vLast As Variant)Sort the list ascending or descending as specified by 'eSortType'. Optionally specify the 'vFirst' starting element index and/or the 'vLast' ending element index to sort.