6f6e92974abbae677788fb7aab518d125ed84ed9 braney Wed Feb 1 12:25:09 2012 -0800 when autoscaling and the range is 0 (ie. all values are the same), add one to the range so a bar is drawn (#6763) diff --git src/hg/hgTracks/wigTrack.c src/hg/hgTracks/wigTrack.c index 629debb..d423ba4 100644 --- src/hg/hgTracks/wigTrack.c +++ src/hg/hgTracks/wigTrack.c @@ -1185,31 +1185,45 @@ } else { if (overallUpperLimit < thisOverallUpperLimit) overallUpperLimit = thisOverallUpperLimit; if (overallLowerLimit > thisOverallLowerLimit) overallLowerLimit = thisOverallLowerLimit; if (graphUpperLimit < thisGraphUpperLimit) graphUpperLimit = thisGraphUpperLimit; if (graphLowerLimit > thisGraphLowerLimit) graphLowerLimit = thisGraphLowerLimit; } } overallRange = overallUpperLimit - overallLowerLimit; + +/* if we're autoscaling and the range is 0 this implies that all values + * in the given range are the same. We create a bottom of the scale + * by subtracting one from the only value. + * This results in drawing a box that fills the range. */ +if ((graphUpperLimit == graphLowerLimit)) + { + graphRange = 1.0; + graphLowerLimit = graphUpperLimit - 1; + } +else + { graphRange = graphUpperLimit - graphLowerLimit; + } + epsilon = graphRange / tg->lineHeight; struct preDrawElement *preDraw = preDrawList->preDraw; colorArray = makeColorArray(preDraw, width, preDrawZero, wigCart, tg, hvg); /* now draw all the containers */ for(preContainer = preDrawList; preContainer; preContainer = preContainer->next) { struct preDrawElement *preDraw = preContainer->preDraw; graphPreDraw(preDraw, preDrawZero, width, tg, hvg, xOff, yOff, graphUpperLimit, graphLowerLimit, graphRange, epsilon, colorArray, vis, wigCart); } drawZeroLine(vis, wigCart->horizontalGrid, graphUpperLimit, graphLowerLimit,