MCPcopy
hub / github.com/microsoft/SandDance / renderNewLayout

Method renderNewLayout

packages/sanddance/src/viewer.ts:283–347  ·  view source on GitHub ↗
(signalValues: SignalValues, presenterConfig?: VegaDeckGl.types.PresenterConfig, view?: View)

Source from the content-addressed store, hash-verified

281 }
282
283 private async renderNewLayout(signalValues: SignalValues, presenterConfig?: VegaDeckGl.types.PresenterConfig, view?: View) {
284 const currData = this._dataScope.currentData();
285 const context: SpecContext = {
286 specColumns: this.getSpecColumnsWithFilteredStats(),
287 insight: this.insight,
288 specViewOptions: {
289 ...this.options,
290 zAxisOptions: {
291 showZAxis: true,
292 zIndex: zAxisZindex,
293 },
294 },
295 };
296 const specResult = build(context, currData);
297 if (!specResult.errors) {
298 const uiValues = extractSignalValuesFromView(this.vegaViewGl, this.vegaSpec);
299 applySignalValues({ ...uiValues, ...signalValues }, specResult.vegaSpec);
300 this.vegaSpec = specResult.vegaSpec;
301 this.options.onVegaSpec && this.options.onVegaSpec(this.vegaSpec);
302 this.specCapabilities = specResult.specCapabilities;
303 const config = this.createConfig(presenterConfig);
304 if (view) {
305 config.getView = () => view;
306 }
307 if (!didRegisterColorSchemes) {
308 registerColorSchemes(VegaDeckGl.base.vega);
309 didRegisterColorSchemes = true;
310 }
311 try {
312 if (this.vegaViewGl) {
313 this.vegaViewGl.finalize();
314 }
315 const runtime = VegaDeckGl.base.vega.parse(this.vegaSpec);
316 this.vegaViewGl = new VegaDeckGl.ViewGl(runtime, config)
317 .renderer('deck.gl')
318 .initialize(this.element) as ViewGl_Class;
319 await this.vegaViewGl.runAsync();
320
321 const handler: SignalListenerHandler = (n, v) => {
322 this._characterSet.resetCharacterSet(true);
323 };
324
325 this.vegaSpec.signals.forEach(s => {
326 this.vegaViewGl.addSignalListener(s.name, handler);
327 });
328
329 //capture new color color contexts via signals
330 this.configForSignalCapture(config.presenterConfig);
331 }
332 catch (e) {
333 specResult.errors = [e.message];
334 }
335 if (!specResult.errors) {
336 ensureHeaders(this.presenter, this.options.language.headers);
337 }
338 }
339 if (specResult.errors) {
340 if (this.options.onError) {

Callers 3

onAnimateDataChangeMethod · 0.95
onDataChangedMethod · 0.95
_renderMethod · 0.95

Calls 13

createConfigMethod · 0.95
buildFunction · 0.90
applySignalValuesFunction · 0.90
registerColorSchemesFunction · 0.90
ensureHeadersFunction · 0.90
initializeMethod · 0.65
currentDataMethod · 0.45
finalizeMethod · 0.45
rendererMethod · 0.45

Tested by

no test coverage detected