Skip to content
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

Add a scrolling graph #83

Open
scsinke opened this issue Jul 5, 2022 · 10 comments
Open

Add a scrolling graph #83

scsinke opened this issue Jul 5, 2022 · 10 comments

Comments

@scsinke
Copy link

scsinke commented Jul 5, 2022

The Apple Health app contains a graph that you can scroll. I think this would also be a good use case to implement.

I have no clue where to start yet, but maybe we can figure something out.

RPReplay_Final1657032449.MP4
@jordibruin
Copy link
Owner

https://wwdclounges.com/wwdc22/swiftui-lounge.html#can-the-new-charts-api-allow-for-scrolling-similar-to-the-health-apps-charts

Seems like we need to file some feedback first! From the digital lounges:

Can the new Charts API allow for scrolling? similar to the health app's charts

|U03HL00QL68|: Sorry, late answer forgot to hit send: Yes, charts should behave just like any other view in this regard. though you may have to set explicit frames on the chart to specify how big (wide? tall?) you want it to be

|U03J7BQ7P9N|: We just couldn’t wait till the next Q&A, Ok I promise we are done now!!! 🤓

|U03HL00QL68|: Hey <@U03J21CNQ1G> I just realized the health app chart does scrolling that keeps the y-axis stationary, that specifically isn't supported, but we've received a few requests about this, but few feedbacks. So if you file a feedback for the Charts team, we'd appreciate it

@jordibruin
Copy link
Owner

@scsinke check out the latest PR by Stewart Lynch 🙂

@atrinh0
Copy link
Collaborator

atrinh0 commented Jul 15, 2022

Sort of meets it but the headers get scrolled off, hopefully someone finds a way to allow the axis labels to be sticky when scrolling.

@scsinke
Copy link
Author

scsinke commented Jul 15, 2022

@jordibruin yeah it's a scrolling graph, but still not the same feel as the version used in the apple health app. Maybe we can make some improvement to this one to make is more resembling to the apple version.

@jordibruin
Copy link
Owner

As I mentioned in my comment above, stationary axis labels aren't supported right now so I don't think we'll get much more than this. 😞

@atrinh0
Copy link
Collaborator

atrinh0 commented Jul 16, 2022

As I mentioned in my comment above, stationary axis labels aren't supported right now so I don't think we'll get much more than this. 😞

Was curious about a smoke a mirrors type of workaround, e.g. HStack with around 30 pixels showing the axis (and clipping the rest of the chart) and a scroll view next to it containing a duplicate chart with axis labels disabled.

Horrible solution but it might give the illusion/effect we are trying to achieve.

Side effects:

  • Dynamic text support
  • Dynamic calculation of the width based on content/text, etc
  • Performance impact with a large dataset

@jordibruin
Copy link
Owner

As I mentioned in my comment above, stationary axis labels aren't supported right now so I don't think we'll get much more than this. 😞

Was curious about a smoke a mirrors type of workaround, e.g. HStack with around 30 pixels showing the axis (and clipping the rest of the chart) and a scroll view next to it containing a duplicate chart with axis labels disabled.

Horrible solution but it might give the illusion/effect we are trying to achieve.

Side effects:

  • Dynamic text support
  • Dynamic calculation of the width based on content/text, etc
  • Performance impact with a large dataset

Cool! let me try it out

@jordibruin
Copy link
Owner

jordibruin commented Jul 21, 2022

Very hacky but it's an approach we could explore more! @atrinh0

CleanShot.2022-07-21.at.15.33.54.mp4

@jordibruin jordibruin added the Not Possible (right now) For when Swift Charts does not support a feature request label Aug 30, 2022
@MichaelBechHansen
Copy link

Here's a gist that looks pretty promising for emulating the Health apps scrollable charts:
https://gist.github.com/beader/8779526f466e373a9085338742919d9b

@atrinh0 atrinh0 removed the Not Possible (right now) For when Swift Charts does not support a feature request label Jul 15, 2023
@atrinh0
Copy link
Collaborator

atrinh0 commented Jul 15, 2023

https://developer.apple.com/videos/play/wwdc2023/10037/?time=469

This is now possible with iOS 17

Screenshot 2023-07-15 at 10 38 46

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants