datamodel
Version:
Relational algebra compliant in-memory tabular data store
46 lines (42 loc) • 908 B
JavaScript
import Field from '../field';
/**
* Represents dimension field type.
*
* @public
* @class
* @extends Field
*/
export default class Dimension extends Field {
/**
* Returns the domain for the dimension field.
*
* @override
* @public
* @return {any} Returns the calculated domain.
*/
domain () {
if (!this._cachedDomain) {
this._cachedDomain = this.calculateDataDomain();
}
return this._cachedDomain;
}
/**
* Calculates the corresponding field domain.
*
* @public
* @abstract
*/
calculateDataDomain () {
throw new Error('Not yet implemented');
}
/**
* Returns the formatted version of the underlying field data.
*
* @public
* @override
* @return {Array} Returns the formatted data.
*/
formattedData () {
return this.data();
}
}