-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a672caa
commit 978d544
Showing
19 changed files
with
176 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { DrawingArea } from '../context/DrawingProvider'; | ||
import { getPercentageValue } from '../internals/utils'; | ||
import { DefaultizedPieSeriesType } from '../models/seriesType/pie'; | ||
|
||
export function getPieCoordinates( | ||
series: Pick<DefaultizedPieSeriesType, 'cx' | 'cy'>, | ||
drawing: Pick<DrawingArea, 'width' | 'height'>, | ||
): { cx: number; cy: number; availableRadius: number } { | ||
const { height, width } = drawing; | ||
const { cx: cxParam, cy: cyParam } = series; | ||
|
||
const availableRadius = Math.min(width, height) / 2; | ||
const cx = getPercentageValue(cxParam ?? '50%', width); | ||
const cy = getPercentageValue(cyParam ?? '50%', height); | ||
|
||
return { cx, cy, availableRadius }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,11 @@ | ||
export * from './useDrawingArea'; | ||
export * from './useChartId'; | ||
export * from './useScale'; | ||
export * from './useSvgRef'; | ||
export { | ||
useSeries as unstable_useSeries, | ||
usePieSeries as unstable_usePieSeries, | ||
useLineSeries as unstable_useLineSeries, | ||
useBarSeries as unstable_useBarSeries, | ||
useScatterSeries as unstable_useScatterSeries, | ||
} from './useSeries'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import * as React from 'react'; | ||
import { DrawingContext } from '../context/DrawingProvider'; | ||
|
||
export function useChartId() { | ||
const { chartId } = React.useContext(DrawingContext); | ||
|
||
return React.useMemo(() => chartId, [chartId]); | ||
} |
Oops, something went wrong.