14.03.2014 Views

Automation Reference - JMP

Automation Reference - JMP

Automation Reference - JMP

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Application Object <strong>Reference</strong> for Automating <strong>JMP</strong><br />

Automating <strong>JMP</strong> through Visual C++<br />

8. The I<strong>JMP</strong>Doc object provides the methods to launch the analysis and graphing platforms. Once you create an<br />

analysis and attach the dispatch pointer, you can specify the data table columns to use in the analysis and then<br />

you can launch it. Once the analysis is launched, you can manipulate it using the properties and methods specific<br />

to that particular type of analysis. Code that is taken from the sample application that describes steps 5–8 is<br />

shown below:<br />

Example Program<br />

//Note, no error handling is done in this example<br />

I<strong>JMP</strong>AutoApp m_DispDriver;<br />

I<strong>JMP</strong>Doc m_Doc;<br />

IAutoBivar m_Bivar;<br />

IAutoFit m_FitLine;<br />

//Create the initial dispatch driver that uses the I<strong>JMP</strong>AutoApp<br />

//interface specification (taken from jmpauto.h)<br />

m_DispDriver.CreateDispatch("<strong>JMP</strong>.Application");<br />

if (m_DispDriver)<br />

{<br />

//If <strong>JMP</strong> successfully started, make it visible<br />

m_DispDriver.SetVisible(TRUE);<br />

}<br />

//Now open a data table as a document. The document interface<br />

//pointer that is returned is then attached to our Doc dispatch<br />

//driver class that uses the I<strong>JMP</strong>Doc interface specification.<br />

m_Doc.AttachDispatch(m_DispDriver.OpenDocument(<br />

"C:\\<strong>JMP</strong>DATA\\BIGCLASS.<strong>JMP</strong>"));<br />

//First, call CreateBivariate on the Doc interface to create<br />

//a dispatch object to a Bivariate analysis. If there is already<br />

//a previous dispatch interface in m_Bivar, MFC releases it<br />

//in AttachDispatch.<br />

m_Bivar.AttachDispatch(m_Doc.CreateBivariate());<br />

//Now add Height and Weight as the columns to analyze<br />

m_Bivar.LaunchAddX("Height");<br />

m_Bivar.LaunchAddY("Weight");<br />

//Launch the analysis<br />

m_Bivar.Launch();<br />

//Create a FitLine. Since the Fit can be automated, attach the dispatch<br />

//pointer that is returned from FitLine() to a DispatchDriver object<br />

m_FitLine.AttachDispatch(m_Bivar.FitLine());<br />

//Now do a few more fits. This example does not automate these fit<br />

//objects, although they do support automation.<br />

m_Bivar.FitPolynomial(3.0);<br />

m_Bivar.FitSpline(1000.0);<br />

//Now manipulate the first FitLine object<br />

m_FitLine.ConfidenceFit(TRUE);<br />

m_FitLine.ConfidenceIndividual(TRUE);<br />

Page 10

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!