26eb6b9c0a1ac1170fc56b963a7e8b726e4cb3d6
braney
  Mon Jul 28 11:33:14 2014 -0700
be more selective about when calling a javascript routine that isn'talways loaded.  Thanks Tim!

diff --git src/hg/lib/hui.c src/hg/lib/hui.c
index 70f1459..dc3cd07 100644
--- src/hg/lib/hui.c
+++ src/hg/lib/hui.c
@@ -4633,47 +4633,50 @@
 
 wigFetchTransformFuncWithCart(cart,tdb,name, &transformFunc);
 wigFetchAlwaysZeroWithCart(cart,tdb,name, &alwaysZero);
 wigFetchHorizontalGridWithCart(cart,tdb,name, &horizontalGrid);
 wigFetchAutoScaleWithCart(cart,tdb,name, &autoScale);
 wigFetchGraphTypeWithCart(cart,tdb,name, &lineBar);
 wigFetchWindowingFunctionWithCart(cart,tdb,name, &windowingFunction);
 wigFetchSmoothingWindowWithCart(cart,tdb,name, &smoothingWindow);
 wigFetchYLineMarkWithCart(cart,tdb,name, &yLineMarkOnOff);
 wigFetchYLineMarkValueWithCart(cart,tdb,name, &yLineMark);
 boolean doNegative = wigFetchDoNegativeWithCart(cart,tdb,tdb->track, (char **) NULL);
 
 printf("<TABLE BORDER=0>");
 
 boolean parentLevel = isNameAtParentLevel(tdb, name);
+boolean didAggregate = FALSE;
 if (parentLevel)
     {
     assert(tdb->parent != NULL);
     char *aggregate = trackDbSetting(tdb->parent, "aggregate");
     if (aggregate != NULL && parentLevel)
         {
         char *aggregateVal = cartOrTdbString(cart, tdb->parent, "aggregate", NULL);
         printf("<TR valign=center><th align=right>Overlay method:</th><td align=left>");
         safef(option, sizeof(option), "%s.%s", name, AGGREGATE);
         aggregateDropDown(option, aggregateVal);
         puts("</td></TR>");
 
 	if (sameString(aggregateVal, WIG_AGGREGATE_STACKED)  &&
 	    sameString(windowingFunction, "mean+whiskers"))
 	    {
 	    windowingFunction = "maximum";
 	    }
+
+	didAggregate = TRUE;
         }
     }
 
 printf("<TR valign=center><th align=right>Type of graph:</th><td align=left>");
 safef( option, sizeof(option), "%s.%s", name, LINEBAR );
 wiggleGraphDropDown(option, lineBar);
 if (boxed)
     {
     printf("</td><td align=right colspan=2>");
     printf("<A HREF=\"%s\" TARGET=_blank>Graph configuration help</A>",WIGGLE_HELP_PAGE);
     }
 puts("</td></TR>");
 
 printf("<TR valign=center><th align=right>Track height:</th><td align=left colspan=3>");
 safef(option, sizeof(option), "%s.%s", name, HEIGHTPER );
@@ -4726,31 +4729,32 @@
 wiggleGridDropDown(option, horizontalGrid);
 printf("&nbsp;&nbsp;&nbsp;at y =");
 safef(option, sizeof(option), "%s.%s", name, YLINEMARK );
 cgiMakeDoubleVarInRange(option, yLineMark, "Indicator at Y", 0, NULL, NULL);
 safef(option, sizeof(option), "%s.%s", name, YLINEONOFF );
 wiggleYLineMarkDropDown(option, yLineMarkOnOff);
 printf("</td>");
 if (boxed)
     puts("</TD></TR></TABLE>");
 else
     {
     puts("</TD></TR></TABLE>");
     printf("<A HREF=\"%s\" TARGET=_blank>Graph configuration help</A>",WIGGLE_HELP_PAGE);
     }
 
-// add a little javascript call to make sure we don't get whiskers with stacks
+// add a little javascript call to make sure we don't get whiskers with stacks in multiwigs
+if (didAggregate)
     printf("<script> $(function () { multiWigSetupOnChange('%s'); }); </script>\n", name);
 
 cfgEndBox(boxed);
 }
 
 
 void filterButtons(char *filterTypeVar, char *filterTypeVal, boolean none)
 /* Put up some filter buttons. */
 {
 printf("<B>Filter:</B> ");
 radioButton(filterTypeVar, filterTypeVal, "red");
 radioButton(filterTypeVar, filterTypeVal, "green");
 radioButton(filterTypeVar, filterTypeVal, "blue");
 radioButton(filterTypeVar, filterTypeVal, "exclude");
 radioButton(filterTypeVar, filterTypeVal, "include");