<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Efficient way to label multiple rows with the same image? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Efficient-way-to-label-multiple-rows-with-the-same-image/m-p/660283#M84928</link>
    <description>&lt;P&gt;I would put a single copy of each unique image in one data table, and then create a virtual table by linking your large data table to the image table, thus avoiding the duplication.&lt;/P&gt;</description>
    <pubDate>Wed, 19 Jul 2023 16:37:30 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2023-07-19T16:37:30Z</dc:date>
    <item>
      <title>Efficient way to label multiple rows with the same image?</title>
      <link>https://community.jmp.com/t5/Discussions/Efficient-way-to-label-multiple-rows-with-the-same-image/m-p/660265#M84927</link>
      <description>&lt;P&gt;I want to add images to my JMP table, so when I hover over a data point, I can see the associated image. My concern is that my table has 300,000+ rows, and I think if I add an image to each row the file size may become unmanageably large. However, many rows will share the same image - there are only ~30,000 images, with each image being shared by ~10 rows. Is there an efficient way to associate an image with multiple rows without increasing the file size? (Or would JMP already know to do that automagically?)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For reference, here is the code I previously used to add images to a JMP table, although in that case every row was getting a distinct image.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;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 &amp;lt;&amp;lt; 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 &amp;lt;&amp;lt; label(1);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 19 Jul 2023 15:37:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Efficient-way-to-label-multiple-rows-with-the-same-image/m-p/660265#M84927</guid>
      <dc:creator>markschwab</dc:creator>
      <dc:date>2023-07-19T15:37:35Z</dc:date>
    </item>
    <item>
      <title>Re: Efficient way to label multiple rows with the same image?</title>
      <link>https://community.jmp.com/t5/Discussions/Efficient-way-to-label-multiple-rows-with-the-same-image/m-p/660283#M84928</link>
      <description>&lt;P&gt;I would put a single copy of each unique image in one data table, and then create a virtual table by linking your large data table to the image table, thus avoiding the duplication.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2023 16:37:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Efficient-way-to-label-multiple-rows-with-the-same-image/m-p/660283#M84928</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2023-07-19T16:37:30Z</dc:date>
    </item>
    <item>
      <title>Re: Efficient way to label multiple rows with the same image?</title>
      <link>https://community.jmp.com/t5/Discussions/Efficient-way-to-label-multiple-rows-with-the-same-image/m-p/660329#M84932</link>
      <description>&lt;P&gt;Other option could be to use Hover Labels and load the images only when needed. In this case you could store the paths to the data table and then use hover label to load those based on those paths.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2023 17:42:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Efficient-way-to-label-multiple-rows-with-the-same-image/m-p/660329#M84932</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-07-19T17:42:30Z</dc:date>
    </item>
  </channel>
</rss>

