Clamp time range in history chart scales (#952)
This commit is contained in:
parent
9238b20242
commit
89c3ea559c
|
@ -56,7 +56,7 @@ export const BinaryContractChart = (props: {
|
||||||
const containerRef = useRef<HTMLDivElement>(null)
|
const containerRef = useRef<HTMLDivElement>(null)
|
||||||
const width = useElementWidth(containerRef) ?? 0
|
const width = useElementWidth(containerRef) ?? 0
|
||||||
const height = props.height ?? (isMobile ? 250 : 350)
|
const height = props.height ?? (isMobile ? 250 : 350)
|
||||||
const xScale = scaleTime(visibleRange, [0, width - MARGIN_X])
|
const xScale = scaleTime(visibleRange, [0, width - MARGIN_X]).clamp(true)
|
||||||
const yScale = scaleLinear([0, 1], [height - MARGIN_Y, 0])
|
const yScale = scaleLinear([0, 1], [height - MARGIN_Y, 0])
|
||||||
return (
|
return (
|
||||||
<div ref={containerRef}>
|
<div ref={containerRef}>
|
||||||
|
|
|
@ -159,7 +159,7 @@ export const ChoiceContractChart = (props: {
|
||||||
const containerRef = useRef<HTMLDivElement>(null)
|
const containerRef = useRef<HTMLDivElement>(null)
|
||||||
const width = useElementWidth(containerRef) ?? 0
|
const width = useElementWidth(containerRef) ?? 0
|
||||||
const height = props.height ?? (isMobile ? 150 : 250)
|
const height = props.height ?? (isMobile ? 150 : 250)
|
||||||
const xScale = scaleTime(visibleRange, [0, width - MARGIN_X])
|
const xScale = scaleTime(visibleRange, [0, width - MARGIN_X]).clamp(true)
|
||||||
const yScale = scaleLinear([0, 1], [height - MARGIN_Y, 0])
|
const yScale = scaleLinear([0, 1], [height - MARGIN_Y, 0])
|
||||||
return (
|
return (
|
||||||
<div ref={containerRef}>
|
<div ref={containerRef}>
|
||||||
|
|
|
@ -71,7 +71,7 @@ export const PseudoNumericContractChart = (props: {
|
||||||
const containerRef = useRef<HTMLDivElement>(null)
|
const containerRef = useRef<HTMLDivElement>(null)
|
||||||
const width = useElementWidth(containerRef) ?? 0
|
const width = useElementWidth(containerRef) ?? 0
|
||||||
const height = props.height ?? (isMobile ? 150 : 250)
|
const height = props.height ?? (isMobile ? 150 : 250)
|
||||||
const xScale = scaleTime(visibleRange, [0, width - MARGIN_X])
|
const xScale = scaleTime(visibleRange, [0, width - MARGIN_X]).clamp(true)
|
||||||
const yScale = contract.isLogScale
|
const yScale = contract.isLogScale
|
||||||
? scaleLog(
|
? scaleLog(
|
||||||
[Math.max(contract.min, 1), contract.max],
|
[Math.max(contract.min, 1), contract.max],
|
||||||
|
|
Loading…
Reference in New Issue
Block a user