Я рисую круги или другие элементы на графике XY с возможностью аннотаций.Чтобы добавить круг, используйте, например, «addAnnotation (XYShapeAnnotation (new Ellipse2D.Double (...))))».Вот пример метода:
public void markChartAt2( float fromX, float fromY, float toX, float toY, markType markerTyp, Color lineColor, String toolTip ) {
XYLineAnnotation lineAnnotation;
XYShapeAnnotation shapeAnnotation;
if (lineColor == null)
lineColor = Color.black;
maxY = yAxis.getUpperBound();
minY = yAxis.getLowerBound();
yFactor = (maxY - minY) * .005d;
maxX = xAxis.getUpperBound();
minX = xAxis.getLowerBound();
xFactor = (maxX - minX) * .0005d;
switch ( markerTyp ){
case CIRCLE:
shapeAnnotation = new XYShapeAnnotation(
new Ellipse2D.Double( fromX - xFactor, fromY - yFactor, xFactor+xFactor, yFactor+yFactor ),
markerLineWidth, lineColor ) ;
shapeAnnotation.setToolTipText( toolTip );
priceXYPlot.addAnnotation(shapeAnnotation);
break;
case SQUARE:
shapeAnnotation = new XYShapeAnnotation(
new Rectangle2D.Double( fromX - xFactor, fromY - yFactor, xFactor+xFactor, yFactor+yFactor ),
markerLineWidth, lineColor );
shapeAnnotation.setToolTipText( toolTip );
priceXYPlot.addAnnotation( shapeAnnotation );
break;
}
}