All files / owid-grapher/grapher/stackedCharts MarimekkoChartConstants.ts

100% Statements 9/9
100% Branches 0/0
100% Functions 0/0
100% Lines 9/9

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 1121x 1x 1x 1x 1x 1x 1x 1x 1x                                                                                                                                                                                                              
import { ChartManager } from "../chart/ChartManager"
 
import { Color, SortConfig, Time } from "../../clientUtils/owidTypes"
import { EntityId, EntityName } from "../../coreTable/OwidTableConstants"
import { OwidTable } from "../../coreTable/OwidTable"
import { StackedPoint } from "./StackedConstants"
import { CoreColumn } from "../../coreTable/CoreTableColumns"
import { Bounds } from "../../clientUtils/Bounds"
import { DualAxis } from "../axis/Axis"
export interface MarimekkoChartManager extends ChartManager {
    endTime?: Time
    excludedEntities?: EntityId[]
    matchingEntitiesOnly?: boolean
    xOverrideTime?: number
    tableAfterAuthorTimelineAndActiveChartTransformAndPopulationFilter?: OwidTable
    sortConfig?: SortConfig
    hideNoDataArea?: boolean
    includedEntities?: number[]
}
 
export interface EntityColorData {
    color: Color
    colorDomainValue: string
}
// Points used on the X axis
export interface SimplePoint {
    value: number
    entity: string
    time: number
}
 
export interface SimpleChartSeries {
    seriesName: string
    points: SimplePoint[]
}
 
export enum BarShape {
    Bar,
    BarPlaceholder,
}
 
export interface Bar {
    kind: BarShape.Bar
    color: Color // color from the variable
    seriesName: string
    yPoint: StackedPoint<EntityName>
}
 
export interface BarPlaceholder {
    kind: BarShape.BarPlaceholder
    seriesName: string
    height: number
}
 
export type BarOrPlaceholder = Bar | BarPlaceholder
 
export interface Item {
    entityName: string
    entityColor: EntityColorData | undefined
    bars: Bar[] // contains the y values for every y variable
    xPoint: SimplePoint // contains the single x value
}
 
export interface PlacedItem extends Item {
    xPosition: number // x value (in pixel space) when placed in final sorted order and including shifts due to one pixel entity minimum
}
 
export interface TooltipProps {
    item: Item
    highlightedSeriesName?: string
    targetTime?: Time
    timeColumn: CoreColumn
    yAxisColumn: CoreColumn
    xAxisColumn: CoreColumn
}
 
export interface EntityWithSize {
    entityName: string
    xValue: number
    ySortValue: number | undefined
}
export interface LabelCandidate {
    item: EntityWithSize
    bounds: Bounds
    isPicked: boolean
    isSelected: boolean
}
 
export interface LabelWithPlacement {
    label: JSX.Element
    preferredPlacement: number
    correctedPlacement: number
    labelKey: string
}
 
export interface LabelCandidateWithElement {
    candidate: LabelCandidate
    labelElement: JSX.Element
}
export interface MarimekkoBarProps {
    bar: BarOrPlaceholder
    tooltipProps: TooltipProps | undefined
    barWidth: number
    isHovered: boolean
    isSelected: boolean
    isFaint: boolean
    entityColor: string | undefined
    y0: number
    isInteractive: boolean
    dualAxis: DualAxis
}