小编典典

如何在jfreechart,netbeans中调整此图表的大小?

java

我似乎无法操纵图表本身。我无法更改大小,并chartPanel = createChartPanel(); 不断重写为chartPanel = javax.swing.panel();

我试图创建一个方法modificarGrafico,但是没有:

范例:http :
//www.flickr.com/photos/63259070@N06/6371596517/

public JPanel createChartPanel(){
DefaultPieDataset pieDataset = new DefaultPieDataset();
pieDataset.setValue("Toyota", new Integer(10));
pieDataset.setValue("Nissan", new Integer(25));
pieDataset.setValue("Hummer", new Integer(5));
pieDataset.setValue("BMW", new Integer(10));
pieDataset.setValue("Honda", new Integer(30));
pieDataset.setValue("Ford", new Integer(20));
JFreeChart chart = ChartFactory.createPieChart3D("Ventas por Marca", pieDataset, true,         true, true);
return new ChartPanel(chart);
}

public void modificarGrafico(){
//JDesktopPane dtp = new JDesktopPane();

   this.chartPanel.setSize(200,200);
   this.chartPanel.setVisible(rootPaneCheckingEnabled);

   }

阅读 228

收藏
2020-11-26

共1个答案

小编典典

您不必担心图表的大小,将面板的布局设置为GridBagLayout应该会有所帮助。

2020-11-26