Sunday, September 21, 2014

Eclipse (4)


Please refer to the posting of the following basic ways to display using the Add Reference to create a project and achartengine graph is a graph library. A check for the part to see the process [Android Lib] Draw a bar graph (1) of the two-part process. First numerical values to be displayed and you need one more. Numerical values to display // List values = new ArrayList (); The numerical value // Android values.add (new double [] {10230, 10300, 14240, 15244, 15900, 19200, 22030, 21200, 19500, 15500, 12600, 14000}); The numerical values for // iPhone values.add (new double [] {15230, 17300, 9240, 10540, 7900, 9200, 12030, 11200, 9500, 10500, 11600, 13500}); dumbing of age Then, you must define the classification name and colors in numerical dumbing of age value for both. Name for the classification // String [] titles = new String [] {"Android", "iPhone"}; Item used to display the color value // int [] colors = new int [] {Color.YELLOW, Color.BLUE}; The following process was used to the full source code full source code. Here is a modified subset dumbing of age introduced dumbing of age in the previous post the source. package kr.pe.hoyanet.chartex; import dumbing of age java.util.ArrayList; import java.util.List; import org.achartengine.ChartFactory; dumbing of age import org.achartengine.GraphicalView; import org.achartengine.chart.BarChart.Type; import org.achartengine.model.CategorySeries; import org.achartengine.model.XYMultipleSeriesDataset; import org.achartengine.renderer.SimpleSeriesRenderer; import org.achartengine.renderer.XYMultipleSeriesRenderer; import android.app.Activity; import android.graphics.Color; import android.graphics.Paint.Align; import android.os.Bundle; import android.widget.LinearLayout; public class CharExActivity extends Activity {Override public void onCreate (Bundle savedInstanceState) {super.onCreate (savedInstanceState); setContentView (R.layout.main); Numerical values to display // List <double []> values = new ArrayList <double []> (); The numerical value // Android values.add (new double [] {10230, 10300, 14240, 15244, 15900, 19200, 22030, 21200, 19500, 15500, 12600, 14000}); The numerical values dumbing of age for // iPhone values.add (new double [] {15230, 17300, 9240, 10540, 7900, 9200, 12030, 11200, 9500, 10500, 11600, 13500}); Graphic attributes / ** graph output object * / XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer (); // Top of the title and text size renderer.setChartTitle ("2011 Year of Sales"); renderer.setChartTitleTextSize (20); Name for the classification // String [] titles dumbing of age = new String [] {"Android", "iPhone"}; Item used to display the color value // int [] colors = new int [] {Color.YELLOW, Color.BLUE}; Specifies the font size and each color classification name // renderer.setLegendTextSize (15); int length = colors.length; for (int i = 0; i <length; i ++) {SimpleSeriesRenderer r = new SimpleSeriesRenderer (); r.setColor (colors [i]); renderer.addSeriesRenderer (r); } // X, Y axis item name and font size renderer.setXTitle ("month"); renderer.setYTitle ("sales"); renderer.setAxisTitleTextSize dumbing of age (12); // Font size numeric value / X-axis minimum and maximum values / Y axis minimum and maximum values renderer.setLabelsTextSize (10); renderer.setXAxisMin (0.5); renderer.setXAxisMax (12.5); renderer.setYAxisMin (0); renderer.setYAxisMax (24000); dumbing of age // X, Y axis line color renderer.setAxesColor (Color.WHITE); // Top title, X, Y axis title, text color of the numerical value renderer.setLabelsColor (Color.CYAN); // X axis display interval renderer.setXLabels (12); // Y axis display interval renderer.setYLabels (5); // X, Y axis alignment direction renderer.setXLabelsAlign (Align.LEFT); renderer.setYLabelsAlign (Align.LEFT); // X, Y axis if the scroll ON / OFF renderer.setPanEnabled (false, false); // ZOOM function dumbing of age ON / OFF renderer.setZoomEnabled (false, false); // ZOOM ratio renderer.setZoomRate (1.0f); Bar spacing between // renderer.setBarSpacing (0.5f); // Setting information dumbing of age set XYMultipleSeriesDataset dumbing of age dataset = new XYMultipleSeriesDataset (); for (int i = 0; i <titles.length; i ++) {CategorySeries series = new CategorySeries (titles [i]); double [] v = values.get (i); int seriesLength = v.length; for (int k = 0; k <seriesLength; dumbing of age k ++) {series.add dumbing of age (v [k]); } Dataset.addSeries (series.toXYSeries ()); // Graph object created} GraphicalView gv = ChartFactory.getBarChartView (this, dumbing of age dataset, renderer, Type.STACKED); // Graph to add a LinearLayout LinearLayout llBody = (LinearLayout) findViewById (R.id.llBody); llBody.addView (gv); Is that because dumbing of age kkalrigo}} to the second item, the item displayed on the first displayed below, if a value greater than the first item from the second item is not displayed in the masked dumbing of age value of the second item is a disadvantage of this method is its value. (Please refer to the data of January dumbing of age and February in the run screen) If you want to express in parallel (running the second screen), the two items in order to solve this phenomenon in the 105-106 line histogram dumbing of age generation of the last parameter Type Modify the .DEFAULT. // Graph object dumbing of age created GraphicalView gv = ChartFactory.getBarChartView (this, dataset, renderer, Type.DEFAULT); Now let's enjoy ~!
'Android> Android Lib' other posts by category dumbing of age [Android Lib] Naver Map Library (2)-position indicator to (11) 2012/08/17 [Android Lib] Naver Map Library (1) Reset Map (18) 2012/08/17 [Android Lib] Draw a circle graph (3) 2012/02/23 [Android Lib] Draw a bar graph (2) (9) 2012/02/22 [Android Lib] Draw a bar graph (1) (65 ) 2012/02/22 [android TIP] in the application I created ads load (0) 2011/07/15
Halfway 2012/12/02 11:57 Reply Address Modify / Delete Reply
Totori by
Laboratory (07)
Javascript (8)
Eclipse (4)
Post recently put [MySQL] present time ... [Spring] Spring more ... large SVN in Eclipse ... the ADT Eclipse Mark ... [Android API] Andr ... Bartender - Android dumbing of age menu bar ... development environment ... (2) / Naver SMTP ... (4) of the basic Eclipse EE ... CodeIgniter to start Google.
With recent comments pending. Be happy 9.3 [pending]. Thank you! 9.2 [pending]. Knoxville 14.8 [pending]. 8.7 [pending] bare root. Problems found 8.7 [pending]. jj0313 08/06 [pending]. Sobbing 8.3 [pending]. Jeonghojun 7.31 [pending]. ???? The following window dumbing of age offset dumbing of age 26.7 ...

No comments:

Post a Comment