검색결과 리스트
chart에 해당되는 글 2건
- 2013.01.12 [iOS] Open Source Chart for iOS
- 2011.08.29 [jFreeChart] jFreeChart (Bubble Chart ) 사용법
글
출처 : http://androidkr.blogspot.kr/2012/10/open-source-chart-for-ios.html
iOS 앱 개발 시 Chart 그리는데 유용한 open source 프로젝트 들.
- Spider (Radar) Chart
- Bar, Line and Pie Chart
- Another one
'Mobile > iPhone / Xcode' 카테고리의 다른 글
[Xcode] XCode VS AppCode (0) | 2013.11.27 |
---|---|
[iOS] iOS Simulator 위치 (0) | 2012.03.06 |
[iOS] About View Controllers (0) | 2012.03.06 |
[iOS] About Events in iOS (0) | 2012.03.04 |
[iOS] json parser for Objective-c (0) | 2012.03.04 |
트랙백
댓글
글
import java.io.*
import java.awt.Font
import java.awt.Color
improt java.awt.GradientPaint
import org.jfree.chart.ChartFactory
import org.jfree.chart.ChartPanel
import org.jfree.chart.JFreeChart
import org.jfree.chart.axis.NumberAxis
import org.jfree.chart.plot.PlotOrientation
import org.jfree.chart.plot.XYPlot
import org.jfree.chart.ChartRenderingInfo
import org.jfree.chart.ChartUtilities
import org.jfree.chart.plot.CategoryPlot
import org.jfree.data.xy.MatrixSeriesCollection>
import org.jfree.data.xy.NormalizedMatrixSeries
import org.jfree.ui.ApplicationFrame
import org.jfree.ui.RefineryUtilities
final int SIZE = 20;
final MatrixSeriesCollection dataset = new MatrixSeriesCollection();
// value, x, y
int[][] itmes = {
{200, 3 , 12}
,{250, 8 , 5 }
,{80 , 14, 16}
,{50 , 18, 4 }
};
int nSum = 0;
for (int i = 0; i < itmes.length; i++ ) {
nSum += itmes[i][0];
}
for (int i = 0; i < itmes.length; i++) {
NormalizedMatrixSeries newSeries =
new NormalizedMatrixSeries("대카테고리" + (i+1), SIZE, SIZE);
newSeries.update(itmes[i][2], itmes[i][1], itmes[i][0]);
newSeries.setScaleFactor(SIZE*((float)itmes[i][0]/nSum));
dataset.addSeries(newSeries);
}
final JFreeChart chart = ChartFactory.createBubbleChart(
"Bubble Chart"
, "X축"
, "Y축"
, dataset
, PlotOrientation.VERTICAL
, true
, true
, false);
chart.setBackgroundPaint(Color.white);
chart.setTitle("제목");
// 제목
chart.getTitle().setFont(new Font("돋움", Font.BOLD, 15));
// 범례
chart.getLegend().setItemFont(new Font("돋움", Font.PLAIN, 12));
final XYPlot plot = chart.getXYPlot();
Font font = plot.getDomainAxis().getLabelFont();
// X축 라벨
plot.getDomainAxis().setLabelFont(new Font("돋움", font.getStyle(), font.getSize()));
// X축 도메인
plot.getDomainAxis().setTickLabelFont(new Font("돋움", font.getStyle(), 10));
font = plot.getRangeAxis().getLabelFont();
// Y축 라벨
plot.getRangeAxis().setLabelFont(new Font("돋움", font.getStyle(), font.getSize()));
// Y축 범위
plot.getRangeAxis().setTickLabelFont(new Font("돋움", font.getStyle(), 10));
//final XYPlot plot = chart.getXYPlot();
plot.setForegroundAlpha(0.5f);
final NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
//domainAxis.setLowerBound(-0.5);
domainAxis.setLowerBound(0);
final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
// rangeAxis.setInverted(true); // uncoment to reproduce a bug in jFreeChart
//rangeAxis.setLowerBound(-0.5);
rangeAxis.setLowerBound(0);
// 파일 저장
ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());
String fileName= "C:/" + "bubbleChart.jpg";
ChartUtilities.saveChartAsJPEG(new File(fileName),chart,600,400,info);
'Java > jFreeChart' 카테고리의 다른 글
[jFreeChart] jFreeChart (Stacked Chart) 한글깨짐 문제 (0) | 2011.08.26 |
---|
RECENT COMMENT