#JFreeChart
10 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @unborn pecan! Please use
/closeor theClose Postbutton above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
You didn't provide any context, so all that I can say is that you need to include the library's Jar in your classpath
package view;
import javax.swing.JFrame;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.data.category.DefaultCategoryDataset;
public class NewClass {
public static void main(String[] args) {
// Tạo DefaultCategoryDataset để thêm giá trị của cột
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
dataset.addValue(10000, "Doanh thu", "Tháng 1");
dataset.addValue(12000, "Doanh thu", "Tháng 2");
dataset.addValue(8000, "Doanh thu", "Tháng 3");
dataset.addValue(15000, "Doanh thu", "Tháng 4");
dataset.addValue(20000, "Doanh thu", "Tháng 5");
// Tạo đối tượng JFreeChart
JFreeChart chart = ChartFactory.createBarChart("Doanh thu hàng tháng", "Tháng", "Doanh thu", dataset);
// Tạo đối tượng ChartPanel để hiển thị JFreeChart
ChartPanel chartPanel = new ChartPanel(chart);
// Tạo JFrame để hiển thị ChartPanel
JFrame frame = new JFrame();
frame.add(chartPanel);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
}
}
Can you guide me in more detail?
I mean, when you compile, include the path to the jfreechart jar in your classpath argument
None of the text you pasted helps with the actual issue
Also try googling that error, you'll find something online for it.
I don't understand because the translation is weird can you give me an example