-
Notifications
You must be signed in to change notification settings - Fork 49
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
Showing
4 changed files
with
134 additions
and
6 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
packages/dev/src/examples/misc/donut/half-donut-full-height/index.tsx
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,37 @@ | ||
import React, { useEffect, useState } from 'react' | ||
import { VisSingleContainer, VisDonut } from '@unovis/react' | ||
import { DONUT_HALF_ANGLE_RANGES } from '@unovis/ts' | ||
|
||
export const title = 'Half Donut: Full Height' | ||
export const subTitle = 'Testing the resize behavior' | ||
export const component = (): JSX.Element => { | ||
const data = [3, 2, 5, 4, 0, 1] | ||
|
||
const [currentAngleRange, setCurrentAngleRange] = useState(DONUT_HALF_ANGLE_RANGES[0]) | ||
|
||
// Cycle through the half-donut angle ranges for testing | ||
useEffect(() => { | ||
const interval = setInterval(() => { | ||
setCurrentAngleRange((prev: [number, number]) => { | ||
const currentIndex = DONUT_HALF_ANGLE_RANGES.indexOf(prev) | ||
return DONUT_HALF_ANGLE_RANGES[(currentIndex + 1) % DONUT_HALF_ANGLE_RANGES.length] | ||
}) | ||
}, 2000) | ||
return () => clearInterval(interval) | ||
}, []) | ||
|
||
return ( | ||
<VisSingleContainer style={{ height: '100%' }} > | ||
<VisDonut | ||
value={d => d} | ||
data={data} | ||
padAngle={0.02} | ||
duration={0} | ||
arcWidth={80} | ||
angleRange={currentAngleRange} | ||
centralLabel="Central Label" | ||
centralSubLabel="Sub-label" | ||
/> | ||
</VisSingleContainer> | ||
) | ||
} |
25 changes: 25 additions & 0 deletions
25
packages/dev/src/examples/misc/donut/half-donut-with-labels/index.tsx
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,25 @@ | ||
import React from 'react' | ||
import { VisSingleContainer, VisDonut } from '@unovis/react' | ||
import { DONUT_HALF_ANGLE_RANGE_TOP } from '@unovis/ts' | ||
|
||
export const title = 'Half Donut: Labels' | ||
export const subTitle = 'Testing the label offsets' | ||
export const component = (): JSX.Element => { | ||
const data = [3, 2, 5, 4, 0, 1] | ||
|
||
return ( | ||
<VisSingleContainer style={{ height: '100%' }} > | ||
<VisDonut | ||
value={d => d} | ||
data={data} | ||
padAngle={0.02} | ||
duration={0} | ||
arcWidth={80} | ||
angleRange={DONUT_HALF_ANGLE_RANGE_TOP} | ||
centralLabel='Central Label' | ||
centralSubLabel='Central Sub Label' | ||
centralLabelsOffsetY={-24} | ||
/> | ||
</VisSingleContainer> | ||
) | ||
} |
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