Menu

#228 GridArrangement null pointer exception fix and item layout

open
None
5
2008-12-03
2008-12-01
Joubie
No

Hi,

hit a null-pointer exception in the GridArrangement where the block list could be over-run. Fixed this and added a constructor to horizontally align the individual items as desired. The vertical alignment centres the labels, as the CenterArrangement for the blocks does not deal with a fixed width and no height constraint yet. This can easily be fixed if CenterArrangement is updated.

Would be great if this could be included in the next release.

Included is a diff against 1.0.11.

Cheers,

Adriaan

Discussion

  • Joubie

    Joubie - 2008-12-01

    Diff for GridArrangement.java (1.0.11)

     
  • David Gilbert

    David Gilbert - 2008-12-03

    Thanks for the report. I fixed the NPE and the array overrun, but I didn't add the extra layout step yet as I'd like to get a better understanding of what it is used for. It goes a little way past my original intention for the grid layout...but maybe the extra functionality is good to add, do you have any demo code I could look at.

    Best regards,

    Dave Gilbert
    JFreeChart Project Leader

     
  • David Gilbert

    David Gilbert - 2008-12-03
    • assigned_to: nobody --> mungady
     
  • Joubie

    Joubie - 2008-12-03

    Hi,

    we have a large code base, so tricky to pull something out quickly. Where I'm using it is in building legends where I create a single legend for multiple charts (I use this mainly for pdf output). I give meaning to some of the shapes on the lines, so that I need additional items in the legend. As the legend is quite large, I want to lay it out in columns, with the legend items aligned on the left. So that is what I needed the alignment in the GridArrangement for.

    I then hit additional problems in that I wanted the names to appear alphabetically down the columns rather than across the rows, so I implemented a custom version that does that.

    I realised that there are also issues with dealing with long labels, but that is rather more involved to fix.

    Sorry about the short explanation (we are a bit pressed at the moment). If you need more let me know and I'll try to come up with something next week.

    Cheers,

    Adriaan

     

Log in to post a comment.