Question

i need to put Date on x axis of line graph. i've all elements stored as String inside database, and date string is formatted as

yyyy/MM/dd HH/mm/ss

Before plotting diagram, i need to convertthat String Date object. I've try in this way:

DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
for (int i = 0; i < list.size(); i++) {
series.add(dateFormat.parse(list.get(i)[2]), Double.valueOf(list.get(i)[0]));
}

but when on execution time, on Y axis the value it's correct, on x i don't have date, but some string like

1378817460000

and for example, a date string like

2013/09/10 14:51:01

on x axis is represented like

1.378817461E12

Where's the problem?

Était-ce utile?

La solution

It seems like you are creating and displaying a line chart instead of a time chart.

Autres conseils

Here is how you pass date format into ChartFactory:

    graphicalView = ChartFactory.getTimeChartView(
            getApplicationContext(), dataset, renderer,"HH:mm:ss");
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top