14.03.2014 Views

Automation Reference - JMP

Automation Reference - JMP

Automation Reference - JMP

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

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

Automating <strong>JMP</strong> in Visual C#<br />

Automating <strong>JMP</strong> in Visual C#<br />

This section assumes you are using Visual Studio 2008 or later.<br />

Starting a <strong>JMP</strong> application<br />

The first step to automating <strong>JMP</strong> in C# is to start <strong>JMP</strong>. Before you can do that, you need to add the <strong>JMP</strong> library to<br />

your resources. <strong>JMP</strong> provides a library that allows the user to use automation controllers to display the properties and<br />

methods that <strong>JMP</strong> uses.<br />

To add the <strong>JMP</strong> library, follow these steps:<br />

1. Select Project > Add <strong>Reference</strong> and then click the COM tab.<br />

2. Scroll down, select <strong>JMP</strong>, and then click OK.<br />

3. To verify that <strong>JMP</strong> has been added, select View > Object Browser.<br />

You should see Interop.<strong>JMP</strong>.<br />

4. Now that you can access the type library information, write the necessary code to open <strong>JMP</strong>. In global<br />

declarations for the project, create a variable of type <strong>JMP</strong>.Application.<br />

private <strong>JMP</strong>.Application my<strong>JMP</strong>;<br />

5. Create a <strong>JMP</strong> session and make it visible.<br />

my<strong>JMP</strong> = new <strong>JMP</strong>.Application();<br />

my<strong>JMP</strong>.Visible = true;<br />

Launching an analysis<br />

This example shows how to create a Bivariate analysis of the Big Class.jmp sample data.<br />

To launch the analysis, follow these steps:<br />

1. Create a variable for the document.<br />

<strong>JMP</strong>.Document doc;<br />

2. Open the Big Class.jmp sample data.<br />

doc = my<strong>JMP</strong>.OpenDocument("c:\Program Files\SAS\<strong>JMP</strong>\10\Samples\Data\Big Class.jmp");<br />

3. Define a variable for the Bivariate analysis.<br />

<strong>JMP</strong>.Bivariate biv;<br />

4. Create the Bivariate object,.<br />

biv = doc.CreateBivariate();<br />

5. Add the necessary columns and values to specify which data to use. For Bivariate, you need to launch the<br />

platform and specify x and y values.<br />

biv.LaunchAddX("weight");<br />

biv.LaunchAddY("height");<br />

6. Launch the Bivariate platform.<br />

biv.Launch()<br />

7. Create a Line of Fit to manipulate the data.<br />

<strong>JMP</strong>.Fit fLine;<br />

fLine = biv.FitLine();<br />

Page 11

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

Saved successfully!

Ooh no, something went wrong!