I am creating JFreeChart
as follows (see below). On the x axis I need to show around 1000 ticks. So, that's why I am putting JFreeChart
into the JScrollPane
. When I try to set the WIDTH of a chart panel to 2000, the plot is not sized proportionally. Is there any way to define the WIDTH of a plot (XYPlot
).
XYDataset dataset = createData(data);
JFreeChart chart = createChart(dataset);
final ChartPanel chartPanel = new ChartPanel(chart);
chartPanel.setPreferredSize(new Dimension(2000, this.height));
JScrollPane scrl = new JScrollPane(chartPanel);
scrl.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
scrl.setViewportView(chartPanel);
scrl.setPreferredSize(new Dimension(this.width, this.height));
this.add(scrl);