问题
//map: {2-6-2016=[120.0], 27-5-2016=[100.0], 1-6-2016=[78.0, 59.0]}
LineChart lineChart = (LineChart) findViewById(R.id.chart);
ArrayList<Entry> graphYValues = new ArrayList<>();
ArrayList<String> xLabels = new ArrayList<String>();
for (Map.Entry<String, List<Float>> mapKeySet : map.entrySet()) {
List<Float> lsValue = mapKeySet.getValue();
for (float v : lsValue) {
graphYValues.add(new Entry(v, i));//value ,index
xLabels.add(mapKeySet.getKey());//if same label -x-axis have multiple y-axis value on same x-label axis
}
i++;
}
LineDataSet dataset = new LineDataSet(graphYValues,"Graph for "+spTestSubElement.getSelectedItem().toString());
LineData data = new LineData(xLabels,dataset);
lineChart.setData(data);
It created duplicate entry for x-axis label.How can plot graph for multiple y values on same x-axis point ?How to solve this issue.
来源:https://stackoverflow.com/questions/37656960/duplicate-x-axis-value-in-mpandroidchart-library