/ChartCore

Data visualization library 📊 for Android. Based on Chart.js javascript library which is currently the most popular library for web development. Extremely customizable, supports pie, doughnut, line, bar, radar, area, bubble, scatter and mixed types.

Primary LanguageKotlinApache License 2.0Apache-2.0

Android CI

ChartCore

Data visualization library 📊 for Android. Based on Chart.js javascript library which is currently the most popular library for web development. Extremely customizable, supports pie, doughnut, line, bar, radar, area, bubble, scatter and mixed types.


Features

  1. Support AndroidKotlin & Java.
  2. Supports pie, doughnut, line, bar, radar, area, bubble, scatter and mixed types of chart
  3. Interactive、animated, the animation effect is exquisite 、delicate、 smooth and beautiful.[Underdevelopment]
  4. Support chain programming syntax like system framework.

Installation

Gradle

Step 1. Add the JitPack repository to your build file

Add it in your root build.gradle at the end of repositories:

	allprojects {
		repositories {
			...
			maven { url 'https://www.jitpack.io' }
		}
	}

Step 2. Add the dependency

	dependencies {
		implementation 'com.github.ErenAlpaslan:ChartCore:1.0.0'
	}

Usage

  1. Create the instance object of chart view:ChartCoreView
    <com.github.chartcore.view.ChartCoreView
            android:id="@+id/chartCore"
            android:layout_width="300dp"
            android:layout_height="300dp" />
  1. Configure the properties of chart model:ChartCoreModel
  val data = mapOf(
            "2019" to 60.0,
            "2020" to 50.0,
            "2021" to 40.0,
            "2022" to 120.0,
            "2023" to 10.0
        )

  val coreData = ChartData()
      .addDataset(
          ChartNumberDataset()
              .data(data.values.toList())
              .label("Acquisitions by year")
              .offset(10)
      )
      .labels(data.keys.toList())

  val chartOptions = ChartOptions()
            .plugin(
                Plugin()
                    .subtitle(
                        Title()
                            .display(true)
                            .text("Subtitle example")
                            .position(Position.BOTTOM)
                    ).title(
                        Title()
                            .display(true)
                            .text("Title")
                            .position(Position.TOP)
                            .align(TextAlign.CENTER)
                            .color("red")
                    )
                    .tooltip(
                        Tooltip(false)
                    )
            )
            .elements(
                Elements()
                    .line(
                        Line()
                            .tension(0.5f)
                    )
            )

  val chartModel = ChartCoreModel()
            .type(ChartTypes.LINE)
            .data(coreData)
            .options(chartOptions)
  1. And you need to set core model to view:
   binding.chartCore.draw(chartModel)
  1. 🚀 And thats it.

image

LICENSE

image

ChartCore is available under the Apache license. See the LICENSE file for more information.