683e3d036a593d3742c5b7669876e0f6babd206e
kent
  Wed Feb 3 09:56:44 2021 -0800
Made map box extend just a little over the bars for easier mouse-overs, and especially to read categories of empty bars.

diff --git src/hg/hgTracks/barChartTrack.c src/hg/hgTracks/barChartTrack.c
index 65ee121..668a7f2 100644
--- src/hg/hgTracks/barChartTrack.c
+++ src/hg/hgTracks/barChartTrack.c
@@ -774,41 +774,43 @@
 int itemHeight = itemInfo->height;
 mapBoxHc(hvg, itemStart, itemEnd, x1-labelWidth, y, labelWidth, itemHeight-3, 
                     tg->track, mapItemName, itemName);
 
 // add maps to category bars
 struct barChartCategory *categs = getCategories(tg);
 struct barChartCategory *categ = NULL;
 
 int graphX = barChartX(bed);
 
 int graphWidth = chartWidth(tg, itemInfo);
 int x0 = insideX + graphX;
 int barCount = filteredCategoryCount(extras);
 double invCount = 1.0/barCount;
 int i = 0, barsDrawn = 0;
+int extraAtTop = 4;
 for (categ = categs; categ != NULL; categ = categ->next, i++)
     {
     if (!filterCategory(extras, categ->name))
 	continue;
     x1 = barsDrawn * graphWidth * invCount;
     barsDrawn += 1;
     x2 = barsDrawn * graphWidth * invCount;
     int width = max(1, x2-x1);
     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, 
                         tg->track, mapItemName, chartMapText(tg, categ, expScore));
     }
 
 // map over background of chart
 getItemX(start, end, &x1, &x2);
 mapBoxHc(hvg, itemStart, itemEnd, 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;