-
-
Notifications
You must be signed in to change notification settings - Fork 135
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
4d5c8db
commit 83a5aed
Showing
9 changed files
with
437 additions
and
141 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
export { type SparklineProps, Sparklines } from './sparklines' | ||
export { LineChart, type LineChartProps } from './line-chart' | ||
export { AreaChart, type AreaChartProps } from './area-chart' | ||
export { LineChart, type LineChartProps } from './line-chart' | ||
export { BarChart, type BarChartProps } from './bar-chart' | ||
export type { ChartData } from './types' |
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,21 @@ | ||
import { Box, HStack, forwardRef } from '@chakra-ui/react' | ||
import { Payload } from 'recharts/types/component/DefaultLegendContent' | ||
|
||
export interface ChartLegendProps { | ||
payload?: Payload[] | ||
} | ||
|
||
export const ChartLegend = forwardRef<ChartLegendProps, 'div'>( | ||
({ payload }, ref) => { | ||
return ( | ||
<HStack ref={ref} justifyContent="flex-end" spacing="4"> | ||
{payload?.map((entry, index) => ( | ||
<HStack key={`item-${index}`} spacing="2"> | ||
<Box rounded="full" bg={entry.color} boxSize="2" /> | ||
<Box as="span">{entry.value}</Box> | ||
</HStack> | ||
))} | ||
</HStack> | ||
) | ||
} | ||
) |
Oops, something went wrong.