* @constructor * @param {Object} fields * @param {string} fields.sourceFormat * @param {Array|Object} fields.fromDataset * @param {Array|Object} [fields.data] * @param {string} [seriesLayoutBy='column'] * @param {Array. } [dimensionsDefine] * @param {Objet|HashMap} [encodeDefine
(fields)
| 20491 | * @param {number} [dimensionsDetectCount] |
| 20492 | */ |
| 20493 | function Source(fields) { |
| 20494 | |
| 20495 | /** |
| 20496 | * @type {boolean} |
| 20497 | */ |
| 20498 | this.fromDataset = fields.fromDataset; |
| 20499 | |
| 20500 | /** |
| 20501 | * Not null/undefined. |
| 20502 | * @type {Array|Object} |
| 20503 | */ |
| 20504 | this.data = fields.data || ( |
| 20505 | fields.sourceFormat === SOURCE_FORMAT_KEYED_COLUMNS ? {} : [] |
| 20506 | ); |
| 20507 | |
| 20508 | /** |
| 20509 | * See also "detectSourceFormat". |
| 20510 | * Not null/undefined. |
| 20511 | * @type {string} |
| 20512 | */ |
| 20513 | this.sourceFormat = fields.sourceFormat || SOURCE_FORMAT_UNKNOWN; |
| 20514 | |
| 20515 | /** |
| 20516 | * 'row' or 'column' |
| 20517 | * Not null/undefined. |
| 20518 | * @type {string} seriesLayoutBy |
| 20519 | */ |
| 20520 | this.seriesLayoutBy = fields.seriesLayoutBy || SERIES_LAYOUT_BY_COLUMN; |
| 20521 | |
| 20522 | /** |
| 20523 | * dimensions definition in option. |
| 20524 | * can be null/undefined. |
| 20525 | * @type {Array.<Object|string>} |
| 20526 | */ |
| 20527 | this.dimensionsDefine = fields.dimensionsDefine; |
| 20528 | |
| 20529 | /** |
| 20530 | * encode definition in option. |
| 20531 | * can be null/undefined. |
| 20532 | * @type {Objet|HashMap} |
| 20533 | */ |
| 20534 | this.encodeDefine = fields.encodeDefine && createHashMap(fields.encodeDefine); |
| 20535 | |
| 20536 | /** |
| 20537 | * Not null/undefined, uint. |
| 20538 | * @type {number} |
| 20539 | */ |
| 20540 | this.startIndex = fields.startIndex || 0; |
| 20541 | |
| 20542 | /** |
| 20543 | * Can be null/undefined (when unknown), uint. |
| 20544 | * @type {number} |
| 20545 | */ |
| 20546 | this.dimensionsDetectCount = fields.dimensionsDetectCount; |
| 20547 | } |
| 20548 | |
| 20549 | /** |
| 20550 | * Wrap original series data for some compatibility cases. |
nothing calls this directly
no test coverage detected