5a4b3dd2b0a854d819f473d1c891cd7f27a6f76a
kent
  Thu Jan 28 10:32:56 2021 -0800
Improving label, using barChartLabel from trackDb if available in place of 'Sample'

diff --git src/hg/hgc/barChartClick.c src/hg/hgc/barChartClick.c
index ba615fe..9999970 100644
--- src/hg/hgc/barChartClick.c
+++ src/hg/hgc/barChartClick.c
@@ -447,32 +447,33 @@
 double labelWidth = longestLabelSize(categs) + 9;  // Add some because size is just estimate
 if (labelWidth > totalWidth/2) labelWidth = totalWidth/2;  // Don't let labels take up more than half
 double patchWidth = heightPer;
 double labelOffset = patchWidth + 2*borderSize;
 double statsOffset = labelOffset + labelWidth;
 double barOffset = statsOffset + statsSize;
 double statsRightOffset = barOffset - 9;
 double barNumLabelWidth = estimateStringWidth(" 1234.000"); 
 double barMaxWidth = totalWidth-barOffset -barNumLabelWidth ;
 double totalHeight = headerHeight + heightPer * categCount + borderSize;
 
 printf("<svg width=\"%g\" height=\"%g\">\n", totalWidth, totalHeight);
 
 /* Draw header */
 printf("<rect width=\"%g\" height=\"%g\" style=\"fill:#%s\"/>\n", totalWidth, headerHeight, HG_COL_HEADER);
+char *sampleLabel = trackDbSettingOrDefault(tdb, "barChartLabel", "Sample");
 printf("<text x=\"%g\" y=\"%g\" font-size=\"%g\">%s</text>\n", 
-    labelOffset, innerHeight-1, innerHeight-1, "Sample");
+    labelOffset, innerHeight-1, innerHeight-1, sampleLabel);
 if (statsSize > 0.0)
     printf("<text x=\"%g\" y=\"%g\" font-size=\"%g\" text-anchor=\"end\">%s</text>\n", 
 	statsRightOffset, innerHeight-1, innerHeight-1, "N");
 printf("<text x=\"%g\" y=\"%g\" font-size=\"%g\">%s %s</text>\n", 
     barOffset, innerHeight-1, innerHeight-1, metric, "Value");
 
 /* Set up clipping path for the pesky labels, which may be too long */
 printf("<clipPath id=\"labelClip\"><rect x=\"%g\" y=\"0\" width=\"%g\" height=\"%g\"/></clipPath>\n",
     labelOffset, barOffset-labelOffset, totalHeight);
 
 double yPos = headerHeight;
 struct barChartCategory *categ;
 int i;
 for (i=0, categ=categs; i<categCount; ++i , categ=categ->next, yPos += heightPer)
     {