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 | 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 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 * as React from "react"
import { DataTable, DataTableManager } from "./DataTable"
import { SynthesizeGDPTable } from "../../coreTable/OwidTableSynthesizers"
import { childMortalityGrapher, IncompleteDataTable } from "./DataTable.sample"
import { ChartTypeName, GrapherTabOption } from "../core/GrapherConstants"
export default {
title: "DataTable",
component: DataTable,
}
const table = SynthesizeGDPTable({
timeRange: [1950, 2010],
entityCount: 7,
})
const entityType = "country"
export const Default = (): JSX.Element => {
const manager: DataTableManager = {
table,
entityType,
}
return <DataTable manager={manager} />
}
export const WithTimeRange = (): JSX.Element => {
const manager: DataTableManager = {
table,
entityType,
}
manager.startTime = 1950
manager.endTime = 2000
return <DataTable manager={manager} />
}
export const WithTolerance = (): JSX.Element => {
const table = SynthesizeGDPTable(
{
timeRange: [2010, 2020],
entityCount: 3,
},
3,
{
tolerance: 1,
}
)
const filteredTable = table.dropRowsAt([0, 10, 11])
return (
<div>
<DataTable
manager={{
table,
startTime: 2010,
endTime: 2010,
entityType,
}}
/>
<div>
One country with data, one with data within tolerance, one
outside tolerance:
</div>
<DataTable
manager={{
startTime: 2010,
endTime: 2010,
table: filteredTable,
entityType,
}}
/>
</div>
)
}
export const FromLegacy = (): JSX.Element => {
const grapher = childMortalityGrapher()
return <DataTable manager={grapher} />
}
export const FromLegacyWithTimeRange = (): JSX.Element => {
const grapher = childMortalityGrapher({
type: ChartTypeName.LineChart,
tab: GrapherTabOption.chart,
})
grapher.startHandleTimeBound = 1950
grapher.endHandleTimeBound = 2019
return <DataTable manager={grapher} />
}
export const IncompleteDataTableComponent = (): JSX.Element => {
const grapher = IncompleteDataTable()
grapher.timelineHandleTimeBounds = [2000, 2000]
return <DataTable manager={grapher} />
}
// grapher.timeDomain = [2009, 2017]
// Todo: how can I get this to show a closest time popup?
|