MCPcopy Create free account
hub / github.com/microsoft/SandDance / renderNewLayout

Method renderNewLayout

docs/tests/v2/es6/js/sanddance.js:154452–154506  ·  view source on GitHub ↗
(c, view)

Source from the content-addressed store, hash-verified

154450 }
154451
154452 renderNewLayout(c, view) {
154453 return __awaiter(this, void 0, void 0, function* () {
154454 const currData = this._dataScope.currentData();
154455
154456 const context = {
154457 specColumns: this.getSpecColumnsWithFilteredStats(),
154458 insight: this.insight,
154459 specViewOptions: this.options
154460 };
154461 const specResult = (0, _clone.cloneVegaSpecWithData)(context, currData);
154462
154463 if (!specResult.errors) {
154464 const uiValues = (0, _signals.extractSignalValuesFromView)(this.vegaViewGl, this.vegaSpec);
154465 this._signalValues = Object.assign(Object.assign(Object.assign({}, this._signalValues), uiValues), this.insight.signalValues);
154466 (0, _signals.applySignalValues)(this._signalValues, specResult.vegaSpec);
154467 this.vegaSpec = specResult.vegaSpec;
154468 this.options.onVegaSpec && this.options.onVegaSpec(this.vegaSpec);
154469 this.specCapabilities = specResult.specCapabilities;
154470 const config = this.createConfig(c);
154471
154472 if (view) {
154473 config.getView = () => view;
154474 }
154475
154476 if (!didRegisterColorSchemes) {
154477 (0, _colorSchemes.registerColorSchemes)(VegaDeckGl.base.vega);
154478 didRegisterColorSchemes = true;
154479 }
154480
154481 try {
154482 const runtime = VegaDeckGl.base.vega.parse(this.vegaSpec);
154483 this.vegaViewGl = new VegaDeckGl.ViewGl(runtime, config).renderer('deck.gl').initialize(this.element);
154484 yield this.vegaViewGl.runAsync(); //capture new color color contexts via signals
154485
154486 this.configForSignalCapture(config.presenterConfig);
154487 } catch (e) {
154488 specResult.errors = [e.message];
154489 }
154490
154491 if (!specResult.errors) {
154492 (0, _headers.ensureHeaders)(this.presenter, this.options.language.headers);
154493 }
154494 }
154495
154496 if (specResult.errors) {
154497 if (this.options.onError) {
154498 this.options.onError(specResult.errors);
154499 } else if (this.presenter.logger) {
154500 this.presenter.logger(`errors rendering Vega spec:${specResult.errors.join('\n')}`);
154501 }
154502 }
154503
154504 return specResult;
154505 });
154506 }
154507 /**
154508 * Render the same layout with new options.
154509 * @param newViewerOptions New options object.

Callers 3

onAnimateDataChangeMethod · 0.95
onDataChangedMethod · 0.95
_renderMethod · 0.95

Calls 7

createConfigMethod · 0.95
__awaiterFunction · 0.85
initializeMethod · 0.65
currentDataMethod · 0.45
rendererMethod · 0.45

Tested by

no test coverage detected