3d7ab89bf0b35a1e0cdff1a8dadba713e5495981
chmalee
  Fri Mar 11 11:40:37 2022 -0800
Fix x coordinate of mapbox I forgot to fix with previous change, refs #29060

diff --git src/hg/hgTracks/barChartTrack.c src/hg/hgTracks/barChartTrack.c
index 83efba9..162287f 100644
--- src/hg/hgTracks/barChartTrack.c
+++ src/hg/hgTracks/barChartTrack.c
@@ -905,46 +905,48 @@
 int graphX = barChartX(bed);
 int graphWidth = chartWidth(tg, itemInfo);
 int barCount = filteredCategoryCount(extras);
 
 char label[256];
 char *userSettingMinBarWidth= trackDbSetting(tg->tdb, BAR_CHART_USER_BAR_MIN_WIDTH);
 int userMinBarWidth = 0;
 if (userSettingMinBarWidth)
     userMinBarWidth = sqlUnsigned(userSettingMinBarWidth);
 if (barCount <= graphWidth) // Don't create map boxes if less than one pixel per bar
     {
     // add maps to category bars
     struct barChartCategory *categs = getCategories(tg);
     struct barChartCategory *categ = NULL;
     int x0 = insideX + graphX;
+    int x1 = x0;
     double invCount = 1.0/barCount;
-    int i = 0, barsDrawn = 0;
+    int i = 0, barsDrawn = 0, width = 0;
     int extraAtTop = 4;
     for (categ = categs; categ != NULL; categ = categ->next, i++)
         {
         if (!filterCategory(extras, categ->name))
             continue;
-	x1 = barsDrawn * graphWidth * invCount;
+        x1 += width;
+        int cStart = barsDrawn * graphWidth * invCount;
         barsDrawn += 1;
-	x2 = barsDrawn * graphWidth * invCount;
-	int width = max(userMinBarWidth, max(1, x2-x1));
+        int cEnd = barsDrawn * graphWidth * invCount;
+        width = max(userMinBarWidth, max(1, cEnd - cStart));
         double expScore = bed->expScores[i];
         int height = valToClippedHeight(expScore, extras->maxMedian, extras->maxViewLimit,
                                             extras->maxHeight, extras->doLogTransform);
         height = min(height+extraAtTop, extras->maxHeight);
-	mapBoxHc(hvg, itemStart, itemEnd, x0 + x1, yZero-height, width, height, 
+        mapBoxHc(hvg, itemStart, itemEnd, x1, yZero-height, width, height,
                             tg->track, mapItemName, chartMapText(tg, categ, expScore));
         }
     safef(label, sizeof(label), 
 	"%s - click for faceted view or hover over a bar for sample values", 
 	itemName);
     }
 else
     safef(label, sizeof(label), 
 	    "%s - zoom in to resolve individual bars or click for details", 
 	    itemName);
 // map over background of chart
 getItemX(start, end, &x1, &x2);
 mapBoxHc(hvg, itemStart, itemEnd, x1, y, graphWidth, itemHeight-3,
                     tg->track, mapItemName, label);
 }