Voglio aggiungere immagini alla mia tabella JMP, quindi quando passo il mouse su un punto dati, posso vedere l'immagine associata. La mia preoccupazione è che la mia tabella abbia oltre 300.000 righe e penso che se aggiungo un'immagine a ciascuna riga, la dimensione del file potrebbe diventare ingestibile. Tuttavia, molte righe condivideranno la stessa immagine: ci sono solo ~ 30.000 immagini, con ciascuna immagine condivisa da ~ 10 righe. Esiste un modo efficiente per associare un'immagine a più righe senza aumentare le dimensioni del file? (O JMP saprebbe già farlo automaticamente?)
Per riferimento, ecco il codice che ho utilizzato in precedenza per aggiungere immagini a una tabella JMP, anche se in quel caso ogni riga riceveva un'immagine distinta.
Names Default to Here(1);
// run the script on the currently-selected data table
dt = Current Data Table();
// point to the directory where your thumbnail images are stored
// this script assumes the image names follow the pattern "0001.jpg", "0002.jpg", etc.
BaseImageDirectory = "C:\Users\user\Downloads\thumbnails\";
// create a column called "pics" to put the images
CurrentColumnNames = dt << get column names(string);
if (!contains(CurrentColumnNames, "pics"), New Column("pics", Expression));
// iterate through each row in the data table to add the images
For Each Row(
// look for a column called "image_directory" and take the name of the lowest-level subdirectory
Directory = word(-1, :image_directory, "\");
// zero-pad the image number to four digits (e.g. image_number 1 becomes 0001)
ImageID = Repeat( "0", 4 - Length( Char( :image_number ) ) ) || Char( :image_number );
// look for a file name like 0001.jpg in a folder with a name matching "image_directory"
ThumbnailFile = BaseImageDirectory || Directory || "\" || ImageID || ".jpg";
Eval(Eval Expr(tp = ThumbnailFile));
// insert the image into the column "pics"
Try(dt:pics = new image(tp));
);
// set "pics" as a label so it shows up when you hover over any data point
dt:pics << label(1);