티스토리 뷰
public class Yusen01_1{
public static void main(String[] args){
XYPlotterTester Tester1 = new XYPlotterTester("Combined XY Plot Demo 3");
Tester1.pack();
RefineryUtilities.centerFrameOnScreen(Tester1);
Tester1.setVisible(true);
}
}
@SuppressWarnings("serial")
class XYPlotterTester extends ApplicationFrame{
JFreeChart hChart = null;
ChartPanel hPanel = null;
String hTitle = null;
/**
* Constructs a new demonstration application.
*
* @param title the frame title.
*/
public XYPlotterTester(final String title) {
super(title);
hTitle = title;
hChart = createCombinedChart();
hPanel = new ChartPanel(hChart, true, true, true, false, true);
hPanel.setPreferredSize(new java.awt.Dimension(500, 270));
setContentPane(hPanel);
}
/**
* Creates a combined chart.
*
* @return the combined chart.
*/
private JFreeChart createCombinedChart() {
// create subplot 1...
final XYDataset data1 = createDataset1();
final XYItemRenderer renderer1 = new StandardXYItemRenderer();
final NumberAxis rangeAxis1 = new NumberAxis("Range 1");
final XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1);
subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
final XYTextAnnotation annotation = new XYTextAnnotation("Hello!", 50.0, 10000.0);
annotation.setFont(new Font("SansSerif", Font.PLAIN, 9));
annotation.setRotationAngle(Math.PI / 4.0);
subplot1.addAnnotation(annotation);
// create subplot 2...
final XYDataset data2 = createDataset2();
final XYItemRenderer renderer2 = new StandardXYItemRenderer();
final NumberAxis rangeAxis2 = new NumberAxis("Range 2");
rangeAxis2.setAutoRangeIncludesZero(false);
final XYPlot subplot2 = new XYPlot(data2, null, rangeAxis2, renderer2);
subplot2.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT);
// parent plot...
final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new NumberAxis("Domain"));
plot.setGap(10.0);
// add the subplots...
plot.add(subplot1, 1);
plot.add(subplot2, 1);
plot.setOrientation(PlotOrientation.VERTICAL);
// return a new chart containing the overlaid plot...
return new JFreeChart("CombinedDomainXYPlot Demo",
JFreeChart.DEFAULT_TITLE_FONT, plot, true);
}
/**
* Creates a sample dataset.
*
* @return Series 1.
*/
private XYDataset createDataset1() {
// create dataset 1...
final XYSeries series1 = new XYSeries("Series 1");
series1.add(10.0, 12353.3);
series1.add(20.0, 13734.4);
series1.add(30.0, Math.random()*20000);
series1.add(40.0, 13984.3);
series1.add(50.0, 12999.4);
series1.add(60.0, 14274.3);
series1.add(70.0, 15943.5);
series1.add(80.0, 14845.3);
series1.add(90.0, 14645.4);
series1.add(100.0, 16234.6);
series1.add(110.0, 17232.3);
series1.add(120.0, 14232.2);
series1.add(130.0, 13102.2);
series1.add(140.0, 14230.2);
series1.add(150.0, 11235.2);
final XYSeries series2 = new XYSeries("Series 2");
series2.add(10.0, 15000.3);
series2.add(20.0, 11000.4);
series2.add(30.0, 17000.3);
series2.add(40.0, 15000.3);
series2.add(50.0, 14000.4);
series2.add(60.0, 12000.3);
series2.add(70.0, 11000.5);
series2.add(80.0, 12000.3);
series2.add(90.0, 13000.4);
series2.add(100.0, 12000.6);
series2.add(110.0, 13000.3);
series2.add(120.0, 17000.2);
series2.add(130.0, 18000.2);
series2.add(140.0, 16000.2);
series2.add(150.0, 17000.2);
final XYSeriesCollection collection = new XYSeriesCollection();
collection.addSeries(series1);
collection.addSeries(series2);
return collection;
}
/**
* Creates a sample dataset.
*
* @return Series 2.
*/
private XYDataset createDataset2() {
// create dataset 2...
final XYSeries series2 = new XYSeries("Series 3");
series2.add(10.0, 16853.2);
series2.add(20.0, 19642.3);
series2.add(30.0, 18253.5);
series2.add(40.0, 15352.3);
series2.add(50.0, 13532.0);
series2.add(100.0, 12635.3);
series2.add(110.0, 13998.2);
series2.add(120.0, 11943.2);
series2.add(130.0, 16943.9);
series2.add(140.0, 17843.2);
series2.add(150.0, 16495.3);
series2.add(160.0, 17943.6);
series2.add(170.0, 18500.7);
series2.add(180.0, 19595.9);
return new XYSeriesCollection(series2);
}
// ****************************************************************************
// * JFREECHART DEVELOPER GUIDE *
// * The JFreeChart Developer Guide, written by David Gilbert, is available *
// * to purchase from Object Refinery Limited: *
// * *
// * http://www.object-refinery.com/jfreechart/guide.html *
// * *
// * Sales are used to provide funding for the JFreeChart project - please *
// * support us so that we can continue developing free software. *
// ****************************************************************************
/**
* Starting point for the demonstration application.
*
* @param args ignored.
*/
}
반응형
'SWDesk > App' 카테고리의 다른 글
[Android] 핸들러(Handler)와 루퍼(Looper) 테스트 (0) | 2020.03.23 |
---|---|
[Android] TCP/IP 소켓 통신 (0) | 2020.03.16 |
Android Studio를 이용하여 GaveView 프로그래밍하기 위한 초기 설정(2) (0) | 2020.01.24 |
Android Studio를 이용하여 GaveView 프로그래밍하기 위한 초기 설정 (0) | 2020.01.22 |
[Unsentable Letter] Android Release, 2019.12.29 (0) | 2019.12.29 |
반응형
250x250
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 치매
- Innovation&Hurdles
- 티스토리챌린지
- 치매방지
- Innovations&Hurdles
- Innovations
- 혁신
- 아두이노
- Hurdles
- badp
- DYOV
- 배프
- bilient
- 혁신과허들
- 절연형
- Video
- 허들
- 전류
- image
- Decorator
- 오블완
- 전압
- arduino
- 빌리언트
- 둎
- 전압전류모니터링
- BSC
- ServantClock
- 심심풀이치매방지기
- 심심풀이
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
글 보관함