我正在使用JFreeChart制作折线图。我想用不同大小的圆圈标记或注释一些点。我尝试了ShapeAnnotation,但即使在我添加注释之后,它也不可见。不过,我能够制作指针注释。 这是相关的代码:
XYShapeAnnotation annotation = new XYShapeAnnotation(new Ellipse2D.Float(100.0f, 100.0f, 100.0f, 100.0f), new BasicStroke(1.0f), Color.blue);
XYPointerAnnotation pointer = new XYPointerAnnotation("arrow", 0.5,0.5,0.0);
xyDataset.addSeries(series1); //
xyDataset.addSeries(series2); // random lists of numbers
xyDataset.addSeries(series3); //
JFreeChart chart = ChartFactory.createXYLineChart ("XYLine Chart using JFreeChart","Age","Weight",xyDataset,PlotOrientation.VERTICAL,true,true,false);
chart.getXYPlot().addAnnotation(pointer);
chart.getXYPlot().addAnnotation(annotation);
我认为我应该有更多的代码来使椭圆注释可见,因为我从未像指针那样指定坐标。我浏览了JFreeChart API但找不到它。帮助