(fileList)
| 352 | } |
| 353 | |
| 354 | function handleFileList(fileList) { |
| 355 | const file = fileList?.[0]; |
| 356 | if (!file) return; |
| 357 | setStatus("Parsing CSV..."); |
| 358 | parseCSV(file) |
| 359 | .then((result) => { |
| 360 | state.dataset = { |
| 361 | rows: result.rows, |
| 362 | headers: result.headers |
| 363 | }; |
| 364 | state.columnStats = result.columnStats; |
| 365 | state.mapping.categoryStyles = createDefaultCategoryStyles(); |
| 366 | state.mapping.categoryColumn = ""; |
| 367 | state.mapping.layerColumn = ""; |
| 368 | state.mapping.visibleLayers = null; |
| 369 | state.mapping.categoryUniverse = new Set(); |
| 370 | state.mapping.visibleCategories = null; |
| 371 | state.mapping.layerStyles = createDefaultCategoryStyles(); |
| 372 | state.mapping.colorMode = "category"; |
| 373 | if (dom.colorMode) dom.colorMode.value = state.mapping.colorMode; |
| 374 | state.mapping.pointScale = 1; |
| 375 | state.mapping.pointScaleMin = 0; |
| 376 | state.mapping.pointScaleMax = 1; |
| 377 | state.mapping.labelScale = 1; |
| 378 | state.mapping.labelScaleMin = 0; |
| 379 | state.mapping.labelScaleMax = 1; |
| 380 | syncPointScaleControls(); |
| 381 | syncLabelScaleControls(); |
| 382 | scene.requestFrame(); |
| 383 | setStatus(`Loaded ${result.rows.length} rows, ${result.headers.length} columns.`); |
| 384 | refreshColumnSelects(); |
| 385 | autoAssignAxes(); |
| 386 | renderStyleConfig(); |
| 387 | renderLayerFilters(); |
| 388 | renderScene(); |
| 389 | }) |
| 390 | .catch((error) => { |
| 391 | console.error(error); |
| 392 | setStatus("Failed to parse CSV. Please check the file format."); |
| 393 | resetUI(); |
| 394 | }); |
| 395 | } |
| 396 | |
| 397 | function refreshColumnSelects() { |
| 398 | if (!state.dataset) { |
no test coverage detected