(
sourceData: OptionSourceData,
thisMetaRawOption: SourceMetaRawOption,
// can be null. If not provided, auto detect it from `sourceData`.
sourceFormat: SourceFormat
)
| 195 | * NOTE: Created source is immutable. Don't change any properties in it. |
| 196 | */ |
| 197 | export function createSource( |
| 198 | sourceData: OptionSourceData, |
| 199 | thisMetaRawOption: SourceMetaRawOption, |
| 200 | // can be null. If not provided, auto detect it from `sourceData`. |
| 201 | sourceFormat: SourceFormat |
| 202 | ): Source { |
| 203 | sourceFormat = sourceFormat || detectSourceFormat(sourceData); |
| 204 | const seriesLayoutBy = thisMetaRawOption.seriesLayoutBy; |
| 205 | const determined = determineSourceDimensions( |
| 206 | sourceData, |
| 207 | sourceFormat, |
| 208 | seriesLayoutBy, |
| 209 | thisMetaRawOption.sourceHeader, |
| 210 | thisMetaRawOption.dimensions |
| 211 | ); |
| 212 | const source = new SourceImpl({ |
| 213 | data: sourceData, |
| 214 | sourceFormat: sourceFormat, |
| 215 | |
| 216 | seriesLayoutBy: seriesLayoutBy, |
| 217 | dimensionsDefine: determined.dimensionsDefine, |
| 218 | startIndex: determined.startIndex, |
| 219 | dimensionsDetectedCount: determined.dimensionsDetectedCount, |
| 220 | metaRawOption: clone(thisMetaRawOption) |
| 221 | }); |
| 222 | |
| 223 | return source; |
| 224 | } |
| 225 | |
| 226 | /** |
| 227 | * Wrap original series data for some compatibility cases. |
searching dependent graphs…