src/d3/DefaultTypes.ts

   1/**

   2 * # Default Styling Type Declarations

   3 */

   4

   5/** */

   6

   7import { UnitVp }       from './ConfigTypes';

   8import { scaleTypes }   from './ConfigTypes';

   9

  10export type Color = string;         // CSS color descriptor, e.g. '#fff'

  11export type ZeroToOne = number;     // number from [0, 1]

  12export type Index = number;         // column index into data table

  13

  14

  15export interface Area {

  16    color: Color;

  17    opacity: ZeroToOne;

  18}

  19

  20export interface Line {

  21    width: UnitVp;

  22    color: Color;

  23    opacity: ZeroToOne;

  24}

  25

  26export interface RectStyle {

  27    rx:     UnitVp;

  28    ry:     UnitVp;

  29    fill:   Area;

  30    stroke: Line;

  31}

  32

  33export interface TextStyle {

  34    color: Color;

  35    font: {

  36        family: string;         // e.g. 'sans-serif';

  37        size: UnitVp|string;    // e,g, 12

  38        style: string;          // 'normal''italic'

  39        weight: string;         // 'normal''bold''100' - '900'

  40    };

  41}

  42

  43export interface GraphDefaults {

  44    canvas: RectStyle;

  45}

  46

  47export interface PlotDefaults {

  48    area: RectStyle;

  49}

  50

  51export interface SeriesDefaults {

  52    line:   Line;

  53    marker: {

  54        fill:   Area;

  55        stroke: Line;

  56    };

  57}

  58

  59export interface ScaleDefaults {

  60    type:   scaleTypes;

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

  62    range:  { min: UnitVp, max: UnitVp };

  63}

  64

  65export interface AxisDefaults {

  66    line:       Line;

  67    tickMarks:  Line;

  68    tickLabel:  TextStyle;

  69}

  70

  71export interface AxesDefaults {

  72    hor:        AxisDefaults;

  73    ver:        AxisDefaults;

  74