在CombinedChart中水平滚动

时间:2016-01-22 12:21:14

标签: android mpandroidchart

我在我的项目中使用MPAndroidChart库。 CombinedChart将填充用户提供的数据,因此对于增长过多非常敏感并且使图表的可视化不那么友好。

所以我想设置要显示的条目的初始最大值,然后让用户能够水平滚动以查看更多条目。

我在MPAndroidChart例子中看到,在捏缩放后,用户可以在任何地方滚动,所以我按下这个强大的库可以满足我的需求

1 个答案:

答案 0 :(得分:2)

嗯,这不是我想到的,但这些设置可以解决问题:

    CombinedChart mChart;
    mChart = (CombinedChart) findViewById(R.id.mchart);

    mChart.setScaleMinima(100f, 1f); // The total number of entries will be divided by these factors     
mChart.centerViewTo(lastXvalue, lastYValue, YAxis.AxisDependency.RIGHT); //This centers the view on the last value