Menu

#316 New annotation classes as marker replacements

open
nobody
None
5
2017-02-09
2015-01-26
Peter Kolb
No

The zip file contains some new annotation classes that behave like markers. There are several reasons to substitute markers;

  • There is little type checking regarding markers. A CategoryMarker can be added to an XYPlot or a range marker to a CategoryPlot, which doesn´t make sense and should be prohibited.
  • Markers have no own draw methode and are drawn by the renderer. If one wants to have a different way to e. g. represent how a ValueMarker is drawn (e. g. as circle or rectangle directly on the axis), this wowuld only be possible by subclassing the renderer.
  • There is some code duplication.
  • There is noe entity support for markers, and it probably can not be introduced breaking some interfaces.
    The uploaded represent a first set of annotations to replace markers. They just need to be placed in the appropriate place in the source tree and the package recompiled.
1 Attachments

Discussion

  • David Gilbert

    David Gilbert - 2015-01-27

    Thanks Peter. I think the original reason that the marker drawing was handled by the plot was because of the need to handle the "pseudo 3D" plots (here the markers need to take account of the fake sides of the 3D plot). It's not very clean and your annotation approach makes sense. I'll get this stuff reviewed and committed as soon as possible.

     
  • Peter Kolb

    Peter Kolb - 2015-01-27

    Hi David, thanks for the response. I just noted that some classes are missing from the ZIP file. I´ll upload them later today.

     
  • Peter Kolb

    Peter Kolb - 2015-01-27

    New zip file containing the missing classes.

     
  • Scott

    Scott - 2016-04-29

    How do we apply these patches? Is there a .jar file?

     
  • Peter Kolb

    Peter Kolb - 2017-01-28

    The patch does not need to be applied in the usual way, as none of existing JFreeChart classes are affected. Simply download the classes and add them to your project.
    Attached is a new version of the base class AxisAnnotation that is using a TextBlock instead of a simple String as label and thus supports multi line labels.
    Source is still a bit messy.

     
  • Scott

    Scott - 2017-02-07

    Ok Peter I'll try it, thank you!
    BTW: Will this allow me to have labels on the axis?
    For example: I want to have crosshair labels out on the right and bottom axis, outside the plot.

     
  • Peter Kolb

    Peter Kolb - 2017-02-08

    @Scott: What you want is not supported out of the box. But you could create a new class that extends extends ValueAnnotation and implements XYAnnotation and has an additional field to store a shape. In the overriden draw-method, you could then call getLine(dataArea, axisEdge, value), call getX1 and getY1on the returned LIne2D instance, and draw a shape at this position. I do not expect the draw method to be longer than 20 lines.
    Edit: in order to place the shape on the axis line, and not on the plot border, you will also have to take the axis offset of the plot into account.

     

    Last edit: Peter Kolb 2017-02-08
  • Scott

    Scott - 2017-02-09

    Ok thank you Peter. I will try it (someday).

     

Log in to post a comment.

MongoDB Logo MongoDB