JPanel
을 확장 한 다른 클래스의 통계 데이터를 그래프로 나타낼 필요가 있습니다. 지금 계획은 paintComponent
를 사용하는 것과 같은 Graphics
클래스는 다음과 같습니다JPanel에서이 방법으로 그래프를 만들 수 있습니까?
public void paintComponent(Graphics g) {
super.paintComponent(g);
//create a rectangle to represent the outline of the graph
g.drawRect(300, 50, 400, 350);
//set up the datapoints
for(int i = 0; i < data.size(); i++) {
//put the datapoints where ever they need to go within this rectangle
g.drawOval(x, y, width, height);
}
}
어떤 이유로이 끔찍한인가? 더 중요한 것은, 내가 사용할 수 있지만 모를 멋진, 사용하기 쉬운 그래픽 라이브러리가 있는가?
감사합니다.
도 참조 [JFreeChart의 태그]입니다 고려. – trashgod