I need to insert a background image for my graphic. Actually, I did it, but I have problem.
How to remove everything except the red line itself?
Now I have this result(look below image).
XYSeries series4 = new XYSeries("Траектория движения ЛА");
for (int i = 0; i < La.size(); i++) {
series4.add(massLatitude[i], massLongitude[i]);
}
XYSeriesCollection seriesCollection4 = new XYSeriesCollection(series4);
Image icon = ImageIO.read(new File("image.jpg"));
final JFreeChart chart4 = ChartFactory.createScatterPlot("Траектория полета ЛА", null, null,
seriesCollection4);
chart4.setBackgroundImage(icon);
final ChartPanel chartPanel4 = new ChartPanel(chart4);
chartPanel4.setPreferredSize(new Dimension(1300, 480));
panel.add(chartPanel4);
How to remove everything except the red line itself?
You need to get rid of the grid lines, and the plot background (different from the chart background):
chart.getXYPlot().setDomainGridlinesVisible(false);
chart.getXYPlot().setRangeGridlinesVisible(false);
Color trans = new Color(0xFF, 0xFF, 0xFF, 0);
chart.getPlot().setBackgroundPaint( trans );
I achieved success by half) But how can I remove the notation XAxis and YAxis? Now I have it enter image description here
XYSeries series4 = new XYSeries("Траектория движения ЛА");
for (int i = 0; i < La.size(); i++) {
series4.add(massLongitude[i], massLatitude[i]);
}
XYSeriesCollection seriesCollection4 = new XYSeriesCollection(series4);
Image icon = ImageIO.read(new File("DlyaOpen.jpg"));
final JFreeChart chart4 = ChartFactory.createScatterPlot(null, null, null,
seriesCollection4);
chart4.removeLegend();
chart4.setBackgroundImage(icon);
Color trans = new Color(0xFF, 0xFF, 0xFF, 0);
chart4.getPlot().setBackgroundPaint( trans );
chart4.getPlot().setOutlineVisible(false);
chart4.getXYPlot().setRangeGridlinesVisible(false);
chart4.getXYPlot().setDomainGridlinesVisible(false);
final ChartPanel chartPanel4 = new ChartPanel(chart4);
chartPanel4.setPreferredSize(new Dimension(800, 480));
panel.add(chartPanel4);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.