Subscribe Bookmark RSS Feed

JMP Automation with VBA- Contour Plot Customization

jsuls

Community Trekker

Joined:

Jul 30, 2014

Hello,

I am generating contour plots with JMP using VBA automation. I need to adjust the frame size of the contour plot first. This is what I have so far. I can make the contour plot but I keep getting the default frame size

    Dim CP As JMP.Contour

    Set CP = jmpdoc1.CreateContourPlot

    CP.LaunchAddX ("X")

    CP.LaunchAddX ("Y")

    CP.LaunchAddY ("Z")

    CP.FillAreas (True)

    CP.SpecifyContours 5, 15, 21, False

    CP.SetFrameSize 200,400

    CP.Launch

Secondly, I am trying to change the contour colors from the default. Finally, I want to copy the plot so I can paste it in excel later on.

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

Hi,

In order to set the frame size, you must first obtain a handle to the frame box display element.  Then you can change the size.  CopyToClipboard is provided as a method on the ContourPlot (and all automation platform objects) to copy the result to the clipboard. Unfortunately, there is no automation method to change the colors.  You can reverse them only.  An alternative if this is imperative is to create the entire Contour in JSL and submit that JSL through the automation RunCommand or RunJSLFile methods.

An example to size the frame and copy the to the clipboard would be:

        Dim CP As JMP.Contour

        Dim hand As Integer

        CP = Doc.CreateContourPlot

        CP.LaunchAddX("X")

        CP.LaunchAddX("Y")

        CP.LaunchAddY("Z")

        CP.Launch()

        hand = CP.GetGraphicItemByType("FrameBox", 1)

        CP.SetFrameSize(hand, 500, 500)

        CP.CopyToClipboard()

Brian Corcoran

JMP Development

1 REPLY
Solution

Hi,

In order to set the frame size, you must first obtain a handle to the frame box display element.  Then you can change the size.  CopyToClipboard is provided as a method on the ContourPlot (and all automation platform objects) to copy the result to the clipboard. Unfortunately, there is no automation method to change the colors.  You can reverse them only.  An alternative if this is imperative is to create the entire Contour in JSL and submit that JSL through the automation RunCommand or RunJSLFile methods.

An example to size the frame and copy the to the clipboard would be:

        Dim CP As JMP.Contour

        Dim hand As Integer

        CP = Doc.CreateContourPlot

        CP.LaunchAddX("X")

        CP.LaunchAddX("Y")

        CP.LaunchAddY("Z")

        CP.Launch()

        hand = CP.GetGraphicItemByType("FrameBox", 1)

        CP.SetFrameSize(hand, 500, 500)

        CP.CopyToClipboard()

Brian Corcoran

JMP Development