Achartengine andorid Image Engine entry

Source: Internet
Author: User

Recently, I am developing an app for the School of mechanical engineering.

Achartengine, a third-party image engine, is quite powerful (although it is nearly enough than the third-party HTML image engines)

Entry:

Please refer to http://blog.csdn.net/lk_blog/article/details/7645509. you just need to read the following link. You just need to know what achartengine is.

You 'd better flip it over.

My home page also has a http://files.cnblogs.com/sweetculiji/achartengine-1.1.0.rar

I'm using a achartengine-1.1.0 version.

Add to project

Then run the following program directly.

1 package COM. example. ahartenginedemo; 2 3 Import Java. util. random; 4 5 import Org. achartengine. chartfactory; 6 Import Org. achartengine. graphicalview; 7 Import Org. achartengine. chart. pointstyle; 8 Import Org. achartengine. model. xymultipleseriesdataset; 9 Import Org. achartengine. model. xyseries; 10 Import Org. achartengine. renderer. xymultipleseriesrenderer; 11 import Org. achartengine. renderer. xyseriesren Derer; 12 13 Import android. app. activity; 14 Import android. graphics. color; 15 Import android. OS. bundle; 16 Import android. view. menu; 17 import android. view. menuitem; 18 Import android. widget. linearlayout; 19 public class mainactivity extends activity {20 21 22 protected void oncreate (bundle savedinstancestate) {23 // todo auto-generated method stub24 super. oncreate (savedinstancestate); 25 setcontentview (R. layout. activity_main); // set the page layout 26 27 28 // 1 to construct the display. Use the rendering Figure 29 xymultipleseriesrenderer Renderer = new xymultipleseriesrenderer (); 30 Renderer. setxtitle ("no."); // set it to the Title 31 Renderer on the X axis. setytitle ("size"); // set the title of the Y axis 32 Renderer. setshowgrid (true); // display the grid 33 Renderer. setbackgroundcolor (color. black); 34 // 2, display 35 xymultipleseriesdataset dataset = new xymultipleseriesdataset (); 36 // 2.1, build data 37 xyseries Series1 = N EW xyseries ("test1"); 38 series1.add (2, 3); 39 series1.add (1, 9); 40 xyseries series2 = new xyseries ("Test2"); 41 series2.add (4, 7 ); 42 series2.add (); 43 // point to be drawn is put into dataset 44 dataset. addseries (Series1); 45 dataset. addseries (series2); 46 47/3, set 48 xyseriesrenderer xyrenderer = new xyseriesrenderer (); 49 // 3.1 set the color to 50 xyrenderer. setcolor (color. blue); 51 // 3.2 set the style of the vertex 52 xyrenderer. setpointstyle (point Style. Square); 53 // 3.3, add the point to be drawn to the coordinate drawing 54 Renderer. addseriesrenderer (xyrenderer); 55 // 3.4, repeat 1 ~ Step 3 draw the second generation point 56 xyrenderer = new xyseriesrenderer (); 57 xyrenderer. setcolor (color. red); 58 xyrenderer. setpointstyle (pointstyle. circle); 59 Renderer. addseriesrenderer (xyrenderer); 60 61 62 graphicalview view = chartfactory. getlinechartview (this, dataset, Renderer); 63 setcontentview (View); 64} 65}

No definition is required for layout files. Add androidmanifest. xml:

< activity android:name = "org.achartengine.GraphicalActivity" />

Run it on your own (I usually do it first to see if it can be run) And then I will probably check the code.

Then reference http://www.open-open.com/lib/view/open1396359314653.html

This article is very basic

Let's take a look at the core ideas:

Mainly by setting several objects (various chaos at the beginning of learning! Don't worry! I have a picture !)

(Reprinted)
1. xyseries object: used to store the data information of a line. If you execute xyseries. Add (), the red point will appear.
2. xymultipleseriesdataset object: a dataset. You can add multiple xyseries objects because a line chart may have multiple lines. The yellow part can store multiple lines. In this example, four lines are saved.
3. xyseriesrenderer object: it is mainly used to set the style, color, and width of a line. The property of the line in the blue part: the light blue triangle is used to set the line Renderer.
4. xymultipleseriesrenderer object: it is mainly used to define the overall style of an image, and to set overall styles such as xtitle, ytitle, and chartname,
You can add multiple xyseriesrenderer objects, because a graph can have multiple broken lines. The entire purple part has many maximum Renderer attributes.
After setting those objects, you can call the dataset xymultipleseriesdataset object through org. achartengine. chartfactory.
Draw a graph with a xymultipleseriesrenderer object and load the graph to graphicalview (equivalent to a canvas)
Chartfactory has a variety of APIs that call to determine whether to draw a line chart or a bar chart.

API download: (Trial)

Http://zhidao.baidu.com/link? Url = pAdGIkrthMBUSoKys-jsZJ_RkAzZiUgfFEhsHR-Z9cUo76VFYo_oozqtLghTPlZv_RfcjQrnoVMhS7mRz2Y3eklR4ifeEArvYmPP-dr4BGq

The entry is complete.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.