MPAndroidChart 2 折线图
MPAndroidChart 2 linecharts
我正在尝试使用 2 个 MPAndroidChart 折线图创建 android activity,但是这 2 个折线图中的条目可能并不完全相似。我正在创建并填充 2 个数据集
LineDataSet one = null;
LineDataSet two = null;
ArrayList<Entry> oneList = new ArrayList<>();
ArrayList<Entry> twoList = new ArrayList<>();
//here I add entries to arraylists, the sizes may not be the same
List<ILineDataSet> dataSets = new ArrayList<>();
dataSets.add(one);
dataSets.add(two);
ArrayList<String> labelsIdeal = new ArrayList<>();
//here I add all the labels for both line charts
我想要的结果:
我得到的结果:
标签没有与条目配对,我找不到解决办法,怎么办。请帮忙!!!
我发现我做错了什么。当我们添加条目时,第二个参数是xIndex,它与图表上的标签相关联,所以在形成所有标签的列表后,需要更新条目的xIndexes,这样图表才会正确
我正在尝试使用 2 个 MPAndroidChart 折线图创建 android activity,但是这 2 个折线图中的条目可能并不完全相似。我正在创建并填充 2 个数据集
LineDataSet one = null;
LineDataSet two = null;
ArrayList<Entry> oneList = new ArrayList<>();
ArrayList<Entry> twoList = new ArrayList<>();
//here I add entries to arraylists, the sizes may not be the same
List<ILineDataSet> dataSets = new ArrayList<>();
dataSets.add(one);
dataSets.add(two);
ArrayList<String> labelsIdeal = new ArrayList<>();
//here I add all the labels for both line charts
我想要的结果:
我得到的结果:
标签没有与条目配对,我找不到解决办法,怎么办。请帮忙!!!
我发现我做错了什么。当我们添加条目时,第二个参数是xIndex,它与图表上的标签相关联,所以在形成所有标签的列表后,需要更新条目的xIndexes,这样图表才会正确