MCPcopy Index your code
hub / github.com/microsoft/SandDance / loadFinal

Method loadFinal

packages/sanddance-explorer/src/explorer.tsx:473–524  ·  view source on GitHub ↗
(dataContent: DataContent)

Source from the content-addressed store, hash-verified

471 );
472 return new Promise<void>((resolve, reject) => {
473 const loadFinal = (dataContent: DataContent) => {
474 let partialInsight: Partial<SandDance.specs.Insight>;
475 this.prefs = (optionsOrPrefs && (optionsOrPrefs as Options).chartPrefs || (optionsOrPrefs as Prefs)) || {};
476 if (getPartialInsight) {
477 partialInsight = getPartialInsight(dataContent.columns);
478 initPrefs(this.prefs, partialInsight);
479 }
480 if (!partialInsight) {
481 //load recommendation
482 const r = new RecommenderSummary(dataContent.columns, dataContent.data);
483 partialInsight = r.recommend();
484 }
485 partialInsight = {
486 facetStyle: 'wrap',
487 filter: null,
488 totalStyle: null,
489 transform: null,
490 ...partialInsight,
491 };
492 if (partialInsight.chart === 'barchart') {
493 partialInsight.chart = 'barchartV';
494 }
495 const selectedItemIndex = { ...this.state.selectedItemIndex };
496 const sideTabId = SideTabId.ChartType;
497 selectedItemIndex[DataScopeId.AllData] = 0;
498 selectedItemIndex[DataScopeId.FilteredData] = 0;
499 selectedItemIndex[DataScopeId.SelectedData] = 0;
500 const newState: Partial<State> = {
501 dataFile,
502 dataContent,
503 snapshots: dataContent.snapshots || this.state.snapshots,
504 autoCompleteDistinctValues: {},
505 filteredData: null,
506 tooltipExclusions: (optionsOrPrefs && (optionsOrPrefs as Options).tooltipExclusions) || [],
507 selectedItemIndex,
508 sideTabId,
509 ...partialInsight,
510 };
511 this.getColorContext = null;
512 ensureColumnsExist(newState.columns, dataContent.columns, newState.transform);
513 const errors = ensureColumnsPopulated(partialInsight?.chart, partialInsight?.totalStyle, newState.columns, dataContent.columns);
514 newState.errors = errors;
515 //change insight
516 this.changeInsight(
517 partialInsight,
518 { label: strings.labelHistoryInit, insert: true },
519 newState as State,
520 );
521 //make sure item is active
522 this.activateDataBrowserItem(sideTabId, this.state.dataScopeId);
523 resolve();
524 };
525 let dataFile: DataFile;
526 if (Array.isArray(data)) {
527 return loadDataArray(data, 'json')

Callers

nothing calls this directly

Calls 7

recommendMethod · 0.95
changeInsightMethod · 0.95
initPrefsFunction · 0.90
ensureColumnsExistFunction · 0.90
ensureColumnsPopulatedFunction · 0.90
resolveFunction · 0.50

Tested by

no test coverage detected