Add a JFreeChart in to JPanel

后端 未结 4 889
暖寄归人
暖寄归人 2021-01-11 11:04

if i have a my Jpanel and a my JFreeChart. How can I add this Chart in to the JPanel?

XYSeries series = new XYSeries(\"XYGraph\");
   series.add(1, 1);
   se         


        
4条回答
  •  失恋的感觉
    2021-01-11 11:23

    From an old java forums thread

    JPanel jPanel1 = new JPanel();
    jPanel1.setLayout(new java.awt.BorderLayout());
     ..
    ChartPanel CP = new ChartPanel(chart);
    .. 
    jPanel1.add(CP,BorderLayout.CENTER);
    jPanel1.validate();
    

提交回复
热议问题