Comments (15)
@md0u80c9 I think you are referring to the charts in the Health app. Unfortunately, that chart is not available for CareKit. One possible solution could be to use ORKDiscreteGraphChartView
from ResearchKit. The approach would be to create a subclass of OCKChart
and return ORKDiscreteGraphCartView
for the chartView
method override in your OCKChart
subclass.
from carekit.
Hey! @md0u80c9
Do you need any further assistance with this issue?
from carekit.
Hi,
I haven't managed to progress wth this any further (been busy with the HL7 CDA submission). I still think it would be useful in CareKit - blood pressure is obviously a fairly major measure.
from carekit.
@akshay-yadav-apple, I thought it would be as simple as subclassing OCKChart
, and returning the ORK chart for chartView
like I did in this gist, but I always get No Data. What am I doing wrong?
Thanks!
from carekit.
Hey @dukemike
Try setting the height anchor on the chartView.
Could you also upload the screenshot of what you're seeing?
Thanks!
from carekit.
@akshay-yadav-apple if Apple or someone who's done it successfully already could provide us examples on how to achieve showing ResearchKit-based charts onto CareKit's Insights, this would be tremendously helpful to the community.
from carekit.
I came across this issue too and noticed that "No Data" was coming from the ORKLineGraphChartView object and not something that the OCKInsightItem object was doing. (I could set the noDataText property on the ORKLineGraphChartView and it would show up in the Insights View Controller).
The solution that worked for me was to declare the LineGraphDataSource as an optional and instantiate it within the chartView function and then connect it to the OCKLineGraphChartView.datasource.
Im no expert at Swift/ObjC/Cocoa so I really cant say why @dukemike 's gist doesn't work -- seems to me that it should.
from carekit.
@damer, did you implement copy
? I have something along the lines of:
override func copy(with zone: NSZone? = nil) -> Any {
let chart: SampleORKChart = super.copy(with: zone) as! SampleORKChart
// copy any class-specific attributes...
return chart
}
where SampleORKChart
is my custom chart type.
from carekit.
@dukemike - Yes I implemented copy similarly (it works correctly).
from carekit.
@md0u80c9, @dukemike, @ninoguba, @damer - apologies its been a while here. We love the idea of being able to use ResearchKit charts in CareKit. Unfortunately we don't have an existing solution that we can share with you at this time however it seems as though @damer and @dukemike may have implementations here that have worked for them. Would you both mind sharing some additional information here or even sharing some code for others to take a look at?
from carekit.
This code works for me, using RK's PieChartDataSource
(eg, copy it into your project or into OCKSample
.) If you're using OCKSample
to try this, you can change BuildInsightsOperation:createBackPainInsight
to return MyChart()
instead.
import UIKit
import CareKit
import ResearchKit
class MyChart: OCKChart {
override func chartView() -> UIView {
let chart = ORKPieChartView()
let dataSource = PieChartDataSource()
chart.dataSource = dataSource
chart.heightAnchor.constraint(equalToConstant: 200).isActive = true
return chart
}
override func copy(with zone: NSZone? = nil) -> Any {
let chart: MyChart = super.copy(with: zone) as! MyChart
return chart
}
}
from carekit.
@dukemike - really appreciate the additional information and code snippet here!
from carekit.
Yes the examples from @djknowles on #117 and @dukemike helped me a lot. Would just be nice if the example was included in OCKSample so others can find it easier.
from carekit.
@ninoguba great to hear and good suggestion for the sample app!
from carekit.
We will continue tracking this request under the proposal for new chart type #285.
from carekit.
Related Issues (20)
- percentage of completed tasks HOT 3
- Button height change HOT 1
- present a ResearchKit survey using SwiftUI
- Fetch All Outcomes HOT 3
- Extra event for OCKTask with all day duration
- Auto Scheduling Events HOT 3
- Warning when uploading App HOT 7
- Occurrence circles HOT 29
- Error when building on latest Xcode and macOS Ventura HOT 1
- Carekit_CareKitStore emitted errors HOT 1
- Compile Errors HOT 1
- How do you save an CareKit OCKOutcomeValue for an array of ResearchKit ORKChoiceQuestionResults HOT 12
- ORKTextChoice + ORKPredicateStepNavigationRule + CareKit + ResearchKit HOT 10
- Bar chart changes every time i close and reopen the application HOT 9
- Problems integrating HealthKit data into an OCKCartesianChartViewController HOT 1
- CareKitStore-CoreData-NSReadOnlyPersistentStoreOption-ErrorMessage HOT 1
- Create monthly charts HOT 3
- Trying to schedule a notification based on the caloriesBurned only if they are less than a certain amount (with query to the health store) HOT 6
- Creating PDF with charts and data from more than one View HOT 1
- Sample app for v3? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from carekit.