f71ca10651b44457de6f9de23e4de20b41a3dab8 max Thu May 2 13:59:27 2013 -0700 change impact colors diff --git src/hg/hgTracks/pubsTracks.c src/hg/hgTracks/pubsTracks.c index ec05414..708d0e9 100644 --- src/hg/hgTracks/pubsTracks.c +++ src/hg/hgTracks/pubsTracks.c @@ -1,21 +1,27 @@ /* pubsTracks - code for the publications tracks */ #include "common.h" #include "hgTracks.h" #include "hgFind.h" #include "bedCart.h" +// we distinguish between four levels of impact factors <1, <3, <10 and >10 +static struct rgbColor impact1Color = {80, 80, 80}; +static struct rgbColor impact2Color = {0, 80, 255}; +static struct rgbColor impact3Color = {0, 100, 0}; +static struct rgbColor impact4Color = {255, 0, 0}; + static char* pubsArticleTable(struct track *tg) /* return the name of the pubs articleTable, either * the value from the trackDb statement 'articleTable' * or the default value: Article */ { char *articleTable = trackDbSettingClosestToHome(tg->tdb, "pubsArticleTable"); if (isEmpty(articleTable)) { char buf[256]; safef(buf, sizeof(buf), "%sArticle", tg->track); articleTable = cloneString(buf); } return articleTable; } @@ -164,36 +170,44 @@ { struct rgbColor *col = (struct rgbColor*) hashFindVal(pubsClassColors, mainClass); extra->color = col; // add class to mouseover text struct dyString *mo = dyStringNew(0); dyStringAppend(mo, extra->mouseOver); dyStringAppend(mo, " (categories: "); dyStringAppend(mo, classes); dyStringAppend(mo, ")"); freeMem(extra->mouseOver); extra->mouseOver = dyStringContents(mo); } } else { - if (strcmp(colorBy,"impact")==0) + if (sameString(colorBy,"impact")) { - char impInt = atoi(impact); - extra->shade = impInt/25; + int impInt = atoi(impact); + if (impInt<=1) + extra->color = &impact1Color; + else if (impInt<=3) + extra->color = &impact2Color; + else if (impInt<=10) + extra->color = &impact3Color; + else + extra->color = &impact4Color; } - if (strcmp(colorBy,"year")==0) + + if (sameString(colorBy,"year")) { int relYear = (atoi(year)-1990); extra->shade = min(relYear/3, 10); //extra->color = shadesOfGray[yearShade]; } } } } } sqlFreeResult(&sr); return extra; }