* @param dimensionsInput.dimensions * For example, ['someDimName', {name: 'someDimName', type: 'someDimType'}, ...]. * Dimensions should be concrete names like x, y, z, lng, lat, angle, radius
(
dimensionsInput: SeriesDataSchema | SeriesDimensionDefineLoose[],
hostModel: HostModel
)
| 266 | * Dimensions should be concrete names like x, y, z, lng, lat, angle, radius |
| 267 | */ |
| 268 | constructor( |
| 269 | dimensionsInput: SeriesDataSchema | SeriesDimensionDefineLoose[], |
| 270 | hostModel: HostModel |
| 271 | ) { |
| 272 | let dimensions: SeriesDimensionDefineLoose[]; |
| 273 | let assignStoreDimIdx = false; |
| 274 | if (isSeriesDataSchema(dimensionsInput)) { |
| 275 | dimensions = dimensionsInput.dimensions; |
| 276 | this._dimOmitted = dimensionsInput.isDimensionOmitted(); |
| 277 | this._schema = dimensionsInput; |
| 278 | } |
| 279 | else { |
| 280 | assignStoreDimIdx = true; |
| 281 | dimensions = dimensionsInput as SeriesDimensionDefineLoose[]; |
| 282 | } |
| 283 | |
| 284 | dimensions = dimensions || ['x', 'y']; |
| 285 | |
| 286 | const dimensionInfos: Dictionary<SeriesDimensionDefine> = {}; |
| 287 | const dimensionNames = []; |
| 288 | const invertedIndicesMap: Dictionary<number[]> = {}; |
| 289 | let needsHasOwn = false; |
| 290 | const emptyObj = {}; |
| 291 | |
| 292 | for (let i = 0; i < dimensions.length; i++) { |
| 293 | // Use the original dimensions[i], where other flag props may exists. |
| 294 | const dimInfoInput = dimensions[i]; |
| 295 | |
| 296 | const dimensionInfo: SeriesDimensionDefine = |
| 297 | zrUtil.isString(dimInfoInput) |
| 298 | ? new SeriesDimensionDefine({name: dimInfoInput}) |
| 299 | : !(dimInfoInput instanceof SeriesDimensionDefine) |
| 300 | ? new SeriesDimensionDefine(dimInfoInput) |
| 301 | : dimInfoInput; |
| 302 | |
| 303 | const dimensionName = dimensionInfo.name; |
| 304 | dimensionInfo.type = dimensionInfo.type || 'float'; |
| 305 | if (!dimensionInfo.coordDim) { |
| 306 | dimensionInfo.coordDim = dimensionName; |
| 307 | dimensionInfo.coordDimIndex = 0; |
| 308 | } |
| 309 | |
| 310 | const otherDims = dimensionInfo.otherDims = dimensionInfo.otherDims || {}; |
| 311 | dimensionNames.push(dimensionName); |
| 312 | dimensionInfos[dimensionName] = dimensionInfo; |
| 313 | if ((emptyObj as any)[dimensionName] != null) { |
| 314 | needsHasOwn = true; |
| 315 | } |
| 316 | |
| 317 | if (dimensionInfo.createInvertedIndices) { |
| 318 | invertedIndicesMap[dimensionName] = []; |
| 319 | } |
| 320 | |
| 321 | if (__DEV__) { |
| 322 | zrUtil.assert(assignStoreDimIdx || dimensionInfo.storeDimIndex >= 0); |
| 323 | } |
| 324 | if (assignStoreDimIdx) { |
| 325 | dimensionInfo.storeDimIndex = i; |
nothing calls this directly
no test coverage detected