b33425c626414803bbddc702caecc256c5022277
max
Fri Mar 20 09:10:59 2026 -0700
defining detailsHistogram tdb statements and an example histogram drawing code for it, used in the trexplorer track, refs #37273
diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c
index fafdfa1af60..ba853ae81d5 100644
--- src/hg/hgc/hgc.c
+++ src/hg/hgc/hgc.c
@@ -1745,51 +1745,69 @@
if (strchr(tmp->name, '|'))
{
title = strchr(fieldName, '|');
*title++ = 0;
}
struct embeddedTbl *new;
AllocVar(new);
new->field = fieldName;
new->title = title != NULL ? cloneString(title) : fieldName;
slAddHead(retList, new);
slNameAddHead(retFieldNames, fieldName);
hashAdd(embeddedTblHash, fieldName, new);
}
}
-void printFieldLabel(char *entry)
+static void printFieldLabelInner(char *entry, char *fieldName)
/* print the field label, the first column in the table, as a
. Allow a
* longer description after a |-char, as some fields are not easy to
- * understand. */
+ * understand. If fieldName is not NULL, add id="bfld_" to . */
{
char *afterPipe = strchr(entry, '|');
if (afterPipe)
*afterPipe = 0;
+if (fieldName)
+ printf(" | %s", fieldName, entry);
+else
printf(" | %s", entry);
if (afterPipe)
{
// Could also have a "?" icon and show the description on mouse over
afterPipe++; // skip past | character
printf("
| ");
}
+void printFieldLabel(char *entry)
+/* print the field label, the first column in the table, as a . Allow a
+ * longer description after a |-char, as some fields are not easy to
+ * understand. */
+{
+printFieldLabelInner(entry, NULL);
+}
+
+void printFieldLabelWithId(char *entry, char *fieldName)
+/* Like printFieldLabel but adds id="bfld_" to the element,
+ * so JavaScript can find the row by field name. */
+{
+printFieldLabelInner(entry, fieldName);
+}
+
#define TDB_STATICTABLE_SETTING "extraDetailsTable"
#define TDB_STATICTABLE_SETTING_2 "detailsStaticTable"
int extraFieldsPrintAs(struct trackDb *tdb,struct sqlResult *sr,char **fields,int fieldCount, struct asObject *as)
// Any extra bed or bigBed fields (defined in as and occurring after N in bed N + types.
// sr may be null for bigBeds.
// Returns number of extra fields actually printed.
{
// We are trying to print extra fields so we need to figure out how many fields to skip
int start = extraFieldsStart(tdb, fieldCount, as);
struct asColumn *col = as->columnList;
char *urlsStr = trackDbSettingClosestToHomeOrDefault(tdb, "urls", NULL);
struct hash* fieldToUrl = hashFromString(urlsStr);
boolean skipEmptyFields = trackDbSettingOn(tdb, "skipEmptyFields");
@@ -1914,31 +1932,31 @@
printf(" \n\n | |