Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | 1066x 1066x 8x 8x 8x 8x 5x 3x 3x 3x 8x 3x 2x 3x 3x 3x 1705x 542x 1278x 1x 1x 1x 1x 10x 10x 27x 10x 4x | import { DimensionSubtype } from '../enums'; import { rowDiffsetIterator } from '../operator/row-diffset-iterator'; /** * In {@link DataModel}, every tabular data consists of column, a column is stored as field. * Field contains all the data for a given column in an array. * * Each record consists of several fields; the fields of all records form the columns. * Examples of fields: name, gender, sex etc. * * In DataModel, each field can have multiple attributes which describes its data and behaviour. * A field can have two types of data: Measure and Dimension. * * A Dimension Field is the context on which a data is categorized and the measure is the numerical values that * quantify the data set. * In short a dimension is the lens through which you are looking at your measure data. * * Refer to {@link Schema} to get info about possible field attributes. * * @public * @class */ export default class Field { constructor(partialFeild, rowDiff) { this._ref = partialFeild; this._rowDiff = rowDiff; } sanitize () { return this._ref.sanitize(); } parsed (val) { return this._ref.parsed(val); } domain() { let data = []; let domain = null; data = this.getData(); if (this._ref.fieldType === 'dimension' && this._ref.subType() !== DimensionSubtype.TEMPORAL) { domain = [...new Set(data)]; } else { let minD = Math.min.apply(null, data); let maxD = Math.max.apply(null, data); domain = [minD, maxD]; } return domain; } parse (val) { return this._ref.parse(val); } clone(datas) { return this._ref.clone(datas); } fieldName() { return this._ref.fieldName(); } type() { return this._ref.type(); } description() { return this._ref.description(); } get name() { return this._ref.name; } // set name(name) { // this._ref.name = name; // } get schema() { return this._ref.schema; } // set schema(schema) { // this._ref.schema = schema; // } get data() { return this._ref.data; } // set data(schema) { // throw new Error('Not yet implemented!'); // } subType() { return this._ref.subType(); } getMinDiff () { return this._ref.getMinDiff(); } /** * Getter for unit value of the field. * * @return {string} Returns unit of the field. */ unit() { return this._ref.unit(); } /** * Getter for scale value of the field. * * @return {string} Returns scale of the field. */ scale() { return this._ref.scale(); } /** * Getter for aggregation function of the field. * * @return {Function} Returns aggregation function of the field. */ defAggFn() { return this._ref.defAggFn(); } getData() { let data = []; rowDiffsetIterator(this._rowDiff, (i) => { data.push(this._ref.data[i]); }); return data; } bins() { return this._ref.bins(); } } |