e0d9b4d335
* Fiddle around with everything, WIP FR charts * Implement numeric chart * Reorganize everything into neat little files * Add `AreaWithTopStroke` helper * Tidying, don't gratuitously use d3.format * Remove duplicate code * Better tooltip bisection * `NumericPoint` -> `DistributionPoint` * Add numeric market tooltip * Make numeric chart bucket points less wrong * Clean up numeric bucket computation * Clean up a bunch of tooltip stuff, add FR legend tooltips * Fix a dumb bug * Implement basic time selection * Fix fishy Date.now inconsistency bugs * Might as well show all the FR outcomes now * Make tooltips accurate on curveStepAfter charts * Make log scale PN charts work properly * Adjust x-axis tick count * Display tooltip on charts only for mouse * Fix up deps * Tighter chart tooltips * Adjustments to chart time range management * Better date formatting * Continue tweaking time selection handling to be perfect * Make FR charts taller by default
35 lines
982 B
TypeScript
35 lines
982 B
TypeScript
import { Contract } from 'common/contract'
|
|
import { Bet } from 'common/bet'
|
|
import { BinaryContractChart } from './binary'
|
|
import { PseudoNumericContractChart } from './pseudo-numeric'
|
|
import { ChoiceContractChart } from './choice'
|
|
import { NumericContractChart } from './numeric'
|
|
|
|
export const ContractChart = (props: {
|
|
contract: Contract
|
|
bets: Bet[]
|
|
height?: number
|
|
}) => {
|
|
const { contract } = props
|
|
switch (contract.outcomeType) {
|
|
case 'BINARY':
|
|
return <BinaryContractChart {...{ ...props, contract }} />
|
|
case 'PSEUDO_NUMERIC':
|
|
return <PseudoNumericContractChart {...{ ...props, contract }} />
|
|
case 'FREE_RESPONSE':
|
|
case 'MULTIPLE_CHOICE':
|
|
return <ChoiceContractChart {...{ ...props, contract }} />
|
|
case 'NUMERIC':
|
|
return <NumericContractChart {...{ ...props, contract }} />
|
|
default:
|
|
return null
|
|
}
|
|
}
|
|
|
|
export {
|
|
BinaryContractChart,
|
|
PseudoNumericContractChart,
|
|
ChoiceContractChart,
|
|
NumericContractChart,
|
|
}
|