-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
e581837
commit 5c482d5
Showing
10 changed files
with
810 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import React from 'react'; | ||
|
||
const ArrowRightIcon = ({ ...props }) => ( | ||
<svg fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" {...props}> | ||
<path d="M16.1716 10.9999L10.8076 5.63589L12.2218 4.22168L20 11.9999L12.2218 19.778L10.8076 18.3638L16.1716 12.9999H4V10.9999H16.1716Z"></path> | ||
</svg> | ||
); | ||
|
||
export default ArrowRightIcon; |
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,30 @@ | ||
import { FunnelChart, FunnelChartProps } from '@lobehub/charts'; | ||
|
||
const data: FunnelChartProps['data'] = [ | ||
{ name: 'Session start', value: 31_943 }, | ||
{ name: 'Account Created', value: 10_474 }, | ||
{ | ||
name: 'Item Detail Page', | ||
value: 9482, | ||
}, | ||
{ | ||
name: 'Added to cart', | ||
value: 4684, | ||
}, | ||
{ | ||
name: 'Complete Purchase', | ||
value: 1283, | ||
}, | ||
]; | ||
|
||
export default () => { | ||
return ( | ||
<FunnelChart | ||
calculateFrom={'previous'} | ||
data={data} | ||
evolutionGradient={false} | ||
gradient={true} | ||
showArrow={false} | ||
/> | ||
); | ||
}; |
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,47 @@ | ||
import { FunnelChart, FunnelChartProps } from '@lobehub/charts'; | ||
import { StoryBook, useControls, useCreateStore } from '@lobehub/ui'; | ||
|
||
const data: FunnelChartProps['data'] = [ | ||
{ name: '1. Add credit Card', value: 89 }, | ||
{ name: '2. Copy invite code', value: 6 }, | ||
{ | ||
name: '3. Send invite code', | ||
value: 5, | ||
}, | ||
]; | ||
|
||
export default () => { | ||
const store = useCreateStore(); | ||
|
||
const props: FunnelChartProps | any = useControls( | ||
{ | ||
barGap: '20%', | ||
enableLegendSlider: false, | ||
evolutionGradient: true, | ||
gradient: false, | ||
showArrow: true, | ||
showGridLines: true, | ||
showLegend: true, | ||
showTooltip: true, | ||
showXAxis: true, | ||
showYAxis: true, | ||
variant: { | ||
options: ['base', 'center'], | ||
value: 'base', | ||
}, | ||
xAxisLabel: '', | ||
yAxisAlign: { | ||
options: ['left', 'right'], | ||
value: 'left', | ||
}, | ||
yAxisLabel: '', | ||
}, | ||
{ store }, | ||
); | ||
|
||
return ( | ||
<StoryBook levaStore={store}> | ||
<FunnelChart data={data} {...props} /> | ||
</StoryBook> | ||
); | ||
}; |
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 @@ | ||
--- | ||
nav: Components | ||
group: Charts | ||
description: A funnel chart illustrates the progression or conversion rates through successive stages of a process. | ||
--- | ||
|
||
<code src="./demos/index.tsx" nopadding></code> | ||
|
||
## Usage example with evolution gradient | ||
|
||
The `calculateFrom` prop controls the referenced value to calculate the drop-off between steps. Here we set it to previous, to always reference the preceding bar as the calculation base. We also set `showArrow` to false. | ||
|
||
<code src="./demos/CalculateFrom.tsx"></code> | ||
|
||
## API | ||
|
||
<API></API> |
Oops, something went wrong.