2f718ddd0797fc5c618bac72c546008d596ca9c1 kent Sun Jan 17 09:42:52 2021 -0800 Making scaling of barChart bar widths overall slightly wider, and allowing more modulation. diff --git src/hg/hgTracks/barChartTrack.c src/hg/hgTracks/barChartTrack.c index 133f42d..79e3fe0 100644 --- src/hg/hgTracks/barChartTrack.c +++ src/hg/hgTracks/barChartTrack.c @@ -364,31 +364,43 @@ #define MIN_GRAPH_PADDING 0 extras->winMaxGraph = WIN_MAX_GRAPH_DEFAULT; extras->winMedGraph = WIN_MED_GRAPH_DEFAULT; char *setting = trackDbSetting(tdb, BAR_CHART_SIZE_WINDOWS); if (isNotEmpty(setting)) { char *words[2]; int ct = chopLine(setting, words); if (ct == 2) { extras->winMaxGraph = atoi(words[0]); extras->winMedGraph = atoi(words[1]); } } -int scale = (getCategoryCount(tg) < 15 ? 2 : 1); +int barCount = getCategoryCount(tg); +double scale = 1.0; +if (barCount < 20) + scale = 2.0; +else if (barCount < 40) + scale = 1.5; +else if (barCount < 80) + scale = 1.0; +else if (barCount < 120) + scale = 0.75; +else + scale = 0.5; + long winSize = virtWinBaseCount; if (winSize < extras->winMaxGraph && sameString(extras->maxGraphSize, BAR_CHART_MAX_GRAPH_SIZE_LARGE)) { extras->boxModelHeight = MAX_BAR_CHART_MODEL_HEIGHT; extras->barWidth = MAX_BAR_WIDTH * scale; extras->padding = MAX_GRAPH_PADDING; extras->maxHeight = MAX_GRAPH_HEIGHT; } else if (winSize < extras->winMedGraph && differentString(extras->maxGraphSize, BAR_CHART_MAX_GRAPH_SIZE_SMALL)) { extras->boxModelHeight = MED_BAR_CHART_MODEL_HEIGHT; extras->barWidth = MED_BAR_WIDTH * scale; extras->padding = MED_GRAPH_PADDING;