111abd9b1a824a8a25bd39d4e8e15ab226d1d40a kate Tue Apr 14 16:29:17 2020 -0700 Simpler syntax for barChart size thresholds. refs #25339 diff --git src/hg/hgTracks/barChartTrack.c src/hg/hgTracks/barChartTrack.c index 56a4913..53af950 100644 --- src/hg/hgTracks/barChartTrack.c +++ src/hg/hgTracks/barChartTrack.c @@ -353,35 +353,43 @@ #define MIN_BAR_CHART_MODEL_HEIGHT 1 #define WIN_MAX_GRAPH_DEFAULT 50000 #define MAX_GRAPH_HEIGHT 175 #define MAX_BAR_WIDTH 5 #define MAX_GRAPH_PADDING 2 #define WIN_MED_GRAPH_DEFAULT 500000 #define MED_GRAPH_HEIGHT 100 #define MED_BAR_WIDTH 3 #define MED_GRAPH_PADDING 1 #define MIN_BAR_WIDTH 1 #define MIN_GRAPH_PADDING 0 -char *setting = trackDbSetting(tdb, BAR_CHART_WIN_MAX_GRAPH); -extras->winMaxGraph = isNotEmpty(setting) ? atoi(setting) : WIN_MAX_GRAPH_DEFAULT; -setting = trackDbSetting(tdb, BAR_CHART_WIN_MED_GRAPH); -extras->winMedGraph = isNotEmpty(setting) ? atoi(setting) : WIN_MED_GRAPH_DEFAULT; - +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); 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;