Menu

#238 New ChartEntities: clickable Axes and Titles

closed-accepted
None
5
2009-03-19
2009-02-15
Peter Kolb
No

I needed a way to make Axes and TextTitles "clickable" in a GUI, i.e. when the user clicks on the area occupied by an area or title, it should be possible to get a reference to the object and open a dialog for editing purposes.
The most obvious way was to create entities and have them added to the EntityCollection included in the ChartRenderingInfo of the ChartPanel.
While an entity is already created for TextTitles, it is an instance of ChartEntity, i.e. it is not possible to get a reference to the TextTitle that occupies the area of the entity. Entity support for Axes was completely missing.
The patch includes sthe following:
- two new classes AxisEntity and TitleEntity which simply extend ChartEntity and hold a reference to an Axis or a Title.
- Change to TextTitle.draw(Graphics2D,Rectangle2D, Object): creates a TitleEntity instead of a ChartEntity
- Changes to Axis: new method protected void createAndAddEntity(double cursor, AxisState state, Rectangle2D dataArea, RectangleEdge edge, PlotRenderingInfo plotState): gets an EntityCollection from the owner of the plotState and adds an AxisEntity with a rectangular hotspot.
- Changes to NumberAxis, DateAxis, LogAxis, CategoryAxis: call Axis.createAndAddEntity(...) in their draw-methods.

Discussion

  • Peter Kolb

    Peter Kolb - 2009-02-15

    diff file against 1.0.12

     
  • Peter Kolb

    Peter Kolb - 2009-02-21

    Extended DIff

     
  • Peter Kolb

    Peter Kolb - 2009-02-21

    Extended vesion:
    new classes: JFreeChartEntity, PlotEntity
    one instance of each class will be added to the EntityCollection. The contain references to the chart/plot and use clones of the chart area and data area, respectively.
    Change to LegendTitle: a TitleEntity is created that uses the original area. The TitleEntity is created before the LegendItemEntities. Thus, the LegendItemEntities will cover most of the space of the TitleEntity, but clicking at the edges of the LegendTitle should give the TitleEntity back.
    File Added: AxisAndTitleEntities.diff

     
  • David Gilbert

    David Gilbert - 2009-03-19

    Nice work. I've committed your changes to Subversion for inclusion in the 1.0.13 release.

    Best regards,

    Dave Gilbert
    JFreeChart Project Leader

     
  • David Gilbert

    David Gilbert - 2009-03-19
    • assigned_to: nobody --> mungady
    • status: open --> closed-accepted
     

Log in to post a comment.