JFreeChart : how do you put multiple charts into a composite chart

前端 未结 1 562
粉色の甜心
粉色の甜心 2020-12-11 06:08

In JFreeChart is there a notion of a composite Chart.

I need to layout several charts in a grid like arrangement.

Each chart in the grid needs to have its ow

1条回答
  •  萌比男神i
    2020-12-11 06:52

    As shown here, ChartPanel can be placed in any desired Swing layout. The example cited uses GridLayout. ChartUtilities has methods for rendering a chart as a .png. I see several approaches to getting a composite image:

    • Use Robot#createScreenCapture() to image the layout, as shown here and here; the resulting BufferedImage can be saved using ImageIO.write().

    • Use JFreeChart#createBufferedImage() to render each chart and impose the individual images into a BufferedImage to create a single image, as suggested here.

    • Implement the Printable interface to render the image in a graphics context, as shown here.

    image

    0 讨论(0)
提交回复
热议问题