cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
xxvvcczz
Level III

jmp 15 graph builder somehow retains stale reference to map shapes

This was asked a few months ago here: JMP15 Graph Builder does not update Map after changing -XY coordinates file 

 

I've got the same problem and I feel like I've tried everything.

I tried nuking the "Name" Column

bringing the name column back

re-assigning the map role.

 

If I exit jmp and then open the exact same data table and drag "Name" down into map shapes IT WORKS!

 

Ok so it looks like its POSSIBLE to have 2 separate map shapes and draw them at the same time.

It looks like its NOT POSSIBLE to edit XY,Name,Main --> refresh an existing setup without exiting and re-opening jmp.

 

I'd say that's a bug, but I can dance around it for now, Lucky for me there are only a few potential rotations so I'm just going to generate them all ahead of time and serve them up like the worlds most amateurish static web page.

 

If we need a live example I'll try to make a simple use case that doesn't contain all the IP my current files are lugging.

But I need this scripted appropriately because I'm trying to create a "rotate" function so after adjusting all the XY coords of my map shapes I need to be able to redraw them!

 

help me obi wan jmp community you're my only hope.

 

Update tried more things. Literally the only way I can get this to work is by exiting and re-opening jmp

 

It's even resistant to delete symbols();

 

So the bug seems to be, JMP cannot "redraw" existing map shapes. To refresh or change map shapes you'd have to restart jmp entirely.

Therefore the workaround is to create the rotation as a new set of tables, delete the old graphbuilder and replace with new one.

1 REPLY 1
jthi
Super User

Re: jmp 15 graph builder somehow retains stale reference to map shapes

Haven't tested with JMP16, but With JMP15 I did manage to replicate the issue you are having. Didn't figure out how to manage changing the map shape without creating new ones and then updating Column Property with new map file and Shape property in graph builder (so you don't have to re-create graph builder).

 

Here is an example which will work with rotation, but to use it in production it will need more code to handle the map file creation/rotation in more efficient manner.

View more...
Names Default To Here(1);

::GLOBAL_MAP_ID = 1;
Create Directory("$TEMP/MAPTEST/");

mapNames = New Table("MAPTEST"||Char(::GLOBAL_MAP_ID)||"-Name",
	Add Rows(4),
	New Column("Shape Id", Numeric, "Continuous", Format("Best", 12), Set Values([1, 2, 3, 4]), Set Display Width(48)),
	New Column("Name",
		Character,
		"Nominal",
		Set Property("Map Role", Map Role(Shape Name Definition)),
		Set Values({"TopLeft", "TopRight", "BottomRight", "BottomLeft"}),
		Set Display Width(67)
	),
	private
);
Close(mapNames, Save("$TEMP/MAPTEST/MAPTEST"||Char(::GLOBAL_MAP_ID)||"-Name.jmp"));
mapXy = New Table("MAPTEST-XY",
	Add Rows(16),
	Compress File When Saved(1),
	New Column("Shape ID",
		Numeric,
		"Continuous",
		Format("Best", 10),
		Set Values([1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4]),
		Set Display Width(50)
	),
	New Column("Part ID",
		Numeric,
		"Continuous",
		Format("Best", 10),
		Set Values([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]),
		Set Display Width(39)
	),
	New Column("X1",
		Numeric,
		"Continuous",
		Format("Best", 10),
		Set Values([-2, -2, 0, 0, 0, 0, 2, 2, 0, 0, 2, 2, -2, -2, 0, 0]),
		Set Display Width(60)
	),
	New Column("Y1",
		Numeric,
		"Continuous",
		Format("Best", 10),
		Set Values([0, 2, 2, 0, 0, 2, 2, 0, -2, 0, 0, -2, -2, 0, 0, -2]),
		Set Display Width(52)
	),
	private
);
Close(mapXy, Save("$TEMP/MAPTEST/MAPTEST"||Char(::GLOBAL_MAP_ID)||"-XY.jmp"));

dt = Eval(EvalExpr(New Table("gb",
	Add Rows(4),
	New Column("Shape",
		Character,
		"Nominal",
		Set Property("Map Role", Map Role(Shape Name Use(Expr(Get Path Variable("$TEMP")||"/MAPTEST/MAPTEST"||Char(::GLOBAL_MAP_ID)||"-Name.jmp"), "Name"))),
		Set Values({"TopLeft", "TopRight", "BottomRight", "BottomLeft"}),
		Set Display Width(80)
	),
	New Column("OrigLoc", Character, "Nominal", Set Values({"TopLeft", "TopRight", "BottomRight", "BottomLeft"}))
)));

nw = New Window("rotation",
	H List Box(
		V List Box(
			Button Box("$TEMP/MAPTEST/", Open("$TEMP/MAPTEST/")),
			Button Box("Rotate",
				dtXY = Open("$TEMP/MAPTEST/MAPTEST"||Char(::GLOBAL_MAP_ID)||"-XY.jmp");
				origX = dtXY:X1 << get as matrix;
				dtXY:X1 << set values(origX[5 :: 16]` || origX[1 :: 4]`);
				origY = dtXY:Y1 << get as matrix;
				dtXY:Y1 << set values(origY[5 :: 16]` || origY[1 :: 4]`);
				If(Num(Word(1, JMP Version(), ".")) >= 16,
					Close(dtXY,	Save("$TEMP/MAPTEST/MAPTEST"||Char(::GLOBAL_MAP_ID)||"-XY.jmp"));
					 gbr = Report(gb)[Graph Builder Box(1)];
					 //gbr << Remove Variable(1);
					 gbr << Remove Variable({:Shape, Role("Shape")});
					 gbr << Add Variable({:Shape, Role("Shape")});
				, //else JMP versions lower than 16
					::GLOBAL_MAP_ID++; //move to next 
					Close(dtXY, Save("$TEMP/MAPTEST/MAPTEST"||Char(::GLOBAL_MAP_ID)||"-XY.jmp"));
					Wait(0);
					mapNames = New Table("MAPTEST"||Char(::GLOBAL_MAP_ID)||"-Name",
						Add Rows(4),
						New Column("Shape Id", Numeric, "Continuous", Format("Best", 12), Set Values([1, 2, 3, 4]), Set Display Width(48)),
						New Column("Name",
							Character,
							"Nominal",
							Set Property("Map Role", Map Role(Shape Name Definition)),
							Set Values({"TopLeft", "TopRight", "BottomRight", "BottomLeft"}),
							Set Display Width(67)
						),
						private
					);
					Close(mapNames, Save("$TEMP/MAPTEST/MAPTEST"||Char(::GLOBAL_MAP_ID)||"-Name.jmp"));
					Current Data Table():Shape << Set Property("Map Role", Eval(EvalExpr(Map Role(Shape Name Use(Expr(Get Path Variable("$TEMP")||"/MAPTEST/MAPTEST"||Char(::GLOBAL_MAP_ID)||"-Name.jmp"), "Name")))));
				);
			)
		),
		gb = Graph Builder(Size(640, 534), Show Control Panel(0), Variables(Color(:OrigLoc), Shape(:Shape)), Elements(Map Shapes(Legend(7)))); 
	)
);

dt << On Close(
	Try(Window("rotation") << Close Window);
	delFiles = Files In Directory("$TEMP/MAPTEST/");
	Show(delFiles);
	For(i = 1, i <= N Items(delFiles), i++,
		Try(Delete File("$TEMP/MAPTEST/"||delFiles[i]), Show(exception_msg));
	);
);

Not sure who to tag, but I know @julian has given some instructions how to change variables and elements in graph builders so maybe he has some ideas on this.

 

Edit: Tested with JMP16 and added If statement to the rotate button for JMP version check. With JMP16 it seems to work just by directly updating the XY file and you can see from the code that the solution is way simpler.

 

-Jarmo