Skip to content

Commit

Permalink
feat: dencity chart
Browse files Browse the repository at this point in the history
  • Loading branch information
TbIKoBKa committed Oct 29, 2024
1 parent 9ca8db6 commit 5aa9e62
Show file tree
Hide file tree
Showing 13 changed files with 386 additions and 273 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,11 @@
"@real-wagmi/sdk": "1.4.0",
"@real-wagmi/v3-sdk": "1.4.0",
"@storybook/addon-themes": "^7.5.3",
"@tanstack/react-query": "^5.59.16",
"@types/styled-system": "^5.1.15",
"@types/uuid": "^9.0.7",
"echarts": "^5.5.1",
"echarts-for-react": "^3.0.2",
"framer-motion": "10.11.2",
"graphql": "^16.8.1",
"graphql-request": "^6.1.0",
Expand Down
9 changes: 0 additions & 9 deletions src/components/Charts/Density/components/CustomBar.tsx

This file was deleted.

58 changes: 0 additions & 58 deletions src/components/Charts/Density/components/CustomTooltip/index.tsx

This file was deleted.

25 changes: 0 additions & 25 deletions src/components/Charts/Density/components/CustomTooltip/styles.ts

This file was deleted.

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion src/components/Charts/Density/constants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export const DEFAULT_SURROUNDING_TICKS = 300;
export const INITIAL_TICKS_TO_FETCH = 200;
export const ZOOM_INTERVAL = 20;

export const maxUint128 = 2n ** 128n - 1n;
28 changes: 28 additions & 0 deletions src/components/Charts/Density/hooks/useChartResize.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import ReactEcharts from 'echarts-for-react';
import { MutableRefObject, useCallback, useEffect, useMemo, useRef } from 'react';

interface IUseChartResize {
chartRef: MutableRefObject<ReactEcharts | null>;
}

export const useChartResize = (): IUseChartResize => {
const chartRef = useRef<ReactEcharts>(null);

const resizeHandler = useCallback((): void => {
const echartsInstance = chartRef.current?.getEchartsInstance();
echartsInstance && echartsInstance.resize();
}, [chartRef]);

useEffect(() => {
window.addEventListener('resize', resizeHandler);
return (): void => {
window.removeEventListener('resize', resizeHandler);
};
}, [resizeHandler]);

return useMemo((): IUseChartResize => {
return {
chartRef,
};
}, []);
};
Loading

0 comments on commit 5aa9e62

Please sign in to comment.