final ColumnMetaData metaData = columnMetaData.get(attKey.toUpperCase());
if (metaData == null) {
return Color.gray;
}
if (metaData.isNumeric()) {
AbstractColorScale cs = colorScales.get(attKey);
{
if (cs == null) {
// Create color scale based loosely on Brewer diverging / sequential palletes
// TODO -- use actual brewer palletes if # of values < 8
if (metaData.isDiverging()) {
// reg-blue diverging
Color minColor = new Color(198, 219, 239);
Color midColor = Color.white;
Color maxColor = new Color(33, 102, 172);
cs = new ContinuousColorScale(metaData.getMin(), 0, metaData.getMax(), minColor, midColor, maxColor);
colorScales.put(attKey, cs);
} else {
// Blues scale
Color minColor = new Color(198, 219, 239);
Color maxColor = new Color(8, 69, 148);
cs = new ContinuousColorScale(metaData.getMin(), metaData.getMax(), minColor, maxColor);
colorScales.put(attKey, cs);
}
}
try {
float x = Float.parseFloat(attValue);
return cs.getColor(x);
} catch (NumberFormatException e) {
return Color.lightGray;
}