All files / owid-grapher/grapher/captionedChart CaptionedChart.stories.tsx

100% Statements 55/55
100% Branches 4/4
100% Functions 4/4
100% Lines 55/55

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 681x 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 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x                          
import { SynthesizeGDPTable } from "../../coreTable/OwidTableSynthesizers"
import {
    ChartTypeName,
    FacetStrategy,
    GrapherTabOption,
    SeriesStrategy,
} from "../core/GrapherConstants"
import { DEFAULT_BOUNDS } from "../../clientUtils/Bounds"
import * as React from "react"
import {
    CaptionedChart,
    CaptionedChartManager,
    StaticCaptionedChart,
} from "./CaptionedChart"
 
export default {
    title: "CaptionedChart",
    component: CaptionedChart,
}
 
const table = SynthesizeGDPTable({ entityCount: 5 })
 
const manager: CaptionedChartManager = {
    tabBounds: DEFAULT_BOUNDS,
    table,
    selection: table.availableEntityNames,
    currentTitle: "This is the Title",
    subtitle: "A Subtitle",
    note: "Here are some footer notes",
    isReady: true,
    availableFacetStrategies: [FacetStrategy.none],
}
 
export const LineChart = (): JSX.Element => <CaptionedChart manager={manager} />
 
export const StaticLineChartForExport = (): JSX.Element => {
    return (
        <StaticCaptionedChart
            manager={{
                ...manager,
                isExportingtoSvgOrPng: true,
            }}
        />
    )
}
 
export const MapChart = (): JSX.Element => (
    <CaptionedChart manager={{ ...manager, tab: GrapherTabOption.map }} />
)
export const StackedArea = (): JSX.Element => (
    <CaptionedChart
        manager={{
            ...manager,
            type: ChartTypeName.StackedArea,
            seriesStrategy: SeriesStrategy.entity,
        }}
    />
)
export const Scatter = (): JSX.Element => (
    <CaptionedChart
        manager={{
            ...manager,
            type: ChartTypeName.ScatterPlot,
            table: table.filterByTargetTimes([1999], 0),
        }}
    />
)