Charts for ResearchKit (Issue #92) - #178
Conversation
|
Hey @coxy1989, this looks like a great PR, congrats. I've been drafting a ResearchKit Coding Style guide. It might be a good idea to make sure your PR conforms to it, as there are some divergencies between the ResearchKit and AppCore styles. (Specially, the opening brackets on the same line item.) Do note that the guide is a work in progress: and any comments are welcome (via Issue #174 or the mailing list). |
|
Wow, that was quick! Thanks! |
|
I'll review in detail tomorrow. Thanks |
|
@rsanchezsaez to review. |
|
btw this is not expected to go into v1.1, if we take this it'll be after the branch. |
|
I have not started reviewing the code yet, but there seems to be a problem in the pie chart layout. The bottom percentage label overlaps the legend. @coxy1989: Could you look into that? It happens on all devices. See an iPhone 6 screenshot below. |
|
I'm in the middle of reviewing the code, expect more comments soon. A head start: we'll need to add appledoc comments to all the new headers, it'd be a good idea to start thinking about them. |
|
oops sorry didn't see you were up to this before I pushed that change. Will take a look at your comments now. |
|
I'm internally debating on what the names for the main chart classes should be. First, there's the debate between chart vs graph. Semantically, all graphs are charts but not all charts are graphs. A pie chart is certainly not a graph, so I think it was a good call to rename Regarding So I think I'd go for @jwe-apple, @coxy1989: What are your thoughts on this? Please also note that there is a chance for greater code reuse between the discrete and line charts. I've been noticing a good amount of duplicated code which could be moved to the superclass. |
ORKCatalog: update the chart tab bar icon to a black template
|
Let's not jump the gun on actually making these naming changes. I don't have time to review right now, but this needs at least a couple other reviews. |
|
Ok, let's leave the class naming for later. I'll delve into reviewing the actual code. |
There was a problem hiding this comment.
Extract all colors to ORKSkin (see ORKColor() function).
Also: - Some property renames. - Make text property of 'copy' type. - Remove unneeded 'hidesLegend' property.
…-graphs # Conflicts: # ResearchKit.xcodeproj/project.pbxproj # ResearchKit/Common/ORKHelpers.h # ResearchKit/Common/ORKHelpers.m # Testing/ORKTest/ORKTest.xcodeproj/project.pbxproj # Testing/ORKTest/ORKTest/MainViewController.m
|
I have finally finished reworking and refactoring the chart code to the point I think is ready to merge into master. I submitted a new PR against @coxy1989's branch. The changeset is huge, so a peer review would quite helpful. Sorry again for the delay! An overview of some of the changes:
All in all, I think performance is better than it was before. Rotation of Also, it's worth considering if we should rename Some things we could do as follow-on issues:
If you agree this are worthwhile improvements, I can add follow-on issues tomorrow. |
Also fixes a occasional crash if line/point layout is tried before obtaining the normalized y axis points.
|
Also, @coxy1989, thanks a lot for your previous work! It was a pleasure working with your code. For example, the scrubber animation works beautifully, I didn't had to change any of that. The rotation performance and animation issues were mostly inherited from from the AppCore architecture and implementation. And the randomized colors- |
…aph color is updated when changing referenceLineColor
|
@rsanchezsaez Thanks for the great work. Tested on iPhone 6 plus, the rotation is much more smooth. Agree, the class names should end with |
|
@coxy1989 Thanks your previous work too! |
…emory usage and performance) Also, add slight top padding so drawn are doesn't overflow graph view bounds at default text size.
…r than from 'traitCollectionDidChange:' (Fixes a rare bug in which sometimes view width is not correct during 'layoutSubviews' after a portrait to landscape rotation. E.g.: bug is present in ORKTest, but not in ORKCatalog.)
|
I have added a few more commits with last minute fixes, and the final refactor to A note: performance also depends on the number of plotted graph points: it decreases quickly as you add points. For a fair comparison, try with the And the follow-on issues: #379. |
Latest charts changes
There was a problem hiding this comment.
Is it necessary to expose this panGestureRecognizer? What is the use case of it?
There was a problem hiding this comment.
I guess that it could be useful if the user wants to add a graph in a custom view hierarchy that has other conflicting gesture recognizers, and wants to prioritize them (same as UIScrollView's exposing their panGestureRecognizer and pinchGestureRecognizer`).
But it may be a quite unfrequent use case, I'm happy to remove it if you prefer so.
|
Thanks Chris. Typos fixed. |
Fix headerdoc typos
|
Thanks @coxy1989 and @rsanchezsaez. |
Charts for ResearchKit (Issue #92)

API for Line, Discrete and Pie charts for RK.
Do you feel the circular progress view for the day's tasks that appears is the AppCore apps' dashboards qualifies as a chart that should be included too, seems broadly useful to most/all RK apps. Badges is another which could also be included.
I think including those charts in RK and the catalog may encourage developers to contribute their own charts to the proj which can't be a bad thing
One of the big challenges of RK apps face will be to retain participants for as long as possible, a broader range of great looking/ interesting dashboard charts is one way to do that.
#92