|
Á¦ ¸ñ |
PIE chart¸¦ ±×¸®´Âµ¥¿ä.. |
|
ÀÛ¼ºÀÚ |
±èö¼ö |
ÀÛ¼ºÀÏ |
2003-10-15 |
Á¶È¸¼ö |
1441 ȸ |
|
÷ºÎÆÄÀÏ |
÷ºÎµÈ ÆÄÀϾøÀ½.
|
|
¾È³çÇϽʴϱî ? Chart¿¡ ´ëÇØ¼ ±Ã±ÝÇØ¼ Áú¹®µå¸³´Ï´Ù. PIE Â÷Æ®¸¦ »ý¼ºÇÏ·Á°í ÇÕ´Ï´Ù..
double[][]À¸·Î data¸¦ »ý¼ºÇß½À´Ï´Ù..
Á¦ »ý°¢À¸·Î´Â double[2][4]·Î »ý¼ºÇßÀ¸¸é µÎ°³ÀÇ PIE Chart°¡ »ý¼ºÀÌ µÇ¾î¾ß ÇÒ°Í °°Àºµ¥.. ½ÇÁ¦·Î ÇØº¸´Ï±î Å«ÆÄÀÌÂ÷Æ®¾È¿¡ ÀÛÀº ÆÄÀÌÂ÷Æ®°¡ »ý¼ºÀÌ µÇ´õ¶ó±¸¿ä.
ÇѰ³¾¿ ÇѰ³¾¿ µÎ°³°¡ »ý¼ºµÉ¼ö´Â ¾ø´Â°ÍÀΰ¡¿ä..
³Ê¹« ±ÞÇØ¼ ÀÌ·¸°Ô ±ÛÀ» ¿Ã¸³´Ï´Ù.. ºÎʵ右´Ï´Ù..
ÀüÈ¿¬¶ôÁּŵµ ÁÁ±¸¿ä.. ¿¬¶ôó : 017-217-0729 ÀÔ´Ï´Ù.. ²À Á» ºÎʵ右´Ï´Ù.. ¾îµð¼±°¡ ±¸ÇÑ ¿¹Á¦ ÀϺθ¦ º¸³»µå¸®¿À´Ï Çѹø »ìÆìºÁ ÁÖ¼¼¿ä..
public IlvChart getPieChart() { double[][] series = new double[1][data[0].length]; for(int i=0; i series[0][i] = data[0][i]; } double[][] series1 = new double[1][data[0].length]; // Creates a new data set. The series array containing only y values, // the x series index is set to -1. IlvDataSet[] dataSets = IlvDefaultDataSet.create(series, -1, null, dataLabels); IlvDataSource ds = new IlvDefaultDataSource(dataSets); //== Add a pie chart. IlvChart chart = new IlvChart(IlvChart.PIE); chart.setAntiAliasing(true); chart.setDataSource(ds); chart.setFooterText(" "); chart.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createLineBorder(Color.black), BorderFactory.createEmptyBorder(3,3,3,3))); chart.getFooter().setBackground(Color.white); chart.getFooter().setOpaque(true); chart.getFooter().setBorder(BorderFactory.createLineBorder(Color.black)); ChartInteractionListener lst = new HighlightListener(); IlvChartHighlightInteractor inter = new IlvChartHighlightInteractor(); // We want to retrieve the display item. inter.setPickingMode(IlvChartDataInteractor.ITEM_PICKING); // Add the listener. This listener will be notified by the interactor // when a point is highlighted or unhighlighted. inter.addChartInteractionListener(lst); chart.addInteractor(inter); // Set the labeling mode so that the contribution in percentage of the // data point should be displayed. chart.getRenderer(0).setDataLabelling(IlvChartRenderer.PERCENT_LABEL); // Add a legend to the chart. IlvLegend legend = new IlvLegend(); legend.setAntiAliasing(true); chart.addLegend(legend, IlvChartLayout.EAST); // Set the starting angle of the pie chart. chart.setStartingAngle(90); //chart.setFooterText(title); return chart; }
public static void main(String args[]){ double[][] data = {{30,20,10,50},{40,10,10,40},{20,80,0,0},{30,60,0,10}}; String[] names = {"100/30", "100/30", "100/30", "100/10"}; String[] dataLabels = {"kim","yim","jim","nsim"}; String title = "test chart"; JFrame op=new JFrame(); ChartWrapper test=new ChartWrapper(data,names,dataLabels,title);
op.getContentPane().add(test.getPieChart()); op.setSize(800,600); op.setVisible(true); } } |
|
|
|