#933 SegmentedTimeline (1.0.13) freezes application

1.0.x
open
David Gilbert
General (896)
9
2010-04-27
2009-05-21
Jocafi Brazil
No

JFreechart version 1.0.13 has problems using the class org.jfree.chart.axis.SegmentedTimeline when a chart uses a period over one year
(more than 250 records, for example).

The application freezes in this version, while using jfreechart-1.0.11 or earlier it does not freeze. Using few records it does not freeze at all.

I changed the example class "CandlestickChartDemo1" to reproduce the error. See the ZIP file in attachment.

Change the lines of the method createDemoPanel() to force or not the bug.

Thanks in advance !

Best regards,
Jocafi Brazil

Discussion

  • Jocafi Brazil
    Jocafi Brazil
    2009-05-21

    Bug using SegmentedTimeline

     
    Attachments
  • Avalon
    Avalon
    2009-06-05

    Similar problem - I don't need 250 records of data but have the problem of frozen application (endless loop) when horizontally resizing. Workaround was to comment

    tickDate = correctTickDateForPosition(tickDate, unit,
    this.tickMarkPosition);

    in DateAxis::refreshTicksHorizontal

    The 'while' keeps jumping back and forward between two dates.

     
  • Jocafi Brazil
    Jocafi Brazil
    2010-04-27

    More than one year has passed and nothing has been done to fix this bug. It is still there.

    I LOST A LOT OF TIME creating the source code in attachment in order somebody could reproduce and fix the error quickly.

    Please, fix the version 1.0.13.

    I could also notice that SegmentedTimeline.newFifteenMinuteTimeline() DOES NOT work. It plots the weekend on the chart and this is wrong (version 1.0.11)

     
  • Jocafi Brazil
    Jocafi Brazil
    2010-04-27

    • priority: 5 --> 9
    • assigned_to: nobody --> mungady
     
  • Martin Höller
    Martin Höller
    2010-05-04

    Hi!

    Just had a quick look at your demo. I can reproduce the bug, when using the line with createDataSetIBM() for dataset creation. It seems the bug is triggering with 63 or more records in the dataset. 62 records works fine for me.

    The freezing seems to occur in DateAxis.refreshTicksHorizontal(). There is a loop with the following code:
    while (tickDate.before(upperDate)) {
    // could add a flag to make the following correction optional...
    tickDate = correctTickDateForPosition(tickDate, unit,
    this.tickMarkPosition);
    [...]

    At some point, each iteration in the loop leads to the same tickDate, which results in an endless loop. I don't know what correctTickDateForPosition() does or what the intention of the comment just above is. Probably David should have a look at it.

    I'm not going to do any more debugging at this point, sorry.

    hth anyway,
    - martin

     
  • Juan Vallejos
    Juan Vallejos
    2010-05-26

    I modify "correctTickDateForPosition". Adding at the end of this method

    if(time.after(result))
    return time;
    return result;

    this mean, it's only allowed to roll the date forward.

     
  • walkeros
    walkeros
    2010-06-10

    The number of data does not have direct impact on this error. The problem occures evactly when the charts decides to display the data on x axis in months instead of days.

    Witout patching the source code there are few things that you might do to avoid the instant loop:

    1) allow only days on x axis:

    DateAxis dateaxis = (DateAxis)xyplot.getDomainAxis();
    dateaxis.setTickUnit(new DateTickUnit(DateTickUnitType.DAY, 1));

    However for big number of data this is not good solution, but you may try it so that you see that this is really a problem.

    2) enforce date caluculation basing on end of the period:

    DateAxis dateaxis = (DateAxis)xyplot.getDomainAxis();
    dateaxis.setTickMarkPosition(DateTickMarkPosition.END);

    This should work and seems fine solution unless you need to display the Date including hours (since this will probably try do display the last milisecond of the period)

    Warning: For me this solution works fine, however this does not really fix the problem (as the solution number 1 does) It just minimises a lot the possibility that DateAxis.correctTickDateForPosition() will constantly roll the date to the same time.

    BTW: I seems to understand the problem and the correct solution for this. So maybe please contact me in case you feel you really need the solution and if I recive few request , I'll try to patch the code and commit it (unless of course other folks want to commit their solutions first ;))