MPAndroidChart Scatterchart中的ListView [英] MPAndroidChart Scatterchart in ListView

查看:448
本文介绍了MPAndroidChart Scatterchart中的ListView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 MPAndroidChart库

我有一个ListView多个scattercharts。
每个图表包含365 xvalues​​(一年中的每一天)。
所述yvalues​​变化从1至5。
图表的高度150dp。
我希望能够放大,这样我就可以看到每一天。
但是,当我放大的yvalues​​走出图表的范围。
有没有一种方法,以保持在图表的范围yvalues​​?
我下一个设置,试了一下:

I have multiple scattercharts in a ListView. Every chart contains 365 xvalues (every day of the year). The yvalues vary from 1 to 5. The height of the charts is 150dp. I would like to be able to zoom in, so I can see every single day. But when I zoom in, the yvalues get out of range of the chart. Is there a way to keep the yvalues within range of the chart? I tried it with the next settings:

 holder.chart.setTouchEnabled(true);
    holder.chart.setDragEnabled(true);
    holder.chart.setScaleEnabled(false);
    holder.chart.setScaleMinima(3f, 0f);
    holder.chart.centerViewPort(xIndex, 3);

但是,当我从左至右或从右到左拖,值刚刚从图表中消失,即使是在范围内的时候。

But when I drag from left to right or right to left, values just disappear from the chart, even when in range.

有没有人任何想法如何做到这一点?

Has anyone any idea how to accomplish this?

推荐答案

尝试centerViewPort后图表无效,为我工作。

Try to invalidate the chart after centerViewPort, worked for me.

holder.chart.invalidate();

holder.chart.invalidate();

这篇关于MPAndroidChart Scatterchart中的ListView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆