cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
Kenobi
Level III

Adding custom marker and colors to GraphBuilder in JSL

Hello,

 

I am trying to add color/markers to row states through Flags mentioned in a particular column. For instance, working on the Cities dataset, I created random flags (5 different classes of flags) for few rows, and most are empty. Now, the majority of those values are plotted with a single black dot, I am fine with it. But, the major issue arises, when I try to create an individual value plot with a legend. I do not want the black dot to show up on the legend, I want the 5 different classes with different colors to show up.

 

Kenobi_0-1690223166065.png

Kenobi_1-1690223381064.png

 

 

dlg = Column Dialog(
        yList = Col List( "Ys",
            Min Col(1)
        ),
        xList = Col List( "Xs",
            Min Col(1),
            Max Col(1)
        ),
        byList = Col List( "Color/Mark By",
        	Max Col(1)
        )
    );
_files =     dlg["byList"];
dt << Color or Mark by Column( _files[1], Marker Theme( "solid" ), Color Theme("JMP default") );

meas_cols = dt << Get Column Names("String");
// Get the selected X and Y columns
x_col = dlg["xList"];
y_cols = dlg["yList"];

// Create new window with a vertical list box to store graph builder objects   
nw = New Window( "graphs", <<journal, myVLB = V List Box() );

// Iterate over the Y columns and create a Graph Builder plot for each column
For(i = 1, i <= N Items(y_cols), i++,

	y_name = Char(y_cols[i]);
	x_name = Char(x_col[1]);

	gb = dt << Graph Builder(
		Size(700, 350),
		Show Control Panel(0),
		Show Footer(0),
		Variables(X(x_col[1]), Y(y_cols[i])),
		Elements(Points(X, Y, Legend(24))),
		invisible,
		SendToReport(
		Dispatch(
			{},
			"Graph Builder",
			OutlineBox,
			{Set Title( y_name || " vs " || x_name ), Image Export Display( Normal )}
			),
		Dispatch(
			{},
			"Graph Builder",
			FrameBox,
			{Marker Size( 5 ), Transparency(1)}
			),
		Dispatch( 
			{},
			"graph title", 
			TextEditBox, 
			{Set Text( "" )} 
			),
		Dispatch( 
			{}, 
			"X title", 
			TextEditBox, 
			{Set Text( "" )} 
			)
		// Dispatch( 
		//     {}, 
		//     "Y title", 
		//     TextEditBox, 
		//     {Set Text( "" )} 
		//     ),
		)
	);
	
	gb << Show Legend(1);
	
	myVLB << append( Report( gb ) );
	
	// Save the plot as an image with specified width, height, and format (optional)
	// gb << Save Picture("Plot_" || Char(i) || ".emf", EMF);
	gb << delete;
);
1 ACCEPTED SOLUTION

Accepted Solutions
hogi
Level XII

Re: Adding custom marker and colors to GraphBuilder in JSL

You can right click on the dots to change the color:

hogi_1-1690314471570.png

 


You can also double click on the dots - then the Legends settings open -- where you can select which plots to show and which ones to hide.

 

hogi_0-1690314403562.png

 

View solution in original post

3 REPLIES 3
hogi
Level XII

Re: Adding custom marker and colors to GraphBuilder in JSL

Did you try to drag your column on Overlay

or in JSL

		Variables(X(x_col[1]), Y(y_cols[i]), Overlay(:mycol)),
		Elements(Points(X, Y, Ovelay, Legend(24))),
Kenobi
Level III

Re: Adding custom marker and colors to GraphBuilder in JSL

Yes, I tried this. But it just plots the marked or flagged rows. Is there a way to overcome this? I want the black dots, and the other labels on the plot, but I do not want the black dot to show up on the legend, just want the labels in the legend.

 

Edit: I tried this, it works, but I am unable to set the color of the default black dots. Those dots appear in a new color (sorry, have some difficulty with colors)

Variables(X(x_col[1]), Y(y_cols[i]), Color(_files[1])),
Elements(Points(X, Y, Legend(28))),
hogi
Level XII

Re: Adding custom marker and colors to GraphBuilder in JSL

You can right click on the dots to change the color:

hogi_1-1690314471570.png

 


You can also double click on the dots - then the Legends settings open -- where you can select which plots to show and which ones to hide.

 

hogi_0-1690314403562.png