src/ConfigTypes.ts

   1/**

   2 * # Configuration Type Declarations

   3 */

   4

   5/** */

   6

   7import { Data, NumDomain }  from 'hsdatab';

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

   9

  10/** viewport units */

  11export type UnitVp = number;        

  12

  13/** CSS px units */

  14export type UnitPx = number;        

  15

  16/** CSS general units */

  17export type Unit = string|UnitPx;   // general CSS unit type

  18

  19export interface PlotFn { (data:Data): void; }

  20export interface PlotFnDef { (data:Data, desc:PlotCfg, ...rest:Array): void; }

  21export interface RectDef { x:UnitVp; y:UnitVp; width:UnitVp; height:UnitVp; }

  22

  23export type scaleTypes = 'linear' | 'log';

  24

  25// export interface Scale {

  26//     type:   scaleTypes;

  27//     domain: {min: number|'auto', max: number|'auto'} | string[];

  28//     range:  { min: UnitVp, max: UnitVp };

  29// }

  30

  31export type d3Base = d3.Selection

  32

  33export interface GraphCfg {

  34    root:       any;

  35    baseSVG:    d3Base;

  36    client:     RectDef;

  37    viewPort: {

  38        width:  UnitVp;

  39        height: UnitVp;

  40    };

  41    defaults:   Defaults;

  42    scales:     { 

  43        hor: { dataCol: string, scale: any}, 

  44        ver: { dataCol: string, scale: any} 

  45    };

  46}

  47

  48export interface PlotCfg {

  49    cfg:        GraphCfg;

  50    plotBase:   d3Base;

  51    margin:     { left:number, top:number, right:number, bottom:number};

  52}

  53

  54

  55