Last active
February 21, 2023 17:54
-
-
Save ArsenyMalkov/4f13aca9bdde09abd6547b2fde5bede6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AnyChartView anyChartView = findViewById(R.id.any_chart_view); | |
final Pie pie = AnyChart.pie(); | |
List<DataEntry> data = new ArrayList<>(); | |
data.add(new ValueDataEntry("Apples", 6371664)); | |
data.add(new ValueDataEntry("Pears", 789622)); | |
data.add(new ValueDataEntry("Bananas", 7216301)); | |
data.add(new ValueDataEntry("Grapes", 1486621)); | |
data.add(new ValueDataEntry("Oranges", 1200000)); | |
pie.data(data); | |
anyChartView.setChart(pie); | |
final int delayMillis = 500; | |
final Handler handler = new Handler(); | |
final Runnable runnable = new Runnable() { | |
public void run() { | |
List<DataEntry> data = new ArrayList<>(); | |
data.add(new ValueDataEntry("Apples", new Random().nextDouble() * 140d)); | |
data.add(new ValueDataEntry("Pears", new Random().nextDouble() * 140d)); | |
pie.data(data); | |
handler.postDelayed(this, delayMillis); | |
} | |
}; | |
handler.postDelayed(runnable, delayMillis); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The changes are not applied in the app ?? the data is different but the resultant pie chart is the same. Please Help!
`package com.example.piechart;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import com.anychart.AnyChart;
import com.anychart.AnyChartView;
import com.anychart.chart.common.dataentry.DataEntry;
import com.anychart.chart.common.listener.Event;
import com.anychart.chart.common.listener.ListenersInterface;
import com.anychart.charts.Pie;
import com.anychart.enums.Align;
import com.anychart.enums.LegendLayout;
import java.util.ArrayList;
import java.util.List;
public class MainActivity extends AppCompatActivity {
}
`