ChartView Android

This is library which provides Chart View for android. Show your statistics in a simple way.

Preview

Usage

Usage is shown in app/src/main/java/pl/kuben/chart/MainActivity

To use it simply add PeriodicChartView to your xml. Available attributes:

  • valueText: String

     – identifier at the top of chart – default „val.”

  • dateText: String

     – identifier for date – default „date”

  • showText: Boolean

     – defines if text should be shown, mostly used when chart is small – default „true”

  • progressColor: @IntColor Int

     – defines value line color – default „blue”

  • chartPadding: Int

     – defines padding of drawed chart – default „10px”

  • dateInterval: Enum

     – defines how entries should be grouped – available „day”, „week”, „month” – default „day”

To add values you need to insert list of 

Entry

 which has two field: 

count: Int

 – the value which it contains 

date: Long

 – timestamp of adding it Inserting values:

chart.entries = listOf(
Entry(2, System.currentTimeMillis()),
Entry(4, System.currentTimeMillis() + 1000 * 60 * 60 * 24),
Entry(5, System.currentTimeMillis() + 1000 * 60 * 60 * 24 * 2),
Entry(1, System.currentTimeMillis() + 1000 * 60 * 60 * 24 * 3)
)

Installation

In your root build.gradle file add repository:

 maven { url 'https://jitpack.io' }

To your app module add dependency:

implementation 'com.github.JakubNeukirch:ChartView:0.5.0'