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

Method _render

docs/app/js/sanddance-app.js:9679–9738  ·  view source on GitHub ↗
(insight, data, options, forceNewCharacterSet)

Source from the content-addressed store, hash-verified

9677 };
9678 }
9679 _render(insight, data, options, forceNewCharacterSet) {
9680 return __awaiter(this, void 0, void 0, function*() {
9681 if (this._tooltip) {
9682 this._tooltip.finalize();
9683 this._tooltip = null;
9684 }
9685 if (this._dataScope.setData(data, options.columns)) //apply transform to the data
9686 this.transformData(data, insight.transform);
9687 this._specColumns = (0, _sanddanceSpecs.getSpecColumns)(insight, this._dataScope.getColumns(options.columnTypes));
9688 const ordinalMap = (0, _ordinal.assignOrdinals)(this._specColumns, data, options.ordinalMap);
9689 this._characterSet.resetCharacterSet(forceNewCharacterSet, this.insight, insight);
9690 this.insight = _vegaDeckGl.util.clone(insight);
9691 this._lastColorOptions = _vegaDeckGl.util.clone(this.options.colors);
9692 this._shouldSaveColorContext = ()=>!options.initialColorContext;
9693 const colorContext = options.initialColorContext || {
9694 colorMap: null,
9695 legend: null,
9696 legendElement: null
9697 };
9698 const specResult = yield this.renderNewLayout(insight.signalValues, {
9699 preStage: (stage, deckProps)=>{
9700 if (this._shouldSaveColorContext()) //save off the colors from Vega layout
9701 colorContext.colorMap = (0, _colorCubes.colorMapFromCubes)(stage.cubeData);
9702 else //apply passed colorContext
9703 (0, _colorCubes.applyColorMapToCubes)([
9704 colorContext.colorMap
9705 ], _vegaDeckGl.util.getCubes(deckProps));
9706 //if items are selected, repaint
9707 const hasSelectedData = !!this._dataScope.hasSelectedData();
9708 const hasActive = !!this._dataScope.active;
9709 if (this._dataScope.hasSelectedData() || this._dataScope.active) {
9710 const selectedColorMap = (0, _colorCubes.getSelectedColorMap)(this._dataScope.currentData(), hasSelectedData, hasActive, this.options);
9711 (0, _colorCubes.applyColorMapToCubes)([
9712 colorContext.colorMap,
9713 selectedColorMap
9714 ], stage.cubeData, this.options.colors.unselectedColorMethod);
9715 }
9716 this.preStage(stage, deckProps);
9717 },
9718 onPresent: ()=>{
9719 if (this._shouldSaveColorContext()) {
9720 (0, _colorCubes.populateColorContext)(colorContext, this.presenter);
9721 this.changeColorContexts([
9722 colorContext
9723 ]);
9724 } else //apply passed colorContext
9725 this.applyLegendColorContext(colorContext);
9726 },
9727 shouldViewstateTransition: ()=>this.shouldViewstateTransition(insight, this.insight)
9728 }, this.getView(insight.view));
9729 //future signal changes should save the color context
9730 this._shouldSaveColorContext = ()=>!options.discardColorContextUpdates || !options.discardColorContextUpdates();
9731 this._details.render();
9732 const result = {
9733 ordinalMap,
9734 specResult
9735 };
9736 return result;

Callers 2

renderMethod · 0.95
renderFunction · 0.45

Calls 15

transformDataMethod · 0.95
renderNewLayoutMethod · 0.95
preStageMethod · 0.95
changeColorContextsMethod · 0.95
getViewMethod · 0.95
__awaiterFunction · 0.85
finalizeMethod · 0.45
setDataMethod · 0.45
getColumnsMethod · 0.45
resetCharacterSetMethod · 0.45

Tested by

no test coverage detected