package com.example.asus.pillreminder;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Toast;
import com.github.mikephil.charting.charts.BarChart;
import com.github.mikephil.charting.data.BarData;
import com.github.mikephil.charting.data.BarDataSet;
import com.github.mikephil.charting.data.BarEntry;
import com.github.mikephil.charting.interfaces.datasets.IBarDataSet;
import java.util.ArrayList;
public class Chart extends AppCompatActivity {
private BarChart barChart;
ArrayList Pill ;
ArrayList date;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_chart);
Bundle b = getIntent().getExtras();
if (b == null) {
Toast.makeText(getApplicationContext(), “No data”, Toast.LENGTH_SHORT).show();
} else {
Pill = b.getParcelableArrayList(“Pill”);
date= b.getStringArrayList(“date”);
barChart = (BarChart) findViewById(R.id.barchart);
BarDataSet bardataset = new BarDataSet(Pill, “Dates”);
BarData data = new BarData(date, bardataset);
barChart.setData(data);
barChart.setDescription(“Pill Info”);
bardataset.setColors(new int[]{R.color.colorAccent});
barChart.animateY(5000);
}
}
}