Swift-Charts-Examples icon indicating copy to clipboard operation
Swift-Charts-Examples copied to clipboard

Sleep stages graph

Open andranikdhara opened this issue 10 months ago • 2 comments

I was implementing the Sleep Stages (Awake, REM, Core, Deep) graph using the BarMark. The plot matches that of the Apple's Health App, but I could not manage to put the connecting lines as shown in the Apple Health app. Can anybody tell me how to implement the connecting lines between Bar Marks.

Apple Health App mine

andranikdhara avatar Apr 14 '24 20:04 andranikdhara

No direct API is available in Swift Charts to get the lines easily - I asked Apple devs during one of the Ask Dev sessions and confirmed that it is impossible with the current API. Although, I did something similar by drawing clip shapes over the RectangleMark. See the effect here.

nonameplum avatar May 07 '24 11:05 nonameplum

No direct API is available in Swift Charts to get the lines easily - I asked Apple devs during one of the Ask Dev sessions and confirmed that it is impossible with the current API. Although, I did something similar by drawing clip shapes over the RectangleMark. See the effect here.

@nonameplum Any chance you can share sample code for how you achieved this? I have been trying in a demo project but can't seem to figure it out.

Thanks!

mitchellporter avatar Jun 27 '24 23:06 mitchellporter