23bb7c6df21dec94a2a711c14149da901647104a braney Tue May 17 15:02:54 2016 -0700 use autoscale and maximum scaling mode for density graphs. Also, don't show the wiggle options unless folks have selected density graph diff --git src/hg/lib/hui.c src/hg/lib/hui.c index dee6965..0e68346 100644 --- src/hg/lib/hui.c +++ src/hg/lib/hui.c @@ -4820,39 +4820,44 @@ void wigOption(struct cart *cart, char *name, char *title, struct trackDb *tdb) /* let the user choose to see the track in wiggle mode */ { char *canDoCoverage = cfgOptionEnvDefault("HGDB_CAN_DO_COVERAGE", CanDoCoverageConfVariable, "off"); if (differentString(canDoCoverage, "on")) return; printf("<BR><BR><B>Display data as a density graph:</B> "); char varName[1024]; safef(varName, sizeof(varName), "%s.doWiggle", name); boolean parentLevel = isNameAtParentLevel(tdb,varName); boolean option = cartUsualBooleanClosestToHome(cart, tdb, parentLevel,"doWiggle", FALSE); -//char *optVal = "on"; -//if (! option) - //optVal = "off"; -//printf("<input type=\"CHECKBOX\" name=\"%s\" value=\"on\">\n", varName) - cgiMakeCheckBox(varName, option); printf("<BR>\n"); -printf("<DIV ID=\"densGraphOptions\" STYLE=\"display:none\">\n"); +char *style = option ? "display:block" : "display:none"; +printf("<DIV ID=\"densGraphOptions\" STYLE=\"%s\">\n", style); + +// we need to fool the wiggle dialog into defaulting to autoscale and maximum +char *origType = tdb->type; +tdb->type = "bedGraph"; +if (hashFindVal(tdb->settingsHash, AUTOSCALE) == NULL) + hashAdd(tdb->settingsHash, AUTOSCALE, "on"); +if (hashFindVal(tdb->settingsHash, WINDOWINGFUNCTION) == NULL) + hashAdd(tdb->settingsHash, WINDOWINGFUNCTION, wiggleWindowingEnumToString( wiggleWindowingMax)); wigCfgUi(cart,tdb,name,title,TRUE); +tdb->type = origType; printf("</DIV>\n\n"); printf("<script>\n"); printf(" $(\"input[name='%s']\").click( function() { $('#densGraphOptions').toggle();} );\n", varName); printf("</script>\n\n"); } void wiggleScaleDropDownJavascript(char *name) /* print some js that deactivates the min/max range if autoscaling is activated */ { printf("<script type=\"text/javascript\">\n"); printf(" $(\"[name='%s.autoScale']\").change(function()\n", name); printf(" {\n"); printf(" val= $(this).find(':selected').val(); \n"); printf(" if (val==\"auto-scale to data view\")\n"); printf(" {\n");