Subscribe Bookmark RSS Feed

JMP OLE: How to add a legend to a Bivariant

maltman

Community Trekker

Joined:

Oct 18, 2011

I can't figure out how to display a legend in my bivariant chart through OLE. There is very little documentation in JSL OLE (I'm I the only one doing this?). Can someone point me in the right direction? In it's current state, it will display the graph and color code by column. All I need to do is display the legend.

Here is my code (VBscript):

'Initialize JMP
Dim MyJMP, JMPDoc, DT, DT2, WidthTable, FrameBox
Set MyJMP = CreateObject("JMP.Application")
MyJMP.Visible = true
Set JMPDoc = MyJMP.OpenDocument("MyFile.csv")

'Convert document to datatable
Set DT = JMPDoc.GetDataTable

'Select the width data (High and Low)
DT.SelectRowsWhere "CHART_SUBSET",rowSelectEquals, rowSelectExtendCurrent,"TARGET=HIGH"
DT.SelectRowsWhere "CHART_SUBSET",rowSelectEquals, rowSelectExtendCurrent,"TARGET=LOW"

Set WidthTable = DT.subset
WidthTable.ColorByColumn("SPC_ENTITY")
WidthTable.MarkerByColumn("SPC_ENTITY")

'*************************

'Create Bivariant Chart

'*************************
Dim Biv
Set Biv = WidthTable.Document.CreateBivariate
Biv.LaunchAddY("SPC_CHART_VALUE")
Biv.LaunchAddX("SPC_TXN_DATE")
Biv.LaunchAddBy("SPC_CHART_SUBSET")

Biv.FitLine
Biv.Launch

FrameBox = Biv.GetGraphicItemByType("frame box", 1)


Biv.FrameBoxAddGraphicsScript 1, "Row Legend(:SPC_ENTITY)"
Biv.FrameBoxSetMarkerSize 1, 4

2 REPLIES
maltman

Community Trekker

Joined:

Oct 18, 2011

Still looking for some help on this if anyone can provide some insight. 

I tried something like this but it didn't work:

Biv.LaunchAddJSL "Row Legend(:SPC_ENTITY,color(1),Marker(1));"

Thanks

mattf

Community Trekker

Joined:

Jun 23, 2011

Hi Maltman:

The allpurpose RunCommand() function will let one easily do anthing you like interactively directly in JMP,... and then if you capture the script, it is easy to submit that from the automation side, from VBA, or Perl, of Python, or R, etc...

Best,

-Matt

Public Sub test()

'Initialize JMP

Dim MyJMP, JMPDoc, DT, DT2, WidthTable, FrameBox

Set MyJMP = CreateObject("JMP.Application")

MyJMP.Visible = True

Set JMPDoc = MyJMP.OpenDocument("C:/temp/Big Class.jmp")

'Convert document to datatable

Set DT = JMPDoc.GetDataTable()

'Select the width data (High and Low)

DT.SelectRowsWhere "age", rowSelectEquals, rowSelectExtendCurrent, "12"

DT.SelectRowsWhere "age", rowSelectEquals, rowSelectExtendCurrent, "13"

Set WidthTable = DT.Subset()

WidthTable.ColorByColumn ("name")

WidthTable.MarkerByColumn ("sex")

'*************************

'Create Bivariate Chart

'*************************

Dim str As String

str = "Bivariate( " _

    & "Y( :weight ), " _

    & "X( :height ), " _

    & "Fit Line( {Line Color( {213, 72, 87} )} ), " _

    & " SendToReport( " _

    & "     Dispatch( " _

    & "       {}, " _

    & "     ""Bivar Plot"", " _

    & "      FrameBox, " _

    & "{Marker Size( 4 ), Row Legend( " _

    & "name, Color( 1 ), Color Theme( ""JMP Default"" ), " _

    & "Marker( 0 ), " _

    & "Marker Theme(""""), " _

    & "Continuous Scale( 0 ), " _

    & "Reverse Scale( 0 ), " _

    & "Excluded Rows(0)" _

    & "            )}" _

    & "    )" _

    & "  )" _

    & ");"

Debug.Print (str)

  

MyJMP.RunCommand (str)

End Sub