-
Notifications
You must be signed in to change notification settings - Fork 3
feat(CartesianChart): add Bar and a layout prop for horizontal bars #2880
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
BenniEngel
wants to merge
9
commits into
next
Choose a base branch
from
bar-diagram
base: next
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
cf84bfe
feat(CartesianChart): add Bar and a layout prop for horizontal bars
BenniEngel 00fe4dc
Merge branch 'main' into bar-diagram
BenniEngel df4b682
test: update visual regression screenshots
github-actions[bot] d703ed3
fix(CartesianChart): infer axis type from the chart layout and cleanup
BenniEngel 95a3102
chore: drop unrelated .idea config change
BenniEngel 4fd716b
Merge branch 'main' into bar-diagram
BenniEngel d8be1bd
style(CartesianChart): reformat Bar union type after prettier change
BenniEngel cf82561
Merge branch 'next' into bar-diagram
BenniEngel ff8bd2a
Merge branch 'next' into bar-diagram
BenniEngel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
62 changes: 62 additions & 0 deletions
62
apps/docs/src/content/components/data-visualisation/cartesian-chart/examples/bar.tsx
This file contains hidden or 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,62 @@ | ||
| import { | ||
| typedCartesianChart, | ||
| Heading, | ||
| Section, | ||
| } from "@mittwald/flow-react-components"; | ||
|
|
||
| export default () => { | ||
| const data = [ | ||
| { | ||
| Monat: "Juli", | ||
| Datenbanken: 10, | ||
| Webspace: 15.4, | ||
| Email: 5.1, | ||
| }, | ||
| { | ||
| Monat: "August", | ||
| Datenbanken: 32.9, | ||
| Webspace: 25.6, | ||
| Email: 10, | ||
| }, | ||
| { | ||
| Monat: "September", | ||
| Datenbanken: 40, | ||
| Webspace: 20.2, | ||
| Email: 8, | ||
| }, | ||
| ]; | ||
|
|
||
| const CartesianChart = typedCartesianChart<{ | ||
| Monat: string; | ||
| Datenbanken: number; | ||
| Webspace: number; | ||
| Email: number; | ||
| }>(); | ||
|
|
||
| return ( | ||
| <Section> | ||
| <Heading>Speicherplatz</Heading> | ||
| <CartesianChart.Chart data={data} height="300px"> | ||
| <CartesianChart.Bar | ||
| dataKey="Datenbanken" | ||
| unit="GB" | ||
| /> | ||
| <CartesianChart.Bar | ||
| dataKey="Webspace" | ||
| color="palatinate-blue" | ||
| unit="GB" | ||
| /> | ||
| <CartesianChart.Bar | ||
| dataKey="Email" | ||
| color="tangerine" | ||
| unit="GB" | ||
| /> | ||
| <CartesianChart.XAxis dataKey="Monat" /> | ||
| <CartesianChart.YAxis unit=" GB" /> | ||
| <CartesianChart.Grid /> | ||
| <CartesianChart.Legend /> | ||
| <CartesianChart.Tooltip /> | ||
| </CartesianChart.Chart> | ||
| </Section> | ||
| ); | ||
| }; |
38 changes: 38 additions & 0 deletions
38
...docs/src/content/components/data-visualisation/cartesian-chart/examples/barHorizontal.tsx
This file contains hidden or 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,38 @@ | ||
| import { | ||
| typedCartesianChart, | ||
| Heading, | ||
| Section, | ||
| } from "@mittwald/flow-react-components"; | ||
|
|
||
| export default () => { | ||
| const data = [ | ||
| { Projekt: "Projekt A", Speicherplatz: 68 }, | ||
| { Projekt: "Projekt B", Speicherplatz: 42 }, | ||
| { Projekt: "Projekt C", Speicherplatz: 21 }, | ||
| ]; | ||
|
|
||
| const CartesianChart = typedCartesianChart<{ | ||
| Projekt: string; | ||
| Speicherplatz: number; | ||
| }>(); | ||
|
|
||
| return ( | ||
| <Section> | ||
| <Heading>Speicherplatz pro Projekt</Heading> | ||
| <CartesianChart.Chart | ||
| data={data} | ||
| height="300px" | ||
| layout="vertical" | ||
| > | ||
| <CartesianChart.Bar | ||
| dataKey="Speicherplatz" | ||
| unit="GB" | ||
| /> | ||
| <CartesianChart.XAxis unit=" GB" /> | ||
| <CartesianChart.YAxis dataKey="Projekt" /> | ||
| <CartesianChart.Grid vertical horizontal={false} /> | ||
| <CartesianChart.Tooltip /> | ||
| </CartesianChart.Chart> | ||
| </Section> | ||
| ); | ||
| }; |
65 changes: 65 additions & 0 deletions
65
apps/docs/src/content/components/data-visualisation/cartesian-chart/examples/barStacked.tsx
This file contains hidden or 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,65 @@ | ||
| import { | ||
| typedCartesianChart, | ||
| Heading, | ||
| Section, | ||
| } from "@mittwald/flow-react-components"; | ||
|
|
||
| export default () => { | ||
| const data = [ | ||
| { | ||
| Monat: "Juli", | ||
| Datenbanken: 10, | ||
| Webspace: 15.4, | ||
| Email: 5.1, | ||
| }, | ||
| { | ||
| Monat: "August", | ||
| Datenbanken: 32.9, | ||
| Webspace: 25.6, | ||
| Email: 10, | ||
| }, | ||
| { | ||
| Monat: "September", | ||
| Datenbanken: 40, | ||
| Webspace: 20.2, | ||
| Email: 8, | ||
| }, | ||
| ]; | ||
|
|
||
| const CartesianChart = typedCartesianChart<{ | ||
| Monat: string; | ||
| Datenbanken: number; | ||
| Webspace: number; | ||
| Email: number; | ||
| }>(); | ||
|
|
||
| return ( | ||
| <Section> | ||
| <Heading>Speicherplatz</Heading> | ||
| <CartesianChart.Chart data={data} height="300px"> | ||
| <CartesianChart.Bar | ||
| dataKey="Datenbanken" | ||
| stackId="speicher" | ||
| unit="GB" | ||
| /> | ||
| <CartesianChart.Bar | ||
| dataKey="Webspace" | ||
| color="palatinate-blue" | ||
| stackId="speicher" | ||
| unit="GB" | ||
| /> | ||
| <CartesianChart.Bar | ||
| dataKey="Email" | ||
| color="tangerine" | ||
| stackId="speicher" | ||
| unit="GB" | ||
| /> | ||
| <CartesianChart.XAxis dataKey="Monat" /> | ||
| <CartesianChart.YAxis unit=" GB" /> | ||
| <CartesianChart.Grid /> | ||
| <CartesianChart.Legend /> | ||
| <CartesianChart.Tooltip /> | ||
| </CartesianChart.Chart> | ||
| </Section> | ||
| ); | ||
| }; |
This file contains hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Die Charts zeigen nichts an
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ich guck mir das grad mal an, das scheint nicht an den Bars zu liegen, tritt auch mit anderen Charts auf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ich mach für das Problem ein eigenes Issue auf, du kannst das hier aber so bauen, dann funktioniert es trotzdem: