# All files / types index.ts

100% Statements 46/46
100% Branches 12/12
100% Functions 6/6
100% Lines 46/46

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624
    625
    626
    627
    628
    629
    630
    631
    632
    633
    634
    635
    636
    637
    638
    639
    640
    641
    642
    643
    644
    645
    646
    647
    648
    649
    650
    651
    652
    653
    654
    655
    656
    657
    658
    659
    660
    661
    662
    663
    664
    665
    666
    667
    668
    669
    670
    671
    672
    673
    674
    675
    676
    677
    678
    679
    680
    681
    682
    683
    684
    685
    686
    687
    688
    689
    690
    691
    692
    693
    694
    695
    696
    697
    698
    699
    700
    701
    702
    703
    704
    705
    706
    707
    708
    709
    710
    711
    712
    713
    714
    715
    716
    717
    718
    719
    720
    721
    722
    723
    724
    725
    726
    727
    728
    729
    730
    731
    732
    733
    734
    735
    736
    737
    738
    739
    740
    741
    742
    743
    744
    745
    746
    747
    748
    749
    750
    751
    752
    753
    754
    755
    756
    757
    758
    759
    760
    761
    762
    763
    764
    765
    766
    767
    768
    769
    770
    771
    772
    773
    774
    775
    776
    777
    778
    779
    780
    781
    782
    783
    784
    785
    786
    787
    788
    789
    790
    791
    792
    793
    794
    795
    796
    797
    798
    799
    800
    801
    802
    803
    804
    805
    806
    807
    808
    809
    810
    811
    812
    813
    814
    815
    816
    817
    818
    819
    820
    821
    822
    823
    824
    825
    826
    827
    828
    829
    830
    831
    832
    833
    834
    835
    836
    837
    838
    839
    840
    841
    842
    843
    844
    845
    846
    847
    848
    849
    850
    851
    852
    853
    854
    855
    856
    857
    858
    859
    860
    861
    862
    863
    864
    865
    866
    867
    868
    869
    870
    871
    872
    873
    874
    875
    876
    877
    878
    879
    880
    881
    882
    883
    884
    885
    886
    887
    888
    889
    890
    891

    10x
    10x
    10x
    10x
    10x
    10x
    10x
    10x
    10x
    10x
    10x
    10x
    10x

    10x
    10x
    10x
    10x

    10x
    10x
    10x
    10x
    10x
    10x
    10x
    10x
    10x
    10x
    10x
    10x
    10x
    10x

    10x

    10x
    10x
    10x
    10x
    10x
    10x
    10x
    10x

    10x
    10x
    10x

    10x
    10x
    10x

     import CSS from 'csstype'
    import {CSSProperties, ReactNode} from 'react'
    import {TimeZone} from './timeZones'
    import {GeoLayerConfig} from './geo'

    export interface PlotDimensions {
      height: number
      width: number
    }

    export type SizedConfig = Config & {width: number; height: number}
    export interface Config {
      width?: number
      height?: number

      interactionHandlers?: InteractionHandlers

      gridColor?: string
      gridOpacity?: number

      cursor?: string

      showAxes?: boolean
      axisColor?: string
      axisOpacity?: number

      // Tick placement on the axes can be specified otherwise they are calculated,
      //   - specified for an entire axis, or
      //   - specified by a step interval per tick and/or a total number of ticks
      xTicks?: number[]
      xTickStart?: number
      xTickStep?: number
      xTotalTicks?: number
      yTicks?: Array<number | string>
      yTickStart?: number
      yTickStep?: number
      yTotalTicks?: number

      // Ticks can have font, color, and be formatted for precision and labeling
      tickFont?: string
      tickFontColor?: string
      valueFormatters?: {
        [colKey: string]: Formatter
      }

      // The labels on the axes
      xAxisLabel?: string
      yAxisLabel?: string

      // The scaling of the axes, usually linear or logarithmic
      xScale?: string
      yScale?: string

      table?: Table
      fluxResponse?: string
      layers: LayerConfig[]

      // The x domain of the plot can be explicitly set. If this option is passed,
      // then the component is operating in a "controlled" mode, where it always
      // uses the passed x domain. Any brush interaction with the plot that should
      // change the x domain will call the `onSetXDomain` option when the component
      // is in controlled mode. Double clicking the plot will call
      // `onResetXDomain`. If the `xDomain` option is not passed, then the
      // component is "uncontrolled". It will compute, set, and reset the `xDomain`
      // automatically.
      xDomain?: number[]
      onSetXDomain?: (xDomain: number[]) => void
      onResetXDomain?: () => void

      // See the `xDomain`, `onSetXDomain`, and `onResetXDomain` options
      yDomain?: number[]
      onSetYDomain?: (yDomain: number[]) => void
      onResetYDomain?: () => void

      // legend properties apply to both the static legend and the tooltip
      legendBackgroundColor?: string
      legendBorder?: string
      legendColorizeRows?: boolean
      legendColumns?: string[]
      legendCrosshairColor?: string
      legendFont?: string
      legendFontBrightColor?: string
      legendFontColor?: string
      legendHide?: boolean
      legendMessage?: string
      legendOpacity?: number
      legendOrientationThreshold?: number

      // applies only to the static legend, overrides "legend" properties above
      staticLegend?: StaticLegend

      // The type of the y-axis column
      yColumnType?: ColumnType
    }

    export enum LegendPropertyNames {
      backgroundColor = 'legendBackgroundColor',
      border = 'legendBorder',
      colorizeRows = 'legendColorizeRows',
      columns = 'legendColumns',
      crosshairColor = 'legendCrosshairColor',
      font = 'legendFont',
      fontBrightColor = 'legendFontBrightColor',
      fontColor = 'legendFontColor',
      hide = 'legendHide',
      message = 'legendMessage',
      opacity = 'legendOpacity',
      orientationThreshold = 'legendOrientationThreshold',
    }

    export interface StaticLegend {
      backgroundColor?: string
      border?: string
      colorizeRows?: boolean
      columns?: string[]
      crosshairColor?: string
      cursor?: string // no corresponding legend property, unique to static legend
      font?: string
      fontBrightColor?: string
      fontColor?: string
      heightRatio?: number // no corresponding legend property, unique to static legend
      hide?: boolean
      layer?: number // no corresponding legend property, unique to static legend
      message?: string
      opacity?: number
      orientationThreshold?: number
      style?: CSSProperties // no correspinding legend property, unique to static legend
      valueAxis?: 'x' | 'y' // no corresponding legend property, unique to static legend
      widthRatio?: number // no corresponding legend property, unique to static legend
    }

    export interface InteractionHandlerArguments {
      clampedValueX: number
      hoverX: number
      hoverY: number
      valueX: number | string
      valueY: number | string
      xDomain: number[]
      yDomain: number[]
      resetDomains: () => void
    }

    export interface InteractionHandlers {
      doubleClick?: (plotInteraction: InteractionHandlerArguments) => void
      singleClick?: (plotInteraction: InteractionHandlerArguments) => void
      hover?: (plotInteraction: InteractionHandlerArguments) => void
      onXBrush?: (beginning: number | string, end: number | string) => void
    }

    export enum FormatterType {
      Time = 'TIME',
      BinaryPrefix = 'BINARY_PREFIX',
      SIPrefix = 'SI_PREFIX',
    }

    export interface Formatter {
      // A `Formatter` takes a value in a `Table` and formats it as a
      // human-readable string
      (val: any, options?: object): string

      // The formatting of values in a plot affects our strategy for generating
      // nice axis tick marks. For example, if a user formats x values as times,
      // then a x axis tick at 2:00:00 PM would be nice, but a tick at 2:37:43 PM
      // would not be nice. A similar problem exists if a user is formatting values
      // with a [binary prefix][0]. As a library, we provide utilities to create
      // `Formatter`s for these common formatting scenarios. We tag the created
      // `Formatter`s with this property, so that we can recognize when they are
      // used and generate nicer ticks in those cases.
      //
      // [0]: https://en.wikipedia.org/wiki/Binary_prefix
      readonly _GIRAFFE_FORMATTER_TYPE?: FormatterType
    }

    export interface Table {
      getColumn: GetColumn
      getColumnName: (columnKey: string) => string | null // null if the column is not available
      getColumnType: (columnKey: string) => ColumnType | null // null if the column is not available
      getOriginalColumnType: (columnKey: string) => FluxDataType | null // null if the column is not available
      columnKeys: string[]
      length: number
      addColumn: (
        columnKey: string,
        fluxDataType: FluxDataType,
        type: ColumnType,
        data: ColumnData,
        name?: string
      ) => Table
    }

    export interface GetColumn {
      (columnKey: string): ColumnData | null
      (columnKey: string, type: 'number'): NumericColumnData | null
      (columnKey: string, type: 'time'): NumericColumnData | null
      (columnKey: string, type: 'string'): string[] | null
      (columnKey: string, type: 'boolean'): boolean[] | null
    }

    export type NumericColumnData =
      | number[]
      | Int8Array
      | Int16Array
      | Int32Array
      | Uint8Array
      | Uint16Array
      | Uint32Array
      | Float32Array
      | Float64Array

    export type ColumnData = NumericColumnData | string[] | boolean[]

    export type ColumnType = 'number' | 'string' | 'time' | 'boolean'

    export type FluxDataType =
      | 'boolean'
      | 'unsignedLong'
      | 'long'
      | 'double'
      | 'string'
      | 'dateTime:RFC3339'
      | 'system'

    export enum LayerTypes {
      RawFluxDataTable = 'flux data table',
      Gauge = 'gauge',
      Custom = 'custom',
      Annotation = 'annotation',
      SingleStat = 'single stat',
      Heatmap = 'heatmap',
      Histogram = 'histogram',
      Line = 'line',
      Band = 'band',
      Scatter = 'scatter',
      Mosaic = 'mosaic',
      Table = 'table',
      Geo = 'geo',
    }

    export type LayerConfig =
      | CustomLayerConfig
      | AnnotationLayerConfig
      | RawFluxDataTableLayerConfig
      | GaugeLayerConfig
      | SingleStatLayerConfig
      | HeatmapLayerConfig
      | HistogramLayerConfig
      | LineLayerConfig
      | BandLayerConfig
      | ScatterLayerConfig
      | MosaicLayerConfig
      | TableGraphLayerConfig
      | GeoLayerConfig

    export interface CustomLayerConfig {
      type: 'custom' // do not refactor or restrict to LayerTypes.Custom
      render: (p: CustomLayerRenderProps) => JSX.Element
    }

    export interface AnnotationLayerConfig {
      type: 'annotation'
      x: string
      y: string
      annotations: AnnotationMark[]
      fill: string[]
      hoverDimension?: LineHoverDimension | 'auto'
      hoverMargin?: number
      svgAttributes?: SVGAttributes
      svgStyle?: CSS.Properties
      lineWidth?: number
      handleAnnotationClick?: (id: string) => void
    }

    export interface CustomLayerRenderProps {
      key: string | number
      xScale: Scale<number, number>
      yScale: Scale<number, number>
      xDomain: number[]
      yDomain: number[]
      width: number
      height: number
      innerWidth: number
      innerHeight: number
      yColumnType: ColumnType
      columnFormatter: (colKey: string) => (x: any) => string
    }

    export interface RawFluxDataTableLayerConfig {
      type: 'flux data table' // do not refactor or restrict to LayerTypes.RawFluxDataTable
      files: string[]
      width: number
      height: number
      disableVerticalScrolling?: boolean
      parseObjects?: boolean
    }

    export interface GaugeLayerConfig {
      type: 'gauge' // do not refactor or restrict to LayerTypes.Gauge
      prefix?: string
      suffix?: string
      tickPrefix?: string
      tickSuffix?: string
      decimalPlaces?: DecimalPlaces
      gaugeColors: Color[]
      gaugeSize?: number
      gaugeTheme?: Partial<GaugeTheme>
    }

    export interface GaugeTheme {
      lineCount: number
      smallLineCount: number
      lineColor: string
      labelColor: string
      labelFontSize: number
      lineStrokeSmall: number
      lineStrokeLarge: number
      tickSizeSmall: number
      tickSizeLarge: number
      minFontSize: number
      minLineWidth: number
      valueColor: string
      valuePositionXOffset: number
      valuePositionYOffset: number
      needleColor0: string
      needleColor1: string
      overflowDelta: number
    }

    export interface SingleStatLayerConfig {
      type: 'single stat' // do not refactor or restrict to LayerTypes.SingleStat
      prefix: string
      suffix: string
      decimalPlaces: DecimalPlaces
      textColor: string
      textOpacity?: number
      backgroundColor?: string
      testID?: string
      style?: CSS.Properties
      resizerStyle?: CSS.Properties
      svgAttributes?: SVGAttributes
      svgStyle?: CSS.Properties
      svgTextAttributes?: SVGAttributes
      svgTextStyle?: CSS.Properties
    }

    export type SVGAttributeFunction = (stat: string) => string

    export interface SVGAttributes {
      [attributeName: string]: string | SVGAttributeFunction
    }

    export interface HeatmapLayerConfig {
      type: 'heatmap' // do not refactor or restrict to LayerTypes.Heatmap
      x: string
      y: string
      binSize?: number
      colors?: string[]
      fillOpacity?: number
      strokeOpacity?: number
      strokeWidth?: number
      strokePadding?: number
    }

    export interface HistogramLayerConfig {
      type: 'histogram' // do not refactor or restrict to LayerTypes.Histogram
      x: string
      position?: HistogramPosition
      binCount?: number
      fill?: string[]
      colors?: string[]
      fillOpacity?: number
      strokeOpacity?: number
      strokeWidth?: number
      strokePadding?: number
    }

    export interface MosaicLayerConfig {
      type: 'mosaic' // do not refactor or restrict to LayerTypes.Mosaic
      x: string
      y: string[]
      yLabelColumns?: string[]
      yLabelColumnSeparator?: string
      fill: string[]
      hoverDimension?: MosaicHoverDimension | 'auto'
      colors?: string[]
      strokeWidth?: number
      strokePadding?: number
      strokeOpacity?: number
      fillOpacity?: number
    }

    export type RectLayerConfig = HeatmapLayerConfig | HistogramLayerConfig

    export interface LineLayerConfig {
      type: 'line' // do not refactor or restrict to LayerTypes.Line
      x: string
      y: string
      fill?: string[]
      position?: LinePosition
      hoverDimension?: LineHoverDimension | 'auto'
      maxTooltipRows?: number
      interpolation?: LineInterpolation
      lineWidth?: number
      colors?: string[]
      shadeBelow?: boolean
      shadeBelowOpacity?: number
    }

    export interface BandLayerConfig {
      type: 'band' // do not refactor or restrict to LayerTypes.Line
      x: string
      y: string
      fill: string[]
      position?: LinePosition
      hoverDimension?: LineHoverDimension | 'auto'
      maxTooltipRows?: number
      interpolation?: LineInterpolation
      lineWidth?: number
      lineOpacity?: number
      colors?: string[]
      shadeOpacity?: number
      mainColumnName: string
      upperColumnName?: string
      lowerColumnName?: string
    }

    export interface ScatterLayerConfig {
      type: 'scatter' // do not refactor or restrict to LayerTypes.Scatter
      x: string
      y: string
      fill?: string[]
      colors?: string[]
      symbol?: string[]
    }

    export interface TableGraphLayerConfig {
      type: 'table' // do not refactor or restrict to LayerTypes.Table
      tables?: FluxTable[]
      timeZone: TimeZone
      tableTheme?: Theme
      properties: TableViewProperties
    }

    export interface DashboardQuery {
      text?: string
      editMode?: QueryEditMode
      name?: string
      builderConfig?: BuilderConfig
    }

    export type QueryEditMode = 'builder' | 'advanced'

    export interface BuilderConfig {
      buckets?: string[]
      tags?: BuilderTagsType[]
      functions?: BuilderFunctionsType[]
      aggregateWindow?: {
        period?: string
      }
    }

    export interface BuilderTagsType {
      key?: string
      values?: string[]
      aggregateFunctionType?: BuilderAggregateFunctionType
    }

    export type BuilderAggregateFunctionType = 'filter' | 'group'

    export interface BuilderFunctionsType {
      name?: string
    }

    export interface RenamableField {
      readonly internalName?: string
      displayName?: string
      visible?: boolean
    }

    export * from './timeZones'

    export type Theme = 'light' | 'dark'

    export interface TableViewProperties {
      type?: string
      shape?: string
      note?: string
      showNoteWhenEmpty?: boolean
      queries?: DashboardQuery[]
      colors: Color[]
      tableOptions: {
        wrapping?: 'truncate' | 'wrap' | 'single-line'
        fixFirstColumn?: boolean
        verticalTimeAxis?: boolean
        sortBy?: RenamableField
      }
      fieldOptions: RenamableField[]
      timeFormat: string
      decimalPlaces: DecimalPlaces
    }

    export interface ColumnWidths {
      totalWidths: number
      widths: {[x: string]: number}
    }

    export interface TransformTableDataReturnType {
      transformedData: string[][]
      sortedTimeVals: string[]
      columnWidths: ColumnWidths
      resolvedRenamableFields: RenamableField[]
      sortOptions: SortOptions
    }

    export interface SortOptions {
      field: string
      direction: string
    }

    export interface TimeField {
      internalName: string
      displayName: string
      visible: boolean
    }

    export interface FluxTable {
      id: string
      name: string
      data: string[][]
      result: string
      groupKey: {
        [columnName: string]: string
      }
      dataTypes: {
        [columnName: string]: string
      }
    }

    /*
      When a user supplies a config for a layer, we derive various data from it:

      - If the layer implies a certain statistical transform or aggregate, we
        compute it. For example: a histogram layer needs to place data into bins,
        and count the number of observations within each bin.

      - Some layers support _group aesthetics_. These are aesthetics which multiple
        columns in the input table may be mapped to at once. In this case, we
        synthesize a new column in the table that contains a numeric group ID for
        each unique combination of values from these columns. We also record the
        values for each column that a particular group ID maps to, so that we can
        display those values in a legend.

      - For any data-to-aesthetic mapping, we create a scale function. The
        exception to this is for the `x` and `y` aesthetics; since multiple layers
        should use the same scale for `x` and `y` aesthetics, we do not generate
        those scales in a layer transform. Instead we record the `xDomain` and
        `yDomain` of the (transformed) data for the layer, so that some other
        entity may compute these scales.

      - We record the `xColumnType` and `yColumnType` for the layer, so that we can
        format x and y values from the layer approriately.

      We call the collection of this derived data a "spec".
    */
    export type LayerSpec =
      | AnnotationLayerSpec
      | LineLayerSpec
      | BandLayerSpec
      | ScatterLayerSpec
      | RectLayerSpec
      | MosaicLayerSpec

    export enum SpecTypes {
      Annotation = 'annotation',
      Line = 'line',
      Band = 'band',
      Scatter = 'scatter',
      Rect = 'rect',
      Mosaic = 'mosaic',
      Table = 'table',
    }

    export interface AnnotationLayerSpec {
      type: 'annotation'
      table: Table
      annotationData: AnnotationMark[]
      xColumnKey: string
      yColumnKey: string
      xColumnType: ColumnType
      yColumnType: ColumnType
      xDomain: number[]
      yDomain: number[]
    }

    export interface MosaicLayerSpec {
      type: 'mosaic'
      inputTable: Table
      table: Table // has `X_MIN`, `X_MAX`, `Y_MIN`, `Y_MAX`, and `COUNT` columns, and maybe a `FILL` column
      xDomain: number[]
      yDomain: number[]
      xColumnKey: string
      xColumnType: ColumnType
      yColumnType: ColumnType
      yColumnsName: string
      scales: {fill: Scale<number, string>}
      columnGroupMaps: {
        fill: ColumnGroupMap
      }
      ySeries: Array<string>
      yTicks: Array<string>
    }

    export interface LineLayerSpec {
      type: 'line' // do not refactor or restrict to SpecTypes.Line
      inputTable: Table
      table: Table // has `FILL` column added
      lineData: LineData
      xDomain: number[]
      yDomain: number[]
      xColumnKey: string
      yColumnKey: string
      xColumnType: ColumnType
      yColumnType: ColumnType
      scales: {
        fill: Scale<number, string>
      }
      columnGroupMaps: {
        fill: ColumnGroupMap
        latestIndices: LatestIndexMap
      }
      stackedDomainValueColumn?: NumericColumnData
    }

    export interface BandLayerSpec {
      type: 'band' // do not refactor or restrict to SpecTypes.Line
      bandIndexMap: BandIndexMap
      bandName: string
      upperColumnName: string
      lowerColumnName: string
      inputTable: Table
      table: Table // has `FILL` column added
      lineData: LineData
      xDomain: number[]
      yDomain: number[]
      xColumnKey: string
      yColumnKey: string
      xColumnType: ColumnType
      yColumnType: ColumnType
      scales: {
        fill: Scale<number, string>
      }
      columnGroupMaps: {
        fill: ColumnGroupMap
        latestIndices: LatestIndexMap
      }
    }

    export interface ScatterLayerSpec {
      type: 'scatter' // do not refactor or restrict to SpecTypes.Scatter
      inputTable: Table
      table: Table // has `FILL` and `SYMBOL` columns added
      xDomain: number[]
      yDomain: number[]
      xColumnKey: string
      yColumnKey: string
      xColumnType: ColumnType
      yColumnType: ColumnType
      scales: {
        fill: Scale<number, string>
        symbol: Scale<number, SymbolType>
      }
      columnGroupMaps: {
        fill: ColumnGroupMap
        symbol: ColumnGroupMap
      }
    }

    export interface RectLayerSpec {
      type: 'rect' // do not refactor or restrict to SpecTypes.Rect
      inputTable: Table
      table: Table // has `X_MIN`, `X_MAX`, `Y_MIN`, `Y_MAX`, and `COUNT` columns, and maybe a `FILL` column
      binDimension: 'xy' | 'x'
      xDomain: number[]
      yDomain: number[]
      xColumnKey: string
      yColumnKey: string
      xColumnType: ColumnType
      yColumnType: ColumnType
      scales: {fill: Scale<number, string>}
      columnGroupMaps: {fill?: ColumnGroupMap}
    }

    export interface LayerProps {
      xScale: Scale<number, number>
      yScale: Scale<number, number>
      width: number
      height: number
      spec: LayerSpec
      config: LayerConfig
      plotConfig: SizedConfig
      yColumnType: ColumnType
      columnFormatter: (colKey: string) => (x: any) => string
      hoverX: number | null
      hoverY: number | null
    }

    export interface Scale<D = any, R = any> {
      (x: D): R
      invert?: (y: R) => D
    }

    export type ScaleFactory = (
      domainStart: number,
      domainStop: number,
      rangeStart: number,
      rangeStop: number
    ) => Scale<number, number>

    export interface DecimalPlaces {
      isEnforced?: boolean
      digits?: number
    }

    export interface Margins {
      top: number
      right: number
      bottom: number
      left: number
    }

    export interface Color {
      id: string
      type: 'min' | 'max' | 'threshold' | 'scale' | 'text' | 'background'
      hex: string
      name: string
      value: number
    }

    export interface LegendColumn {
      key: string
      name: string
      type: ColumnType
      values: string[]
      colors: string[] | null
    }

    export type LegendData = LegendColumn[]

    export interface TooltipPosition {
      x: number
      y: number
    }

    export interface AnnotationTooltipOptions {
      dimension: AnnotationDimension
      position: TooltipPosition
      xOffset: number
      yOffset: number
    }

    export interface AnnotationTooltipData {
      title: string
      description: string
      fontColor: string
      position: TooltipPosition
    }

    export type LineInterpolation =
      | 'linear'
      | 'monotoneX'
      | 'monotoneY'
      | 'cubic'
      | 'step'
      | 'stepBefore'
      | 'stepAfter'
      | 'natural'

    /*
      The tooltip for a line layer can operate in one of three modes:

      In the `x` mode, every y-value for the currently hovered x-value is displayed
      in the tooltip. The crosshair is a vertical line.

      In the `y` mode, every x-value for the currently hovered y-value is displayed
      in the tooltip. The crosshair is a horizontal line.

      In the `xy` mode, the single xy-point closest to the hovered mouse position
      is displayed in the tooltip. The series that it belongs to is highlighted.
      The crosshair is an intersecting pair of horizontal and vertical lines.
    */
    export type LineHoverDimension = 'x' | 'y' | 'xy'

    export type LinePosition = 'overlaid' | 'stacked'

    export type HistogramPosition = 'overlaid' | 'stacked'

    export type MosaicPosition = 'stacked'

    export type MosaicHoverDimension = 'x' | 'y' | 'xy'

    export type SymbolType =
      | 'circle'
      | 'triangle'
      | 'square'
      | 'plus'
      | 'tritip'
      | 'ex'

    export interface ColumnGroupMap {
      // The column keys that specify the grouping
      columnKeys: string[]

      // A group ID `i` takes on the values specified by `mappings[i]` for the
      // column keys that specify the grouping
      mappings: Array<{[columnKey: string]: any}>
    }

    export interface LatestIndexMap {
      // each Column in a Table contains a single array even when there are multiple series
      //   for example, a line graph has multiple lines (series), but each Column has only one array
      // Static Legend needs to know where each line (series) ends, to render the "latest"
      //   - "latest" is the timestamp with the highest value in each line (series)
      //   - Keep a map of the highest timestamp's index for each series
      [columnKey: string]: number
    }

    export type LineData = {
      [groupID: number]: {
        xs: number[]
        ys: number[]
        fill: string
      }
    }

    export type CumulativeValuesByTime = {
      [time: number]: {
        [groupID: number]: number
      }
    }

    export enum ErrorName {
      UnknownColumnTypeError = 'UnknownColumnTypeError',
      SchemaMismatchError = 'SchemaMismatchError',
    }

    export enum DomainLabel {
      X = 'xs',
      Y = 'ys',
    }

    export type AxisTicks = Date[] | number[]

    export interface BandBorder {
      xs: Array<number>
      ys: Array<number>
      fill: string
    }
    export interface Band {
      lower?: BandBorder
      upper?: BandBorder
      xs: Array<number>
      ys: Array<number>
      fill: string
    }

    export interface BandIndexMap {
      rowIndices: number[]
      lowerIndices: number[]
      upperIndices: number[]
    }

    export interface StandardFunctionProps {
      id?: string
      style?: CSSProperties
      testID?: string
      children?: ReactNode
      className?: string
    }

    export type AnnotationDimension = 'x' | 'y'

    export type AnnotationPinType = 'none' | 'circle' | 'start' | 'stop'
    export interface AnnotationMark {
      title: string
      description: string
      color: string
      startValue: number
      stopValue: number
      dimension: AnnotationDimension
      pin: AnnotationPinType
      id?: string
    }