static void leftLabel(struct hvGfx *hvg, struct genoLay *gl,
	struct genoLayChrom *chrom, int yOffset, int fontHeight,
	int color)
/* Draw a chromosome with label on left. */
{
hvGfxTextRight(hvg, gl->margin, chrom->y + yOffset, 
    chrom->x - gl->margin - gl->spaceWidth, fontHeight, color,
    gl->font, chrom->shortName);
}
示例#2
0
void cgLeftLabels(struct track *tg, int seqStart, int seqEnd,
	struct hvGfx *hvg, int xOff, int yOff, int width, int height,
	boolean withCenterLabels, MgFont *font, Color color,
	enum trackVisibility vis)
/* Draw labels to the left. */
{
struct chromGraphSettings *cgs = tg->customPt;
if (vis == tvDense || cgs->linesAtCount == 0)
    {
    hvGfxTextRight(hvg, xOff, yOff, width - 1, height,
	color, font, tg->shortLabel);
    }
else
    {
    int i;
    int realHeight = height;
    int realYoff = yOff;
    double minVal = cgs->minVal;
    double yScale;
    int tickSize = tl.nWidth;
    int numPos = tickSize * 1.25;

    if (withCenterLabels)
        {
	int centerLabelHeight = tl.fontHeight;
	realHeight -= centerLabelHeight;
	realYoff += centerLabelHeight;
	}
    yScale = (realHeight-1)/(cgs->maxVal - minVal);
    for (i=0; i<cgs->linesAtCount; ++i)
        {
	double val = cgs->linesAt[i];
	int y = realHeight - 1 - (val - minVal)*yScale + realYoff;
	char numText[16];
	hvGfxBox(hvg, xOff + width - tickSize, y, tickSize, 1, color);
	safef(numText, sizeof(numText), "%g", val);
        hvGfxTextRight(hvg, xOff, y - tl.fontHeight+2,
		width - numPos, tl.fontHeight,
		color, font, numText);
	}
    wrapTextAndCenter(hvg, xOff+1, yOff, width*5*tl.nWidth, height,
                      font, color, tg->shortLabel);
    }
}
static void midLabel(struct hvGfx *hvg, struct genoLay *gl,
	struct genoLayChrom *chrom, int yOffset, int fontHeight, 
	int color)
/* Draw a chromosome with label on left. */
{
MgFont *font = gl->font;
int textWidth = mgFontStringWidth(font, chrom->shortName);
hvGfxTextRight(hvg, chrom->x - textWidth - gl->spaceWidth, 
    chrom->y + yOffset, 
    textWidth, fontHeight, color,
    font, chrom->shortName);
}
void samplePrintYAxisLabel( struct hvGfx *hvg, int y, struct track *track, char *labelString,
	double min0, double max0 )
	/*print a label for a horizontal y-axis line*/
{
	double tmp;
	int fontHeight = tl.fontHeight;
	double ymin = y - (track->heightPer / 2) + fontHeight;
	int itemHeight0 = track->itemHeight(track, track->items);
	int inWid = insideX-gfxBorder*3;

	tmp = -whichSampleBin( atof(labelString), min0, max0, 1000 );
	tmp = (int)((double)ymin+((double)tmp)*(double)track->heightPer/1000.0+(double)track->heightPer)-fontHeight/2.0;
	if( !withCenterLabels ) tmp -= fontHeight;
	hvGfxTextRight(hvg, gfxBorder, tmp, inWid-1, itemHeight0, track->ixColor, tl.font, labelString );
}
示例#5
0
static void maybeDrawLeftLabels(struct track *tg, int seqStart, int seqEnd, struct hvGfx *hvg,
			       int xOff, int yOff, int width, int height, boolean withCenterLabels,
			       MgFont *font, Color color, enum trackVisibility vis)
/* If this is invoked, we are hiding item labels.  In full mode, that means no left labels.
 * In dense mode, we do need the left label to show shortLabel. */
{
if (tg->limitedVis == tvDense)
    {
    int fontHeight = mgFontLineHeight(font);
    if (isCenterLabelIncluded(tg))
	yOff += fontHeight;
    hvGfxTextRight(hvg, xOff, yOff, width, tg->lineHeight, color, font, tg->shortLabel);
    }
return;
}
示例#6
0
static void multiWigLeftLabels(struct track *tg, int seqStart, int seqEnd,
	struct hvGfx *hvg, int xOff, int yOff, int width, int height,
	boolean withCenterLabels, MgFont *font, Color color,
	enum trackVisibility vis)
/* Draw left labels - by deferring to first subtrack. */
{
struct wigCartOptions *wigCart = tg->wigCartData;
if (wigCart->aggregateFunction != wiggleAggregateNone)
    {
    struct track *firstVisibleSubtrack = NULL;
    boolean showNumbers = graphLimitsAllSame(tg->subtracks, &firstVisibleSubtrack);
    struct track *subtrack = (showNumbers ? firstVisibleSubtrack : tg->subtracks);
    wigLeftAxisLabels(tg, seqStart, seqEnd, hvg, xOff, yOff, width, height, withCenterLabels,
	    font, color, vis, tg->shortLabel, subtrack->graphUpperLimit, 
	    subtrack->graphLowerLimit, showNumbers);
    }
else
    {
    struct track *subtrack;
    int y = yOff;
    if (withCenterLabels)
       y += tl.fontHeight+1;
    for (subtrack = tg->subtracks; subtrack != NULL; subtrack = subtrack->next)
	{
	if (isSubtrackVisible(subtrack))
	    {
	    int height = subtrack->totalHeight(subtrack, vis);
	    if (vis == tvDense)
	        {
		/* Avoid wigLeftAxisLabels here because it will repeatedly add center label 
		 * offsets, and in dense mode we will only draw the one label. */
		hvGfxTextRight(hvg, xOff, y, width - 1, height, subtrack->ixColor, font, 
			subtrack->shortLabel);
		}
	    else
		{
                // black labels for readability 
		wigLeftAxisLabels(subtrack, seqStart, seqEnd, hvg, xOff, y, width, height, 
			withCenterLabels, font, MG_BLACK, vis, subtrack->shortLabel, 
			subtrack->graphUpperLimit, subtrack->graphLowerLimit, TRUE);
		}
	    y += height+1;
	    }
	}
    }
}