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
ehchandlerjr
Level V

Graph Builder: Pinned data labels for line graph of series colored by continuous variable?

Hello - I'm plotting multiple series ontop of eachother in graph builder. Legend is great, but it would be really nice to have a data label at the end of each series so people don't have to have their eyes flying all over the place when seeing new data. However, when using a continuous variable in the color column, the line label setting disappears. I could just put the series in the overlay column, but then it becomes much harder to script and instead of manually putting in labels, I'd have to manually put in colors, which function as another label. Is there a way to do these labels with continuous color variables?

Thanks!

Edward Hamer Chandler, Jr.
4 REPLIES 4
hogi
Level XII

Re: Graph Builder: Pinned data labels for line graph of series colored by continuous variable?

Is line label what you want?

hogi_3-1702035045179.png

 

 

hogi_4-1702035109577.png

 

dt = Open( "/C:/Program Files/JMP/JMPPROEA/18/Samples/Data/US Regional Population.jmp" );
Graph Builder(
	Size( 553, 264 ),
	Show Control Panel( 0 ),
	Show Title( 0 ),
	Summary Statistic( "Median" ),
	Graph Spacing( 4 ),
	Variables( X( :Year ), Y( :Population ), Overlay( :Region ) ),
	Elements( Line( X, Y, Legend( 7 ) ) ),
	SendToReport(
		Dispatch(
			{},
			"400",
			ScaleBox,
			{Legend Model(
				7,
				Properties(
					2,
					{Line Label Properties( {Name Label( 1 )} )},
					Item ID( "Great Lakes", 1 )
				),
				Properties(
					9,
					{Line Label Properties( {Name Label( 1 )} )},
					Item ID( "Pacific", 1 )
				),
				Properties(
					10,
					{Line Label Properties( {Name Label( 1 )} )},
					Item ID( "South Atlantic", 1 )
				)
			)}
		),
		Dispatch(
			{},
			"Graph Builder",
			FrameBox,
			{DispatchSeg(
				Line Seg( "Line (Great Lakes)" ),
				Label Offset( "Name", -1, {9.88327472828701, 37772.1540027761} )
			)}
		)
	)
)

 

jthi
Super User

Re: Graph Builder: Pinned data labels for line graph of series colored by continuous variable?

Do you have multiple columns in Y-axis or how are you plotting those separate lines? Using overlay should be fairly easy

jthi_0-1702048734739.png

Script created by JMP isn't too bad

Graph Builder(
	Variables(X(:lot_id), Y(:NPN1), Overlay(:NPN2)),
	Elements(Smoother(X, Y, Legend(7))),
	SendToReport(
		Dispatch(
			{},
			"400",
			ScaleBox,
			{Legend Model(
				7,
				Properties(0, {Line Label Properties({Name Label(1), Width(9)})}, Item ID("108.83 - 113.96", 1)),
				Properties(1, {Line Label Properties({Name Label(1), Width(9)})}, Item ID("113.96 - 115.2", 1)),
				Properties(2, {Line Label Properties({Name Label(1), Width(9)})}, Item ID("115.2 - 116.32", 1)),
				Properties(3, {Line Label Properties({Name Label(1), Width(9)})}, Item ID("116.32 - 117.58", 1)),
				Properties(4, {Line Label Properties({Name Label(1), Width(9)})}, Item ID("117.58 - 121.78", 1))
			)}
		)
	)
)

and can be made "better"

lgd_server = gb << Get Legend Server;
items = lgd_server << Get Legend Items;
For Each({item, index}, items[1], 
	item << Set Properties( {Line Label Properties({Name Label(1)})});
);

Full example

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Semiconductor Capability.jmp");
gb = dt << Graph Builder(
	Variables(X(:lot_id), Y(:NPN1), Overlay(:NPN2)),
	Elements(Smoother(X, Y, Legend(7)))
);

lgd_server = gb << Get Legend Server;
items = lgd_server << Get Legend Items;
For Each({item, index}, items[1], 
	item << Set Properties( {Line Label Properties({Name Label(1)})});
);
-Jarmo
ehchandlerjr
Level V

Re: Graph Builder: Pinned data labels for line graph of series colored by continuous variable?

@hogi and @jthi Thanks for y'all's replies! So the data table is in a stacked format as it's linked to another table and I need an ID column for the link. Some columns are discrete like @hogi you showed, but many of these plots are series where the changed variable between series is continuous. Maybe part of the problem is that I've done some of the calculations on my own rather than let jmp do it. I'm trying to stack to data in a way that JMP doesn't seem to do (not the same as "stack" in the line properties, as that seems to rescale the data as well), I've gone ahead and just made another column that offsets the data in an absolute sense, using table variables. Then I added in some sliders to adjust the scale of those offsets. So I've gone around JMP a little bit, and that might be part of the issue.

image.png

So I have a couple variables that I select as "hierarchical offset variables", for lack of a better term. There is a large offset associated with the primary hierarchical variable when levels change, and and a smaller offset added when the secondary hierarchical variable changes. Because there are so many series, having a color spectrum really helps. Unfortunately, the secondary hierarchical variable, which usually makes sense as the coloring variable, is continuous, so the legend always goes continuous, and you can't specify levels as labels. I tried to put the secondary hierarchical variable into the overlay box, and just make like 2000 bins, which does guarantee every series show up and not get averaged, but then I can't specify the color gradient and it just gives random colors. The legend also would gives those bins rather than the data that's there, and that doesn't work. Maybe there's a way to force an overlay legend to return a continuous version of the coloring scheme, but I don't see it, and going in an de-check-boxing all the unused bins for the legend is also tedious. I'd like to be able to display labels and a color gradient. I suppose I could spend the time manually going through and adding labels in powerpoint, but with all of JMP's functionality, I feel like there should be a way to do this.

 

Hopefully I'm making sense. Feeling a little fog-headed so if this doesn't make sense, let me know.

Edward Hamer Chandler, Jr.
jthi
Super User

Re: Graph Builder: Pinned data labels for line graph of series colored by continuous variable?

I think you should be able to set gradient type coloring even if you use overlay

jthi_0-1702122462810.png

Open legend and change the color theme

jthi_2-1702122501267.png

jthi_3-1702122508427.png

 

 

 

-Jarmo