inferType method

String inferType(
  1. VlJson ch
)

Implementation

String inferType(VlJson ch) {
  if ( ch.has("bin") ) {
    return "quantitative";
  }
  if ( ch.has("timeUnit") ) {
    return "temporal";
  }
  if ( ch.has("aggregate") ) {
    return "quantitative";
  }
  if ( false == ch.has("field") ) {
    return "";
  }
  String field = ch.stringOr("field", "");
  if ( data!.count() == 0 ) {
    return "nominal";
  }
  String kind = this.data!.fieldType(field);
  if ( kind.length == 0 ) {
    this.error(("the data has no column called '" + field) + "'");
    return "nominal";
  }
  return kind;
}