Skip to content

Proposal for charts component #201

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

tim-x-y-z
Copy link
Contributor

This PR is more a proposal at this stage, the initial chart implemented is a line chart - very happy to add more if this template seems acceptable. I can also clean a bit the implementation and add parameters if we want.
Here are a few things to note:

  • this uses the package recharts https://github.com/recharts/recharts , this might be a downside if we don't want to have dependencies ? (in particular, this first pr only does the line chart examples here)
  • there is a lot of customisation possible
  • it is hard to me to knwo where to "draw the line" between what parameters to include in teh pydantic object or to let in json_schema_extras - not sure how to decide, probably for the the maintainer to decide.
  • when i put 100% in height the graph never stops - i am missing something to understand why.

For now here is how it looks:
image

PS: i hope this can be useful, i would really love to see charts in fastui :)

@tim-x-y-z
Copy link
Contributor Author

I also need to write the tests for it

Copy link

codecov bot commented Feb 18, 2024

Codecov Report

Attention: Patch coverage is 78.57143% with 6 lines in your changes missing coverage. Please review.

Project coverage is 95.19%. Comparing base (398147e) to head (e1725f9).
Report is 34 commits behind head on main.

Files with missing lines Patch % Lines
src/python-fastui/fastui/components/charts.py 77.77% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #201      +/-   ##
==========================================
- Coverage   95.68%   95.19%   -0.49%     
==========================================
  Files          14       15       +1     
  Lines         950      978      +28     
==========================================
+ Hits          909      931      +22     
- Misses         41       47       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

colors: string[]
tooltip?: boolean
}
export interface BaseModel {}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also unsure why this came about - i probably miissed something somewhere

title: str
width: _t.Union[int, str] = '100%'
height: _t.Union[int, str]
data: _t.List[DataPoint] # type: ignore
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a better way to do this ?

@tim-x-y-z tim-x-y-z mentioned this pull request Mar 6, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant