이 기사에서는 JFreeChart 플러그인이 구현 한 라인 차트 효과에 대해 설명합니다. 다음과 같이 참조에 대해 공유하십시오.
패키지 com.lei.jfreechart; import javax.swing.jpanel; import org.jfree.chart.chartfactory; import org.jfree.chart.chartpanel; import org.jfree.chart.chartpanel; import org.jfree.chart.ax.numberaxis; import org.jfree.chart.categox org.jfree.chart.plot.plotorientation; import org.jfree.data.category.defaultcategorydataset; import org.jfree.ui.applicationframe; import org.jfree.ui.refineryutilities; public public applications {/*private serial extation and extation interial extress ancappliceUnehart = 11; Linecharts (String s) {super (s); setContentPane (createMoline ());} public static void main (String [] args) {Linecharts fjc = new Linecharts ( "line Chart"); fjc.pack (); 정유 공장 .centerframeonscreen (FJC); fjc.setvisible (true);} // 차트를 표시하는 패널을 생성하여 공개 정적 jpanel createMoline () {jfreechart jfreechart = createChart (createAtaset ()); 새로운 차트 패널 (jfreechart);} // 차트의 주요 객체를 생성합니다. linedataset, // data plotorientation.vertical. CategoryPlot 플롯 = Chart.getCategoryPlot (); plot.setRangeGridLinesvisible (true); // 그리드 라인을 표시 할 것인지 플롯. // 배경 투명도 번호 숫자 rangeaxis = (numberaxis) plot.getRangeAxis (); rangeaxis.setstandardtickunits (numberaxis.createintegertickunits ()); rangeaxis.setautorangeincludeszero (true); rangeaxis.setuppermargin (0.20); rangeaxis.setlabelangle (math.pi / 2.0); 반환 차트;} // 데이터 생성 공개 static defaultCategoryDataset wayatAset () {defaultCategoryDataset linedAtaset = new defaultCategoryDatAset (); // 각 커브 문자열의 이름 Series1 = "냉장고"; 문자열 시리즈 2 = "컬러 TV"; 문자열 시리즈 3 = "세탁기"; // 수평 축 이름 (열 이름) String type1 = "1 월"; 문자열 type2 = "2 월"; 문자열 type3 = "March"; linedataset.addValue (0.0, series1, type1); linedataset.addvalue (4.2, series1, type2); linedataset.addvalue (3.9, series1, type3); linedataset.addvalue (1.0, series2, type1); linedataset.addvalue (5.2, series2, type2); linedataset.addvalue (7.9, series2, type3); linedataset.addValue (2.0, series3, type1); linedataset.addvalue (9.2, series3, type2); linedataset.addvalue (8.9, series3, type3); return linedataset;}}작동 효과는 다음과 같습니다.
더 많은 Java 관련 컨텐츠를 보려면이 사이트에 관심이있는 독자는 "Java 데이터 구조 및 알고리즘 자습서", "Java Operation Dom Node Tips 요약", "Java 파일 및 디렉토리 작동 팁 요약 및"Java Cache Cache Operation Tips "의 주제를 볼 수 있습니다.
이 기사가 모든 사람의 Java 프로그래밍에 도움이되기를 바랍니다.