gorteganesh / achartengine

Automatically exported from code.google.com/p/achartengine
0 stars 0 forks source link

Bug in TimeChart with conversion long -> double -> long #7

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Bug is in conversion long -> double -> long. The first one is in 
TimeSeries.add(), the second one stays in TimeChart.drawXLabels().
Because of trimming of numbers sometimes it is impossible to restore Date 
class to draw labels.

Original issue reported on code.google.com by el.vo...@gmail.com on 1 Jun 2010 at 8:16

GoogleCodeExporter commented 9 years ago
Can you please provide a code snippet such as we can replicate this?

Thanks,

Dan

Original comment by dandrome...@gmail.com on 21 Jun 2010 at 6:23

GoogleCodeExporter commented 9 years ago
If this is the same issue as the one I am having, then this means the following 
method:

org.achartengine.chart.XYChart.getLabel(double)

uses the double value to draw the label. But for a TimeSeries, you want to draw 
a java.util.Date label, not a double label. The mismatch between a double and a 
long in the method:

org.achartengine.model.TimeSeries.add(Date, double)

means that you may lose some precision when trying to convert the double back 
to a Date in the previously metioned 
"org.achartengine.chart.XYChart.getLabel(double)" method. You do this to 
convert the double back to a Date, as you want to display a Date label.

Is there any other way of registering a "LabelProvider" that the chart 
delegates to when creating appropriate labels for the chart? Something like:

interface LabelProvider {
  String getLabel(Series series, int index);
}

Original comment by PaulGr...@gmail.com on 25 Jul 2010 at 9:10

GoogleCodeExporter commented 9 years ago
Please provide some code snippet that will help me replicate the problem.
Currently, I cannot replicate this and I also don't imagine why there could be 
loss of data while converting between long and double.

Original comment by dandrome...@gmail.com on 16 Nov 2010 at 5:31

GoogleCodeExporter commented 9 years ago

Original comment by dandrome...@gmail.com on 3 Jan 2011 at 2:13