Example #1
0
 private Action chooseBivariate(Field x, Field y) {
   // Dates need line charts
   if (x.isDate() && !y.isDate() && !y.preferCategorical()) return makeLineChart(x, y);
   if (y.isDate() && !x.isDate() && !x.preferCategorical()) return makeLineChart(y, x);
   // Heatmaps if either is categorical
   if (x.preferCategorical() || y.preferCategorical())
     return get("heatmap").apply(orderByCoarseness(x, y));
   // Default to scatter
   return get("scatter").apply(orderByCoarseness(x, y));
 }
Example #2
0
 private boolean goodForWordle(Field f) {
   if (!f.preferCategorical()) return false;
   if (f.numericProperty("unique") > 100 || f.numericProperty("unique") < 7) return false;
   // Too long names are not good
   for (Object c : f.categories()) if (c.toString().length() > 20) return false;
   return true;
 }