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

Method loadFinal

docs/app/js/sanddance-app.js:14073–14119  ·  view source on GitHub ↗
(dataContent)

Source from the content-addressed store, hash-verified

14071 });
14072 return new Promise((resolve, reject)=>{
14073 const loadFinal = (dataContent)=>{
14074 let partialInsight;
14075 this.prefs = optionsOrPrefs && optionsOrPrefs.chartPrefs || optionsOrPrefs || {};
14076 if (getPartialInsight) {
14077 partialInsight = getPartialInsight(dataContent.columns);
14078 (0, _partialInsight.initPrefs)(this.prefs, partialInsight);
14079 }
14080 if (!partialInsight) {
14081 //load recommendation
14082 let r = new (0, _chartRecommender.RecommenderSummary)(dataContent.columns, dataContent.data);
14083 partialInsight = r.recommend();
14084 }
14085 partialInsight = Object.assign({
14086 facetStyle: "wrap",
14087 filter: null,
14088 totalStyle: null,
14089 transform: null
14090 }, partialInsight);
14091 if (partialInsight.chart === "barchart") partialInsight.chart = "barchartV";
14092 const selectedItemIndex = Object.assign({}, this.state.selectedItemIndex);
14093 const sideTabId = (0, _interfaces.SideTabId).ChartType;
14094 selectedItemIndex[(0, _dataScope.DataScopeId).AllData] = 0;
14095 selectedItemIndex[(0, _dataScope.DataScopeId).FilteredData] = 0;
14096 selectedItemIndex[(0, _dataScope.DataScopeId).SelectedData] = 0;
14097 let newState = Object.assign({
14098 dataFile,
14099 dataContent,
14100 snapshots: dataContent.snapshots || this.state.snapshots,
14101 autoCompleteDistinctValues: {},
14102 filteredData: null,
14103 tooltipExclusions: optionsOrPrefs && optionsOrPrefs.tooltipExclusions || [],
14104 selectedItemIndex,
14105 sideTabId
14106 }, partialInsight);
14107 this.getColorContext = null;
14108 (0, _columns.ensureColumnsExist)(newState.columns, dataContent.columns, newState.transform);
14109 const errors = (0, _columns.ensureColumnsPopulated)(partialInsight === null || partialInsight === void 0 ? void 0 : partialInsight.chart, partialInsight === null || partialInsight === void 0 ? void 0 : partialInsight.totalStyle, newState.columns, dataContent.columns);
14110 newState.errors = errors;
14111 //change insight
14112 this.changeInsight(partialInsight, {
14113 label: (0, _language.strings).labelHistoryInit,
14114 insert: true
14115 }, newState);
14116 //make sure item is active
14117 this.activateDataBrowserItem(sideTabId, this.state.dataScopeId);
14118 resolve();
14119 };
14120 let dataFile;
14121 if (Array.isArray(data)) return (0, _dataLoader.loadDataArray)(data, "json").then((result)=>{
14122 dataFile = {

Callers

nothing calls this directly

Calls 4

changeInsightMethod · 0.95
resolveFunction · 0.70
recommendMethod · 0.45

Tested by

no test coverage detected