5cf8fec12cc427c0db2889430ea1758dbb7e7087 kent Tue Feb 9 09:42:18 2021 -0800 Clipping mark of a magenta stripe at top had got lost, I brought it back. diff --git src/hg/hgTracks/barChartTrack.c src/hg/hgTracks/barChartTrack.c index 668a7f2..436a122 100644 --- src/hg/hgTracks/barChartTrack.c +++ src/hg/hgTracks/barChartTrack.c @@ -659,45 +659,51 @@ // draw bar graph int i; int expCount = bed->expCount; struct barChartCategory *categ; int barCount = filteredCategoryCount(extras), barsDrawn = 0; double invCount = 1.0/barCount; for (i=0, categ=extras->categories; i<expCount && categ != NULL; i++, categ=categ->next) { if (!filterCategory(extras, categ->name)) continue; struct rgbColor fillColor = extras->colors[i]; int fillColorIx = hvGfxFindColorIx(hvg, fillColor.r, fillColor.g, fillColor.b); double expScore = bed->expScores[i]; int height = valToClippedHeight(expScore, extras->maxMedian, extras->maxViewLimit, extras->maxHeight, extras->doLogTransform); + boolean isClipped = (!extras->doLogTransform && expScore > extras->maxViewLimit); + int barTop = yZero - height + 1; if (extras->padding == 0 || sameString(colorScheme, BAR_CHART_COLORS_USER)) { int cStart = barsDrawn * graphWidth * invCount; int cEnd = (barsDrawn+1) * graphWidth * invCount; - hvGfxBox(hvg, cStart + x0, yZero-height+1, cEnd-cStart - extras->padding, height, fillColorIx); + x1 = cStart + x0; + barWidth = cEnd - cStart; + hvGfxBox(hvg, x1, barTop, barWidth, height, fillColorIx); + if (isClipped) + hvGfxBox(hvg, x1, barTop, barWidth, 2, clipColor); barsDrawn += 1; } else { - hvGfxOutlinedBox(hvg, x1, yZero-height+1, barWidth, height, fillColorIx, lineColorIx); + hvGfxOutlinedBox(hvg, x1, barTop, barWidth, height, fillColorIx, lineColorIx); + // mark clipped bar with magenta tip + if (isClipped) + hvGfxBox(hvg, x1, barTop, barWidth, 2, clipColor); x1 = x1 + barWidth + extras->padding; } - // mark clipped bar with magenta tip - if (!extras->doLogTransform && expScore > extras->maxViewLimit) - hvGfxBox(hvg, x1, yZero-height+1, barWidth, 2, clipColor); } } static char *chartMapText(struct track *tg, struct barChartCategory *categ, double expScore) /* Construct mouseover text for a chart bar */ { static char buf[128]; struct barChartTrack *extras = (struct barChartTrack *)tg->extraUiData; safef(buf, sizeof(buf), "%s (%.1f %s)", categ->label, expScore, extras->unit); subChar(buf, '_', ' '); return buf; } static int barChartItemStart(struct track *tg, void *item) /* Return end chromosome coordinate of item, including graph */