Twitter Twitter Android Arsenal ![Release](https://img.shields.io/github/release/PhilJay/MPAndroidChart-Realm.svg?label=maven central) API

alt tag

This repository contains all Realm.io related features of the MPAndroidChart library based on Realm v2.0.2 release.

Getting Started

  • To use this library, add the following to your project level build.gradle:
allprojects {
    repositories {
        maven { url "https://jitpack.io" }
    }
}
  • Add this to your app build.gradle:
dependencies {
    compile 'com.github.PhilJay:MPAndroidChart-Realm:v2.0.2@aar'
    compile 'com.github.PhilJay:MPAndroidChart:v3.0.0'
}

The MPAndroidChart-Realm dependency does not include the latest MPAndroidChart release, so you have to add the dependency to MPAndroidChart as well (as shown above). You also have to add the Realm.io dependency.

Sample

Using MPAndroidChart with Realm.io is easier than you think.

// get realm instance
Realm realm = Realm.getDefaultInstance();

// load your data from Realm.io database
RealmResults<YourData> results = realm.where(YourData.class).findAll();

// create a DataSet and specify fields, MPAndroidChart-Realm does the rest
RealmBarDataSet<YourData> dataSet = new RealmBarDataSet<YourData>(results, "xValue", "yValue");

// create a data object with the dataset 
BarData data = new BarData(dataSet);
chart.setData(data);
chart.invalidate(); // refresh

Tutorial

Here, you can find a full guide on how to plot data from Realm.io database with MPAndroidChart from scratch.



推 推 机器人阿森纳 ![发布](https://img.shields.io/github/release/PhilJay/MPAndroidChart-Realm.svg?label=行家中央) APIdata-canonical-src < / a>

alt标签data-canonical-src

此存储库包含的所有 Realm.io 相关功能基于 Realm v2.0.2 版本的MPAndroidChart 库。

Getting Started

  • 要使用此库,请将以下内容添加到项目级别 build.gradle
allprojects {
    repositories {
        maven { url "https://jitpack.io" }
    }
}
  • 将其添加到您的应用程序中, build.gradle
dependencies {
    compile 'com.github.PhilJay:MPAndroidChart-Realm:v2.0.2@aar'
    compile 'com.github.PhilJay:MPAndroidChart:v3.0.0'
}
MPAndroidChart-Realm依赖关系不包括最新的MPAndroidChart版本的,因此您必须将依赖关系添加到 MPAndroidChart (如上所示)。您还必须添加 Realm.io依赖关系

Sample

Realm.io 使用 MPAndroidChart 与比你想象的容易一些。

// get realm instance
Realm realm = Realm.getDefaultInstance();

// load your data from Realm.io database RealmResults<YourData> results = realm.where(YourData.class).findAll();

// create a DataSet and specify fields, MPAndroidChart-Realm does the rest RealmBarDataSet<YourData> dataSet = new RealmBarDataSet<YourData>(results, "xValue", "yValue");

// create a data object with the dataset BarData data = new BarData(dataSet); chart.setData(data); chart.invalidate(); // refresh

Tutorial

此处,您可以找到如何绘制数据的完整指南从具有MPAndroidChart的Realm.io数据库开始。




相关问题推荐