icechao/KlineChart

K 线显示问题

Closed this issue · 6 comments

当看历史数据时,后台刷新K线数据,K线视图会自动滑动的最新的数据,有没有属性可以设置不允许自动滑动

7 . 使用KLineChartAdapter设置数据 Using klinechartadapter to set up data

 如果没有将数据适配器保存可以通过ChartView的getAdapter方法获取  If the data adapter is not saved, it can be obtained through the getadapter method of chartview
 chartView.getAdapter()

 填充或重新填充数据,bool表示是否重置展示位   Fill or repopulate the data. Bool indicates whether to reset the display bit
 resetData(List<KlineEntry>,boolean);

 尾部追加数据  Append data at the end
 addLast(KlineEntry);

 修改某个数据   Modify a data
 changeItem(KlineEntry);

 如果有需要在前面追加多个数据可以继承KLineChartAdapter自定义方法参考addLast方法   If you need to append more than one data, you can inherit the klinechartadapter custom method reference addlast method
 添加完数据后需要手动隐藏loading   After adding data, you need to hide loading manually
 
 chartView.hideLoading();

我就是在你demo的基础上仅仅把数据换成动态的,更新数据使用的是 adapter.resetData(response);就出现看历史数据K线时,只要后台数据更新,页面会自动滑动到最新的数据

adapter.resetData(response,false);
使用这个方法 重置K线数据

adapter.resetData(response,false);
使用这个方法 重置K线数据

adapter.resetData(response,false),不起效。使用后,看历史数据只要后台刷新 页面又会自动滑动到最新的数据

adapter.resetData(response,false);
使用这个方法 重置K线数据

adapter.resetData(response,false),不起效。使用后,看历史数据只要后台刷新 页面又会自动滑动到最新的数据

ok我测试下 看看新版本是不是改出了bug

7 . 使用KLineChartAdapter设置数据 Using klinechartadapter to set up data

 如果没有将数据适配器保存可以通过ChartView的getAdapter方法获取  If the data adapter is not saved, it can be obtained through the getadapter method of chartview
 chartView.getAdapter()

 填充或重新填充数据,bool表示是否重置展示位   Fill or repopulate the data. Bool indicates whether to reset the display bit
 resetData(List<KlineEntry>,boolean);

 尾部追加数据  Append data at the end
 addLast(KlineEntry);

 修改某个数据   Modify a data
 changeItem(KlineEntry);

 如果有需要在前面追加多个数据可以继承KLineChartAdapter自定义方法参考addLast方法   If you need to append more than one data, you can inherit the klinechartadapter custom method reference addlast method
 添加完数据后需要手动隐藏loading   After adding data, you need to hide loading manually
 
 chartView.hideLoading();
   @Override
    public void onInvalidated() {
        tempTranslation = canvasTranslateX;
        isAnimationLast = false;
        overScroller.forceFinished(true);
        setScaleEnable(false);

// resetValues();
}
如果你是源码依赖就注释掉我注释这行 , 如果你是maven依赖 我更新下个版本会修复