我想将图像添加到 JMP 表中,因此当我将鼠标悬停在数据点上时,我可以看到关联的图像。 我担心的是我的表有 300,000 多行,我认为如果我向每一行添加图像,文件大小可能会变得难以管理。 然而,许多行将共享相同的图像 - 只有约 30,000 个图像,每个图像由约 10 行共享。 有没有一种有效的方法可以在不增加文件大小的情况下将图像与多行关联? (或者 JMP 是否已经知道自动执行此操作?)
作为参考,以下是我之前用于将图像添加到 JMP 表的代码,尽管在这种情况下,每一行都会获得不同的图像。
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);