Skip to content

Need some help for implementing API data in charts #371

Closed Answered by patrickmichalik
Shaikh-Aatif asked this question in Questions
Discussion options

You must be logged in to vote

Hello! First of all, no need to apologize. It’s a good question, and I’ll be happy to help. Start by creating a ChartEntryModelProducer and linking it to your chart. I presume you have a ViewModel, and you have access to the score list there, so you can put the ChartEntryModelProducer in the ViewModel. Please avoid instantiating ChartEntryModelProducer in composable functions.

val chartEntryModelProducer = ChartEntryModelProducer()

Wherever the list of scores is returned, you can add a call to ChartEntryModelProducer#setEntries. You’ll have to map the scores to ChartEntry instances. Let’s say the list is called scores. You can use something like this:

chartEntryModelProducer.setEntries(sc…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by patrickmichalik
Comment options

You must be logged in to vote
1 reply
@patrickmichalik
Comment options

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