d3f9b9ecf2a6d30bd8f97566f72e5650982c308d
kent
  Mon Dec 13 15:22:03 2021 -0800
Adding hgTracks display of merged bar charts.

diff --git src/hg/inc/facetedTable.h src/hg/inc/facetedTable.h
index 705058f..6f25360 100644
--- src/hg/inc/facetedTable.h
+++ src/hg/inc/facetedTable.h
@@ -51,17 +51,44 @@
 void facetedTableWriteHtml(struct facetedTable *facTab, 
     struct cart *cart,		    /* User settingss and stuff */
     struct fieldedTable *selected,  /* Table that just contains rows that survive selection */
     struct facetField **selectedFf, /* Fields that survive selection */
     char *displayList,		    /* Comma separated list of fields to display in table */
     char *returnUrl,		    /* Url that takes us back to page we are writing next click */
     int maxFieldWidth,		    /* How big do we let fields get in characters */
     struct hash *tagOutWrappers,    /* A hash full of callbacks, keyed by field name */
     void *wrapperContext,	    /* Gets passed to callbacks in tagOutWrappers */
     int facetUsualSize);	    /* Ho many items in a facet before opening */
 /* Write out the main HTML associated with facet selection and table. */
 
 struct slInt *facetedTableSelectOffsets(struct facetedTable *facTab, struct cart *cart);
 /* Return a list of row positions that pass faceting */
 
+struct facetedTableCountOffset
+/* An offset to a value field, and a count to help us merge values */
+    {
+    struct facetedTableCountOffset *next;
+    int valIx;		/* Index of value field */
+    int count;		/* How many samples are behind this value */
+    };
+
+struct facetedTableMergedOffset
+/* What we need to know to merge */
+    {
+    struct facetedTableMergedOffset *next;
+    char *name;	/* Name of merged bar */
+    char color[8];  /* Color for merged bar */
+    int totalCount;  /* Total count of all merged elements  */
+    struct facetedTableCountOffset *colList; /* List of indexes int parent table to sum together */
+    int outIx;	/* Position in output file */
+    };
+
+struct facetedTableMergedOffset *facetedTableMakeMergedOffsets(struct facetedTable *facTab,
+     struct cart *cart);
+/* Return a structure that will let us relatively rapidly merge together one row */
+
+void facetedTableMergeVals(struct facetedTableMergedOffset *tmoList, float *inVals, float *outVals);
+/* Populate outVals array with columns of weighted averages derived from applying
+ * tmoList to inVals array. */
+
 #endif /* FACETEDTABLE_H */