37cdece31345c69c7252ca0f9cfc10183cf579d1
kate
  Thu Apr 13 12:47:38 2017 -0700
Fix map box over white background. refs #18736

diff --git src/hg/hgTracks/barChartTrack.c src/hg/hgTracks/barChartTrack.c
index d427625..695c956 100644
--- src/hg/hgTracks/barChartTrack.c
+++ src/hg/hgTracks/barChartTrack.c
@@ -655,65 +655,66 @@
     }
 int topGraphHeight = barChartHeight(tg, itemInfo);
 topGraphHeight = max(topGraphHeight, tl.fontHeight);        // label
 int yZero = topGraphHeight + y - 1;  // yZero is bottom of graph
 
 // add map box to item label
 
 int labelWidth = mgFontStringWidth(tl.font, itemName);
 getItemX(start, end, &x1, &x2);
 if (x1-labelWidth <= insideX)
     labelWidth = 0;
 // map over label
 int itemHeight = itemInfo->height;
 mapBoxHc(hvg, start, end, x1-labelWidth, y, labelWidth, itemHeight-3, 
                     tg->track, mapItemName, itemName);
-// map over background of chart
-// TODO: more efficient
-int graphWidth = barChartWidth(tg, itemInfo);
-mapBoxHc(hvg, start, end, x1, y, graphWidth, itemHeight-3,
-                    tg->track, mapItemName, itemName);
 
 // add maps to category bars
 struct barChartCategory *categs = getCategories(tg);
 struct barChartCategory *categ = NULL;
 int barWidth = barChartBarWidth(tg);
 int padding = barChartPadding();
 double maxMedian = ((struct barChartTrack *)tg->extraUiData)->maxMedian;
 
 int graphX = barChartX(bed);
 if (graphX < 0)
     return;
 
 // x1 is at left of graph
 x1 = insideX + graphX;
 
 double viewMax = (double)cartUsualIntClosestToHome(cart, tg->tdb, FALSE, 
                                 BAR_CHART_MAX_LIMIT, BAR_CHART_MAX_LIMIT_DEFAULT);
 int i = 0;
 for (categ = categs; categ != NULL; categ = categ->next, i++)
     {
 if (!filterCategory(tg, categ->name))
     continue;
     double expScore = bed->expScores[i];
     int height = valToClippedHeight(expScore, maxMedian, viewMax, 
                                         barChartMaxHeight(), extras->doLogTransform);
     mapBoxHc(hvg, itemStart, itemEnd, x1, yZero-height, barWidth, height, tg->track, mapItemName,  
                 barChartMapText(tg, categ, expScore));
     x1 = x1 + barWidth + padding;
     }
 
+// map over background of chart
+// TODO: more efficient
+int graphWidth = barChartWidth(tg, itemInfo);
+getItemX(start, end, &x1, &x2);
+mapBoxHc(hvg, start, end, x1, y, graphWidth, itemHeight-3,
+                    tg->track, mapItemName, itemName);
 }
 
 /* This is lifted nearly wholesale from gtexGene track.  Could be shared */
 
 static int getBarChartHeight(void *item)
 {
 struct barChartItem *itemInfo = (struct barChartItem *)item;
 assert(itemInfo->height != 0);
 return itemInfo->height;
 }
 
 /* This is lifted nearly wholesale from gtexGene track.  Could be shared */
 
 static int barChartTotalHeight(struct track *tg, enum trackVisibility vis)
 /* Figure out total height of track. Set in track and also return it */