I am using JFreeChart to make a chart in my program. My problem is I cannot set the height properly. I have tried every command I could think of, I have put it in other panels, however, nothing works. I want to be able to put it somewhere in a corner...or anywhere really and to be able to set both width and height. I have also tried with setPrefferedSize, but it only works with width.
Code :
DefaultPieDataset result = new DefaultPieDataset();
result.setValue("TotalSwag", totalSwag);
result.setValue("TotalYolo", totalYolo);
result.setValue("TotalCool", totalCool);
result.setValue("TotalLame", totalLame);
JFreeChart chart = ChartFactory.createPieChart3D("Swag-O-meter", result, true, true, false);
PiePlot3D plot = (PiePlot3D) chart.getPlot();
plot.setStartAngle(290);
plot.setDirection(Rotation.CLOCKWISE);
plot.setForegroundAlpha(0.5f);
ChartPanel chartPanel = new ChartPanel(chart, W, H, W, H, W, H,
false, true, true, true, true, true);
chartPanel.setMaximumSize(new Dimension(150, 150));
charPanel.add(chartPanel);
charPanel.setSize(W, H);
contentPane.add(charPanel, BorderLayout.WEST);