import { createScenegraph } from '@chart-parts/builder' ; import { ChartOptions , SceneNode , DataFrame , VDomRenderer , ScenegraphConverter , } from '@chart-parts/interfaces' ; import { parseScene } from '@chart-parts/scenegraph' ; import { VirtualSvgConverter } from '@chart-parts/vsvg' ; export class Orchestrator < T > { public constructor ( private renderer , private prerenderer = new VirtualSvgConverter ( ) ) { } param rawScene param options public renderScenegraph ( rawScene , options = { } ) { try { const scenegraph = parseScene ( rawScene ) ; const intermediate = this . prerenderer . render ( scenegraph , options ) ; return this . renderer . render ( intermediate , { } ) ; } catch ( err ) { console . log ( 'error rendering scenegraph' , err ) ; throw err ; } } param scene param options param tables public renderScene ( scene , options = { } , tables ) { try { const sg = createScenegraph ( scene , tables , options ) ; const vdom = this . prerenderer . render ( sg . root , options ) ; return this . renderer . render ( vdom , sg . channelHandlers ) ; } catch ( err ) { console . log ( 'error rendering scene' , err ) ; throw err ; } } }