0
내 차트에 폴리곤 주석을 만들고 그려진 폴리곤 외부의 색으로 차트를 채우는 방법을 알고 싶습니다. Jfreechart 1.0.17을 사용하고 있습니다.JFreechart 폴리곤 외부의 색 채우기
Color plotBackground = (Color) plot.getBackgroundPaint();
plot.setBackgroundPaint(new Color(0xff0000));
XYLineAndShapeRenderer renderer
= (XYLineAndShapeRenderer) plot.getRenderer();
XYPolygonAnnotation a = new XYPolygonAnnotation(new double[] {2.0,
5.0, 2.5, 8.0, 3.0, 5.0, 2.5, 2.0}, null, null,
new Color(plotBackground.getRed(), plotBackground.getGreen(),
plotBackground.getBlue(), 255));
을하지만 내가, 우리가 눈금 선이 방법으로 볼 수 원하는 정말되지 않습니다 :
나는이 순간에이 방법을 수행. 눈금 선을 그린 후 주석이 항상 그려 jfreecharts 소스 코드에 보면
Rectangle2D r2d = new Rectangle2D.Double(plot.getQuadrantOrigin().getX(),
plot.getQuadrantOrigin().getY(),
3.2, 9);
Area a1 = new Area(r2d);
Path2D.Float p = new Path2D.Float();
p.moveTo(2.0, 5.0);
p.lineTo(2.5, 8.0);
p.lineTo(3.0, 5.0);
p.lineTo(2.5, 2.0);
p.closePath();
Area a2 = new Area(p);
a1.subtract(a2);
XYShapeAnnotation a = new XYShapeAnnotation(a1, new BasicStroke(),
new Color(0xff0000),
new Color(0xff0000));
renderer.addAnnotation(a, Layer.BACKGROUND);
어떤 코드 지금까지해야합니까? – wumpz
현재 JFreeChart 데모에서 코드를 사용하고 있습니다. XYPolygonAnnotationDemo1 – jerome