e6703f147ca6cbcfaf6a31151a89df2ecff62139
braney
  Tue Jan 13 15:22:43 2015 -0800
fix stacked bar charts to draw in the order they appear on the trackUipage (via Kate)

diff --git src/hg/hgTracks/multiWig.c src/hg/hgTracks/multiWig.c
index 825ff78..03abb36 100644
--- src/hg/hgTracks/multiWig.c
+++ src/hg/hgTracks/multiWig.c
@@ -280,30 +280,34 @@
 	numTracks++;
 	if (subtrack->networkErrMsg)
 	    errMsgFound = TRUE;
 	}
     }
 
 if (errMsgFound)
     {
     Color yellow = hvGfxFindRgb(hvg, &undefinedYellowColor);
     hvGfxBox(hvg, xOff, yOff, width, tg->height, yellow);
     }
 
 struct wigCartOptions *wigCart = tg->wigCartData;
 struct wigGraphOutput *wgo = setUpWgo(xOff, yOff, width, tg->height, numTracks, wigCart, hvg);
 
+// we want to the order to be the same in all the modes 
+if (wigCart->aggregateFunction == wiggleAggregateStacked)
+    slReverse(&tg->subtracks);
+
 /* Cope with autoScale and stacked bars - we do it here rather than in the child tracks, so that
  * all children can be on same scale. */
 double minVal, maxVal;
 
 /* Force load of all predraw arrays so can do calcs. Build up list, and then
  * figure out max/min.  No worries about multiple loading, the loaders protect
  * themselves. */
 struct slRef *refList = NULL;
 for (subtrack = tg->subtracks; subtrack != NULL; subtrack = subtrack->next)
     {
     if (isSubtrackVisible(subtrack))
 	{
 	struct preDrawContainer *pre = subtrack->loadPreDraw(subtrack, seqStart, seqEnd, width);
 
 	if (pre != NULL)  // pre maybe null if the load fails