Drawing annotation shapes without graph scaling

后端 未结 2 1069
予麋鹿
予麋鹿 2021-01-24 17:31

I\'m creating graphs using JFreeChart:

\"enter

The problem should be fairly clear.

相关标签:
2条回答
  • 2021-01-24 17:56

    I suggest using a second series with only one single value in it. For this second series you need to enable the drawing of shapes using the setSeriesShapesVisible() method of the plot renderer of the chart. All you need to do is adding one value to this second series in the point you want the shape to appear.

    You can use squares, circles, rounded rectangle and some more. In fact any java.awt.Shape object is valid.

    0 讨论(0)
  • 2021-01-24 18:09

    As an alternative, try one of the scale-invariant annotations such as XYImageAnnotation or XYPointerAnnotation. For example,

    chart.getXYPlot().addAnnotation(
            new XYPointerAnnotation("Bam!", pointX, pointY, 0));
    
    0 讨论(0)
提交回复
热议问题