I’m trying to add data (floats specifically) to a bar chart I’m creating with achartengine. I’ve created a HashMap to hold keys/values but I’m not able to access the actual value of the Integer (i.e., Integer.valueOf). See below:
private XYMultipleSeriesDataset getBarDemoDataset() {
XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
HashMap<String, Integer> myMap = AppStatus.mDayMap;
Iterator it = myMap.entrySet().iterator();
for (int i = 0; i < 1; i++) {
CategorySeries series = new CategorySeries("Demo series " + (i + 1));
while(it.hasNext()){
Map.Entry pairs = (Map.Entry)it.next();
// I should be able to code pairs.getValue().valueOf() but I get an error - the value seems to be a string below.
series.add((Double)pairs.getValue());
}
dataset.addSeries(series.toXYSeries());
}
return dataset;
}
So:
Although I would have thought that a series chart should be ordered, which would not be the case when iterating over a
HashMap.