Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

365
Views
How can I draw dynamic line chart based time and data with Compose in Android Studio?

The Code A generate continuous datas whom's range is 0 and 100. I hope to draw dynamic line chart based time and data.

The X axis is time (The initial range is 0 and 1 minutes, and it can be increased by time) , and Y axis is data (The range is 0 and 100).

I hope to draw dynamic line chart in the coordinate system.

It's just like Image A.

How can I do? Is there sample code ?

Code A

private fun soundDbFlow() = flow {
          while (true) {
             val data=(0..100).random().toDouble()
             emit(data)
             delay(100)
          }
}

Image A

enter image description here

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The library for reference in the Android world regarding plotting is MPAndroidCharts.

That is lib is not "jetpack compose compliant" but jetpack compose allows to use good-old android views by using the AndroidView composable which you may be able to use with a line chart as shown in this example

AndroidView(factory = { ctx ->  
  com.github.mikephil.charting.charts.LineChart(ctx).apply {
    // set properties until it looks like you want it to look like
  }
})

Here's a link to the documentation for the MPAndroidCharts lib

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!