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

fond de carte

Bonjour à tous,

 

Je dispose d’un dossier comportant plusieurs images. J’arrive en faisant glisser une par une les images à mettre l’image correspondante en fond de carte (dans l’outil constructeur de graphique). J’aimerais pouvoir réaliser ceci de façon interactive avec un outil JMP (script JSL, sélecteur de colonne...).

C’est à dire modifier le fond de carte en fonction du choix de l’utilisateur et avec les images du dossier évoqué.

 

 

Voici par exemple à quoi ressemble une image en fond de carte en faisant glisser l’image à la main :

 

hcarr01_0-1693212287064.png

 

Merci pour votre aide !

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: fond de carte

Using Add Image to framebox should work

Names Default To Here(1);

folder_of_interest = Convert File Path("$SAMPLE_IMAGES");
filenames = Files In Directory(folder_of_interest);

dt = Open("$SAMPLE_DATA/Big Class.jmp");

swap_img = Expr(
	frame = Report(gb)[FrameBox(1)];
	Try(
		cur_img = frame << FindSeg(PictSeg(1));
		cur_img << Remove;
	);
	img = New Image(folder_of_interest || cur_file);
	frame << Add Image(
		Image(img),
		bounds(top(90), Left(10), bottom(10), Right(90))
	);
);

nw = new window("",
	H List Box(
		rb = Radio Box(filenames, << Set Function(function({this},
			cur_file = (this << get selected);
			swap_img;
		))),
		gb = dt << Graph Builder(
			Size(528, 456),
			Show Control Panel(0),
			Variables(X(:weight), Y(:height)),
			Elements(Points(X, Y, Legend(3)))
		);		
	)
);
-Jarmo

View solution in original post

11 REPLIES 11
jthi
Super User

Re: fond de carte

Using Add Image to framebox should work

Names Default To Here(1);

folder_of_interest = Convert File Path("$SAMPLE_IMAGES");
filenames = Files In Directory(folder_of_interest);

dt = Open("$SAMPLE_DATA/Big Class.jmp");

swap_img = Expr(
	frame = Report(gb)[FrameBox(1)];
	Try(
		cur_img = frame << FindSeg(PictSeg(1));
		cur_img << Remove;
	);
	img = New Image(folder_of_interest || cur_file);
	frame << Add Image(
		Image(img),
		bounds(top(90), Left(10), bottom(10), Right(90))
	);
);

nw = new window("",
	H List Box(
		rb = Radio Box(filenames, << Set Function(function({this},
			cur_file = (this << get selected);
			swap_img;
		))),
		gb = dt << Graph Builder(
			Size(528, 456),
			Show Control Panel(0),
			Variables(X(:weight), Y(:height)),
			Elements(Points(X, Y, Legend(3)))
		);		
	)
);
-Jarmo
hcarr01
Level VI

Re: fond de carte

Merci pour votre réponse @jthi.

 

D’une part j’obtiens bien toutes les différentes images à gauche de la page où je peux choisir laquelle sélectionner.

Lorsque je sélectionne une image, j’obtiens le message d’erreur suivant :

 

hcarr01_0-1693217047669.png

 

 

 

jthi
Super User

Re: fond de carte

Script does work for me when using JMP17

jthi_0-1693221085808.png

 

-Jarmo
hcarr01
Level VI

Re: fond de carte

Merci, cela fonctionne correctement, j'avais oublié la suite du chemin d'accès.

 

Cependant, pour que l'image soit bien représentée avec les bonnes dimensions je dois utiliser l'option "Image"-->"Taille/Echelle"-->"Remplir le graphique".

 

Existe-t-il une option permettant de le faire automatiquement ou faut-il le faire de façon manuelle à chaque fois ?

 

Merci pour votre réponse !

jthi
Super User

Re: fond de carte

Scripting Index usually is pretty good of finding solutions (you can use same keyword as JMP menu has or parts of it)

jthi_0-1693222196744.png

 

-Jarmo
hcarr01
Level VI

Re: fond de carte

J'utilise ce script pour avoir le constructeur des graphiques, j'ai essayé d'intégrer l'option "fill graph" mais rien de concluant cela ne fonctionne pas correctement.

 

 

Names Default To Here(1);

folder_of_interest = Convert File Path("image");
filenames = Files In Directory(folder_of_interest);

dt = current data table();

swap_img = Expr(
	frame = Report(gb)[FrameBox(1)];
	Try(
		cur_img = frame << FindSeg(PictSeg(1));
		cur_img << remove;
		wait ( 1 );
		cur_img << fill graph;
	);
	img = New Image(folder_of_interest || cur_file);
	frame << Add Image(
		Image(img),
		bounds(frame << fill graph);
	);

);


nw = new window("Image référence vs défauts",
	H List Box(
		rb = Radio Box(filenames, << Set Function(function({this},
			cur_file = (this << get selected);
			swap_img;
		))),
		gb = dt << Graph Builder(
			Size( 567, 494 ),
			Show Control Panel( 0 ),
			Variables( X( :COORDXD ), Y( :COORDYD ) ),
			Elements( Points( X, Y, Legend( 6 ) ) ),
			Local Data Filter(
				Add Filter(
					columns( :NUMP, :NUMIMAGE ),
					Where( :NUMP == "x" ),
					Where( :NUMIMAGE == x ),
					Display( :NUMP, N Items( 15 ), Find( Set Text( "" ) ) ),
					Display( :NUMIMAGE, N Items( 15 ) )
				)
			),
			SendToReport(
				Dispatch(
					{},
					"400",
					ScaleBox,
					{Legend Model(
						6,
						Properties( 0, {Line Color( 51 )}, Item ID( "COORDYD", 1 ) )
					)}
				)
			)
		);	
	)
);

 

jthi
Super User

Re: fond de carte

You need the reference to PictSeg after the image has been set and then use fill graph on that.

-Jarmo
hcarr01
Level VI

Re: fond de carte

Bonjour,

 

Dans la liste des images à sélectionner à gauche, j'obtiens beaucoup de choix.

Est-il possible de changer le format d'affichage et d'avoir une liste déroulante où nous pouvons chercher les images que nous souhaitons afficher en fond ?

 

Comme ci-dessous :

hcarr01_0-1714734414790.png

 

merci pour vos réponses.

 

jthi
Super User

Re: fond de carte

Depends on your UI. You might be able to use local data filter or you can write your own search box (using Text Edit Box) which can then be used for example with List Box to show the items.

-Jarmo