MPAndroidChart,Y轴比例得到更新,但线未更新 [英] MPAndroidChart, Y-Axis Scale gets updated but lines are not
问题描述
我正在使用 MPAndroidChart .我有以下活动- StockDetail.Java
I am using MPAndroidChart. I have the following Activity - StockDetail.Java
公共类StockDetail扩展了AppCompatActivity { ArrayList historyData = null;
public class StockDetail extends AppCompatActivity{ ArrayList historicalData=null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SharedPreferences prefs=getApplicationContext().getSharedPreferences("arrayList",Context.MODE_PRIVATE);
try {
historicalData = (ArrayList<HistoricalData>) ObjectSerializer.deserialize(prefs.getString(
Utils.ARRAY_LIST, ObjectSerializer.serialize(new ArrayList<HistoricalData>())));
} catch (IOException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
setContentView(R.layout.stock_detail);
LineChart lineChart=(LineChart) findViewById(R.id.lineChart);
List<Entry> datas=new ArrayList<>();
ArrayList<Float> floats=getDateInFloatValues(historicalData);
HistoricalData hData;
for (int i=0; i<historicalData.size(); i++) {
hData=historicalData.get(i);
datas.add(new Entry(floats.get(i),Float.parseFloat(hData.getHigh())));
}
LineDataSet lineDataSet=new LineDataSet(datas,"LineData");
lineDataSet.setColor(R.color.material_red_700);
LineData lineData=new LineData(lineDataSet);
lineChart.setData(lineData);
lineChart.invalidate();
}
}
Y轴比例尺已更新,但没有行,这是屏幕截图:
The Y-Axis scale gets updated but there are no lines and Here is the screenshot:
我的代码似乎有问题,请告诉我
It seems like there is some problem with my code, Please let me know
推荐答案
我已解决问题,我使用的是Beta版的MPAndroidChart,然后将应用程序级别build.gradle更改为
I fixed the problem, i was using beta version of MPAndroidChart then i changed the app level build.gradle to
编译'com.github.PhilJay:MPAndroidChart:v2.2.5'
compile 'com.github.PhilJay:MPAndroidChart:v2.2.5'
现在一切正常
这篇关于MPAndroidChart,Y轴比例得到更新,但线未更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!