src/element.js
/**
  * Create a single svg for all objects in a container
  *
  * @return none
  */
Create a single svg for all objects in a container
@return none
Create a single svg for all objects in a container @return none
export() {
    let name = this.cfg.exportName?this.cfg.exportName:"vis"
    let composite;
    if (this.renderer.exportSVG) { 
      let svg = this.renderer.exportSVG(name);
      composite = d3.select(svg);
    } else { 
      let content = [];
      d3.selectAll(`${this.cfg.selector} > *`).each(function(e){
        if (this._visualization)
          content.push(this._visualization.tk.draw.getSVG());
      })
      composite = d3.create('svg').attr('viewBox', content[0].getAttribute('viewBox'));
      content.forEach((item, i) => {
        let nodes = d3.select(item).selectAll(':scope > clippath, :scope > g').clone(true).nodes(); 
        nodes.forEach((e, i) => {
          composite.append(d=>e);
        });
      });
    }
    this.h.log('Export:', composite.node())
    this.exportSvg(composite.node(), name + '.svg');
  }
export ( ) { let name = this . cfg . exportName ? this . cfg . exportName : "vis" let composite ; if ( this . renderer . exportSVG ) { let svg = this . renderer . exportSVG ( name ) ; composite = d3 . select ( svg ) ; } else { let content = [ ] ; d3 . selectAll ( ` ${ this . cfg . selector } ` ) . each ( function ( e ) { if ( this . _visualization ) content . push ( this . _visualization . tk . draw . getSVG ( ) ) ; } ) composite = d3 . create ( 'svg' ) . attr ( 'viewBox' , content [ 0 ] . getAttribute ( 'viewBox' ) ) ; content . forEach ( ( item , i ) => { let nodes = d3 . select ( item ) . selectAll ( ':scope > clippath, :scope > g' ) . clone ( true ) . nodes ( ) ; nodes . forEach ( ( e , i ) => { composite . append ( d => e ) ; } ) ; } ) ; } this . h . log ( 'Export:' , composite . node ( ) ) this . exportSvg ( composite . node ( ) , name + '.svg' ) ; }
Create a single svg for all objects in a container
 @return none
Create a single svg for all objects in a container @return none
// engine specific // generic output // toplevel children // download it