All files / owid-grapher/coreTable CoreColumnDef.ts

100% Statements 32/32
100% Branches 1/1
100% Functions 0/0
100% Lines 32/32

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 821x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x                                                                                                    
import { OwidVariableDisplayConfigInterface } from "../clientUtils/OwidVariableDisplayConfigInterface"
import { ColumnSlug } from "../clientUtils/owidTypes"
import { CoreValueType, Color } from "./CoreTableConstants"
 
export enum ColumnTypeNames {
    Numeric = "Numeric",
    String = "String",
    Region = "Region",
    SeriesAnnotation = "SeriesAnnotation",
    Categorical = "Categorical",
    Continent = "Continent",
    EntityName = "EntityName",
    EntityId = "EntityId",
    EntityCode = "EntityCode",
    Boolean = "Boolean",
    Currency = "Currency",
    Percentage = "Percentage",
    RelativePercentage = "RelativePercentage",
    DecimalPercentage = "DecimalPercentage",
    Integer = "Integer",
    PercentChangeOverTime = "PercentChangeOverTime",
    Ratio = "Ratio",
    Year = "Year",
    Day = "Day",
    Date = "Date",
    Color = "Color",
    Population = "Population",
    PopulationDensity = "PopulationDensity",
    Age = "Age",
    Quarter = "Quarter",
}
 
export interface ColumnColorScale {
    // Color scales
    colorScaleScheme?: string
    colorScaleInvert?: boolean
    colorScaleBinningStrategy?: string
    colorScaleEqualSizeBins?: boolean
    colorScaleNumericMinValue?: number
    colorScaleNumericBins?: string
    colorScaleCategoricalBins?: string
    colorScaleNoDataLabel?: string
    colorScaleLegendDescription?: string
}
 
export interface CoreColumnDef extends ColumnColorScale {
    // Core
    slug: ColumnSlug
    type?: ColumnTypeNames
 
    // Computational
    transform?: string // Code that maps to a CoreTable transform
    tolerance?: number // If set, some charts can use this for an interpolation strategy.
    skipParsing?: boolean // If set, the values will never run through the type parser
 
    // Column information used for display only
    name?: string // The display name for the column
    description?: string
    note?: string // Any internal notes the author wants to record for display in admin interfaces
 
    // Color
    color?: Color // A column can have a fixed color for use in charts where the columns are series
 
    // Source information used for display only
    sourceName?: string
    sourceLink?: string
    dataPublishedBy?: string
    dataPublisherSource?: string
    retrievedDate?: string
    additionalInfo?: string
 
    // For developer internal use only.
    values?: CoreValueType[]
    generator?: () => number // A function for generating synthetic data for testing
    growthRateGenerator?: () => number // A function for generating synthetic data for testing. Can probably combine with the above.
 
    // DEPRECATED
    unit?: string // DEPRECATED: use an existing column type or create a new one instead.
    shortUnit?: string // DEPRECATED: use an existing column type or create a new one instead.
    display?: OwidVariableDisplayConfigInterface // DEPRECATED: use an existing column type or create a new one instead, or migrate any properties you need onto this interface.
}