Profile image

Line Graph

아빠뎁 | 조회 수 7 | 2021.02.07. 10:28
Category Free

Gradle :
  implementation 'ir.farshid_roohi:linegraph:0.1.3'

  <ir.farshid_roohi.linegraph.LineChart
  android:id="@+id/lineChart"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:orientation="vertical"
  app:chart_padding_bottom="35dp"
  app:chart_padding_left="20dp"
  app:chart_padding_right="20dp"
  app:chart_padding_top="20dp"
  app:chart_line_color="#32FFFFFF"
  app:chart_bg_color="#FF2B4A83"
  />

class MainActivity : AppCompatActivity() {

   override fun onCreate(savedInstanceState: Bundle?) {
       super.onCreate(savedInstanceState)
       setContentView(R.layout.activity_main)

       val firstChartEntity = ChartEntity(Color.WHITE, graph1)
       val secondChartEntity = ChartEntity(Color.YELLOW, graph2)

       val list = ArrayList<ChartEntity>()
       list.add(firstChartEntity)
       list.add(secondChartEntity)
       lineChart.legendArray = legendArr
       lineChart.setList(list)
   }

   private val graph1 = floatArrayOf(113000f, 183000f, 188000f, 695000f, 324000f, 230000f, 188000f, 15000f, 126000f, 5000f, 33000f)
   private val graph2 = floatArrayOf(0f, 245000f, 1011000f, 1000f, 0f, 0f, 47000f, 20000f, 12000f, 124400f, 160000f)
   private val legendArr = arrayOf("05/21", "05/22", "05/23", "05/24", "05/25", "05/26", "05/27", "05/28", "05/29", "05/30", "05/31")

}

Goal : swipe chart line and show data chart tips Thanks for the [HzGrapher](https://github.com/handstudio/HzGrapher)

  • |
  1. ScreenShot.png (File Size:58.4KB/Download:6)
facebook twitter google plus pinterest kakao story band
사진 및 파일 첨부

여기에 파일을 끌어 놓거나 왼쪽의 버튼을 클릭하세요.

파일 용량 제한 : 0MB (허용 확장자 : *.*)

0개 첨부 됨 ( / )
번호 제목 글쓴이 날짜 조회 수
» Line Graph file 아빠뎁 21.02.07. 7
4 3d View file 아빠뎁 21.02.07. 6
3 HorizontalWheelView file 두둥 21.02.07. 4
2 Wheel Spinner 두둥 21.02.07. 3
1 Unicorn File Picker file 두둥 21.02.07. 5