MPAndroidChart不会动画

时间:2018-05-08 13:16:34

标签: android mpandroidchart

我想制作条形图,线图和其他动画,但它不会动画.. 我已尝试在MPAndroidChart中使用所有动画功能(barChart.animateXY(3000,3000);)..请帮助...谢谢

ArrayList<String> labels = new ArrayList<>();
    labels.add("2016");
    labels.add("2015");
    labels.add("2014");
    labels.add("2013");
    labels.add("2012");

    // create BarEntry forBar Group 1
ArrayList<BarEntry> bargroup1 = new ArrayList<>();
bargroup1.add(new BarEntry(0, new float[]{8f, 5f}));
bargroup1.add(new BarEntry(1, new float[]{33f, 15f}));
bargroup1.add(new BarEntry(2, new float[]{45f, 28f}));
bargroup1.add(new BarEntry(3, new float[]{20f, 6f}));
bargroup1.add(new BarEntry(4, new float[]{15f, 9f}));
bargroup1.add(new BarEntry(19f, 5));

ArrayList<BarEntry> bargroup2 = new ArrayList<>();
bargroup2.add(new BarEntry(10f, 0));
bargroup2.add(new BarEntry(6f, 1));
bargroup2.add(new BarEntry(10f, 2));
bargroup2.add(new BarEntry(26f, 3));
bargroup2.add(new BarEntry(18f, 4));

BarDataSet bardataset = new BarDataSet(bargroup1, "Bar Chart 1");
bardataset.setColors(ColorTemplate.COLORFUL_COLORS);

BarDataSet barDataSet2 = new BarDataSet(bargroup2, "Bar Chart 2");

ArrayList<IBarDataSet> datas = new ArrayList<>();
datas.add(bardataset);
datas.add(barDataSet2);

BarData data = new BarData(datas);
barChart.setData(data);
barChart.animateXY(3000, 3000);

1 个答案:

答案 0 :(得分:0)

我发现错误..它的操作系统版本问题..我试试kitkat(不是动画)&amp;棉花糖(动画......工作正常)..