row[i];
char buf[16];
safef(buf, sizeof(buf), "%g", chart->expScores[rowIx]);
newRow[oldFieldCount] = lmCloneString(newTable->lm, buf);
fieldedTableAdd(newTable, newRow, newFieldCount, fr->id);
}
return newTable;
}
void facetedBarChart(char *item, struct barChartBed *chart, struct trackDb *tdb,
double maxVal, char *statsFile, char *facets, char *metric)
{
char *trackName = tdb->track;
struct sqlConnection *conn = sqlConnect(database);
struct hash *wrapperHash = hashNew(0);
/* Load up table from tsv file */
char *requiredStatsFields[] = {"count",};
struct fieldedTable *statsTable = fieldedTableFromTabFile(statsFile, statsFile,
requiredStatsFields, ArraySize(requiredStatsFields));
struct fieldedTable *table = addChartVals(statsTable, chart);
/* Update facet selections from users input if any and get selected part of table */
struct facetedTable *facTab = facetedTableFromTable(table, trackName, facets);
facTab->mergeFacetsOk = trackDbSettingOn(tdb, "barChartMerge");
boolean trackDbSettingOn(struct trackDb *tdb, char *name);
/* Return true if a tdb setting is "on" "true" or "enabled". */
facetedTableUpdateOnClick(facTab, cart);
struct facetField **selectedFf = NULL;
struct fieldedTable *selected = facetedTableSelect(facTab, cart, &selectedFf);
/* Write html to make white background */
hInsideStyleToWhite();
/* Add a few extra status bits and a way back home before facets and table display */
printf(" Bars selected: %d of %d", selected->rowCount, table->rowCount);
printf(" Return to Genome Browser\n",
hgTracksPathAndSettings());
/* Set up url that has enough context to get back to us. */
struct dyString *returnUrl = dyStringNew(0);
dyStringPrintf(returnUrl, "../cgi-bin/hgc?g=%s", trackName);
if (item != NULL)
dyStringPrintf(returnUrl, "&i=%s", item);
dyStringPrintf(returnUrl, "&%s", cartSidUrlString(cart));
/* Working within a form we save context. It'd be nice to work outside of form someday. */
printf("
\n");
facetedTableFree(&facTab);
sqlDisconnect(&conn);
}