ca96dfa92667ad79f4d247e25befab59cfa90258 kate Thu Apr 13 12:49:53 2017 -0700 Add barChartColors setting to allow specifying barchart colors by name. Add HTML color names support to lib. refs #18736 diff --git src/hg/inc/barChartUi.h src/hg/inc/barChartUi.h index 224e311..6b3858d 100644 --- src/hg/inc/barChartUi.h +++ src/hg/inc/barChartUi.h @@ -1,81 +1,84 @@ /* barChart track UI */ /* Copyright (C) 2015 The Regents of the University of California * See README in this or parent directory for licensing information. */ #ifndef BAR_CHARTUI_H #define BAR_CHARTUI_H /* Color scheme */ #define BAR_CHART_COLORS "colorScheme" #define BAR_CHART_COLORS_RAINBOW "rainbow" /* Color scheme from user */ #define BAR_CHART_COLORS_USER "user" #define BAR_CHART_COLORS_DEFAULT BAR_CHART_COLORS_USER /* Data transform */ // WARNING: this also appears in JS #define BAR_CHART_LOG_TRANSFORM "logTransform" #define BAR_CHART_LOG_TRANSFORM_DEFAULT TRUE /* Viewing limits */ // WARNING: this also appears in JS #define BAR_CHART_MAX_LIMIT "maxLimit" #define BAR_CHART_MAX_LIMIT_DEFAULT 300 /* TODO: Get default from trackDb ? */ /* Category (bar) info */ #define BAR_CHART_MAX_CATEGORIES 100 /* Category filter */ #define BAR_CHART_CATEGORY_SELECT "categories" /* Labels for categories */ #define BAR_CHART_CATEGORY_LABELS "barChartBars" #define BAR_CHART_CATEGORY_LABEL "barChartLabel" #define BAR_CHART_CATEGORY_LABEL_DEFAULT "Categories" +/* Colors for categories */ +#define BAR_CHART_CATEGORY_COLORS "barChartColors" + /* Units to display on bar mouseover */ #define BAR_CHART_UNIT "barChartUnit" /* Suppress whiteout behind graph (to show highlight and blue lines) */ #define BAR_CHART_NO_WHITEOUT "noWhiteout" #define BAR_CHART_NO_WHITEOUT_DEFAULT FALSE void barChartCfgUi(char *database, struct cart *cart, struct trackDb *tdb, char *track, char *title, boolean boxed); /* Bar chart track type */ #define barChartAutoSqlString \ "table barChartBed\n" \ "\"BED6+ with additional fields for category count and values\"\n" \ "(\n" \ "string chrom; \"Reference sequence chromosome or scaffold\"\n" \ "uint chromStart; \"Start position in chromosome\"\n" \ "uint chromEnd; \"End position in chromosome\"\n" \ "string name; \"Item identifier\"\n" \ "uint score; \"Score from 0-1000; derived from total median all categories (log-transformed and scaled)\"\n" \ "char[1] strand; \"+ or - for strand\"\n" \ "uint expCount; \"Number of categories\"\n" \ "float[expCount] expScores; \"Comma separated list of category values\"\n" \ ")\n" double barChartUiMaxMedianScore(); /* Max median score, for scaling */ struct barChartCategory *barChartUiGetCategories(char *database, struct trackDb *tdb); /* Get category colors and descriptions. * If barChartLabel setting contains label list, assign rainbow colors. * O/w look for a table naed track+Category, and use labels and colors there */ struct barChartCategory *barChartUiGetCategoryById(int id, char *database, struct trackDb *tdb); /* Get category info by id */ char *barChartUiGetCategoryLabelById(int id, char *database, struct trackDb *tdb); /* Get label for a category id */ char *barChartUiGetLabel(char *database, struct trackDb *tdb); /* Get label for category list */ #endif /* BAR_CHARTUI_H */