【发布时间】:2011-08-04 17:31:40
【问题描述】:
我正在使用 JFreeChart 制作折线图。我想用不同大小的圆圈标记或注释一些点。我尝试了ShapeAnnotation,但即使在我添加Annotation 之后,它也不可见。不过,我能够进行指针注释。 以下是相关代码:
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 并找不到它。帮忙?
【问题讨论】:
标签: annotations jfreechart shape