src/GraphComponent.ts

   1/**

   2 * 

   3 */

   4

   5/** */

   6

   7import { log as gLog }  from 'hsutil';   const log = gLog('d3.GraphComponent');

   8import { Defaults }     from './Defaults';

   9// import { Unit }         from './ConfigTypes';

  10

  11import { Data }         from 'hsdatab';

  12import { GraphCfg }     from './ConfigTypes';

  13

  14const vpWidth:number    = 1000;

  15

  16export abstract class GraphComponent {

  17    protected config: GraphCfg;

  18    constructor(cfg?: GraphCfg) { 

  19        this.config = cfg || {

  20            root: undefined,

  21            baseSVG: undefined,    

  22            client: {

  23                x:0, y:0,

  24                width: 0, height: 0

  25            },

  26            viewPort: {

  27                width: vpWidth,

  28                height: vpWidth * 0.7   // initial height: 70% of width

  29            },

  30            defaults: undefined,

  31            scales: { 

  32                hor: { dataCol: undefined, scale: undefined}, 

  33                ver: { dataCol: undefined, scale: undefined} 

  34            } 

  35        };

  36        this.config.defaults = new Defaults(this.config);

  37    }

  38    public abstract render(data:Data): void;

  39}

  40