Skip to content

Commit

Permalink
fix: always enforce zoom domain minimum if present (#1460)
Browse files Browse the repository at this point in the history
  • Loading branch information
tyleroooo authored Jan 23, 2025
1 parent 0b320d2 commit 04c7efa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/visx/TimeSeriesChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export const TimeSeriesChart = <Datum extends {}>({
return getClampedZoomDomain(defaultZoomDomain);
}
if (latestDatum != null && earliestDatum != null) {
return xAccessor(latestDatum) - xAccessor(earliestDatum);
return getClampedZoomDomain(xAccessor(latestDatum) - xAccessor(earliestDatum));
}
return minZoomDomain;
})()
Expand Down
3 changes: 2 additions & 1 deletion src/views/charts/FundingChart/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { FundingRateResolution, type FundingChartDatum } from '@/constants/chart
import { STRING_KEYS } from '@/constants/localization';
import { FundingDirection } from '@/constants/markets';
import { SMALL_PERCENT_DECIMALS, TINY_PERCENT_DECIMALS } from '@/constants/numbers';
import { timeUnits } from '@/constants/time';

import { useBreakpoints } from '@/hooks/useBreakpoints';
import { useStringGetter } from '@/hooks/useStringGetter';
Expand All @@ -26,7 +27,7 @@ import { MustBigNumber } from '@/lib/numbers';

import { FundingChartTooltipContent } from './Tooltip';

const FUNDING_RATE_TIME_RESOLUTION = 60 * 60 * 1000; // 1 hour
const FUNDING_RATE_TIME_RESOLUTION = timeUnits.hour;

const getAllFundingRates = (oneHourRate: number = 0) => ({
[FundingRateResolution.OneHour]: oneHourRate,
Expand Down

0 comments on commit 04c7efa

Please sign in to comment.