a3191890642f8b6e4fd76b4605c12f87c0f2b019 braney Wed Nov 4 14:54:17 2020 -0800 some tweaks to make bigLolly axes work better diff --git src/hg/hgTracks/lollyTrack.c src/hg/hgTracks/lollyTrack.c index ea045a3..b0771dc 100644 --- src/hg/hgTracks/lollyTrack.c +++ src/hg/hgTracks/lollyTrack.c @@ -44,31 +44,31 @@ { double range = lollyCart->upperLimit - lollyCart->lowerLimit; int fontHeight = tl.fontHeight+1; // we need a margin on top and bottom for half a lolly, and some space at the bottom // for the lolly stems double minimumStemHeight = fontHeight; double topAndBottomMargins = LOLLY_DIAMETER / 2 + LOLLY_DIAMETER / 2; double usableHeight = height - topAndBottomMargins - minimumStemHeight; yOff += LOLLY_DIAMETER / 2; struct hashEl *hel = trackDbSettingsLike(tg->tdb, "yAxisLabel*"); // parse lines like yAxisLabel <y offset> <draw line ?> <R,G,B> <label> for(; hel; hel = hel->next) { char *setting = cloneString((char *)hel->val); - int number = atoi(nextWord(&setting)); + double number = atof(nextWord(&setting)); boolean drawLine = sameString("on", nextWord(&setting)); unsigned char red, green, blue; char *colorStr = nextWord(&setting); parseColor(colorStr, &red, &green, &blue); unsigned long lineColor = MAKECOLOR_32(red, green, blue); char *label = setting; int offset = usableHeight * ((double)number - lollyCart->lowerLimit) / range; if (doLabels) hvGfxTextRight(hvg, xOff, yOff + (usableHeight - offset) - fontHeight / 2 , width - 1, fontHeight, color, font, label); else if (drawLine) hvGfxLine(hvg, xOff, yOff + (usableHeight - offset), xOff + width , yOff + (usableHeight - offset), lineColor); } } static void lollyDrawItems(struct track *tg, int seqStart, int seqEnd, @@ -158,31 +158,31 @@ if (isnan(lollyCart->upperLimit)) { hvGfxTextRight(hvg, xOff, yOff + LOLLY_DIAMETER, width - 1, fontHeight, color, font, "NO DATA"); return; } char upper[1024]; safef(upper, sizeof(upper), "%g -", lollyCart->upperLimit); hvGfxTextRight(hvg, xOff, yOff + fontHeight / 2 + LOLLY_DIAMETER / 2 , width - 1, fontHeight, color, font, upper); char lower[1024]; if (lollyCart->lowerLimit < lollyCart->upperLimit) { safef(lower, sizeof(lower), "%g -", lollyCart->lowerLimit); - hvGfxTextRight(hvg, xOff, yOff+height - LOLLY_DIAMETER - fontHeight/2 , width - 1, fontHeight, + hvGfxTextRight(hvg, xOff, yOff+height - LOLLY_DIAMETER / 2 - 2 *fontHeight + fontHeight/2 , width - 1, fontHeight, color, font, lower); } } static int lollyHeight(struct track *tg, enum trackVisibility vis) /* calculate height of all the lollys being displayed */ { if ( tg->visibility == tvDense) return tl.fontHeight; // return the height we calculated at load time return tg->lollyCart->height; }