如何在jfreechart的XYPlot中更改标记大小

时间:2013-04-16 23:25:39

标签: java jfreechart

在这个问题的选定答案中,我想更改标记大小,我该怎么做?

Setting Range for X,Y Axis-JfreeChart

1 个答案:

答案 0 :(得分:4)

您可以通过XYItemRenderer.setSeriesShape实现此目的。请参阅DefaultDrawingSupplier .createStandardSeriesShapes()的工作原理。

    XYItemRenderer renderer = xyPlot.getRenderer();
    renderer.setSeriesPaint(0, Color.blue);
    double size = 20.0;
    double delta = size / 2.0;
    Shape shape1 = new Rectangle2D.Double(-delta, -delta, size, size);
    Shape shape2 = new Ellipse2D.Double(-delta, -delta, size, size);
    renderer.setSeriesShape(0, shape1);
    renderer.setSeriesShape(1, shape2);

参考:JFreeChart: Increase Size of Data Point