Coder Social home page Coder Social logo

BP Display about carekit HOT 15 CLOSED

carekit-apple avatar carekit-apple commented on August 25, 2024
BP Display

from carekit.

Comments (15)

umerkhan-apple avatar umerkhan-apple commented on August 25, 2024 1

@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.

akshay-yadav-apple avatar akshay-yadav-apple commented on August 25, 2024

Hey! @md0u80c9

Do you need any further assistance with this issue?

from carekit.

md0u80c9 avatar md0u80c9 commented on August 25, 2024

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.

dukemike avatar dukemike commented on August 25, 2024

@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.

akshay-yadav-apple avatar akshay-yadav-apple commented on August 25, 2024

Hey @dukemike
Try setting the height anchor on the chartView.

Could you also upload the screenshot of what you're seeing?

Thanks!

from carekit.

ninoguba avatar ninoguba commented on August 25, 2024

@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.

damer avatar damer commented on August 25, 2024

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.

dukemike avatar dukemike commented on August 25, 2024

@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.

damer avatar damer commented on August 25, 2024

@dukemike - Yes I implemented copy similarly (it works correctly).

from carekit.

kelseydedoshka-apple avatar kelseydedoshka-apple commented on August 25, 2024

@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.

dukemike avatar dukemike commented on August 25, 2024

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.

kelseydedoshka-apple avatar kelseydedoshka-apple commented on August 25, 2024

@dukemike - really appreciate the additional information and code snippet here!

from carekit.

ninoguba avatar ninoguba commented on August 25, 2024

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.

kelseydedoshka-apple avatar kelseydedoshka-apple commented on August 25, 2024

@ninoguba great to hear and good suggestion for the sample app!

from carekit.

erik-apple avatar erik-apple commented on August 25, 2024

We will continue tracking this request under the proposal for new chart type #285.

from carekit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.