Introduction and use of Achartengine (Google's Graphics toolkit for Android)

Source: Internet
Author: User

Achartengine (ACE) is an open source drawing toolkit provided by Google for Android. It integrates the ability to draw multiple graphs: line, scatter, bubble, histogram, pie, gauge, and more. : http://download.csdn.net/detail/u013647453/8511203 (Jar package and development document with 1.1.0) official website: http://code.google.com/p/achartengine (requires a wall-over download)
Below is I developed a simple AndroidStudio1.1 engineering core code: 1, after the establishment of the project, the download Achartengine-1.1.0.jar into the Libs folder, right-click Add as Library. can use the toolkit.
2. You need to include a <activity> node in the <application> node in Androidmanifest.xml, such as: (because, call this package, is implemented by a org.achartengine.GraphicalActivity in a new boot package)

3. Several functions of the Code section: mainly to set some data and graphic colors and other rendering effects
Set the axis name and maximum, minimum tick value, and title name private void Setchart (Xymultipleseriesrenderer renderer) {renderer.setcharttitle ("Algo        Rithm ");        Renderer.setxtitle ("X Axis");        Renderer.setytitle ("Y Axis");        Renderer.setxaxismin (0);        Renderer.setxaxismax (30);        Renderer.setyaxismin (0);    Renderer.setyaxismax (200); }//Set graphics rendering properties Private Xymultipleseriesrenderer Getbarrenderer () {Xymultipleseriesrenderer renderer = new Xymu        Ltipleseriesrenderer ();        Simpleseriesrenderer simpleseriesrenderer = new Simpleseriesrenderer ();        Simpleseriesrenderer.setcolor (color.red);        Renderer.addseriesrenderer (Simpleseriesrenderer);        Simpleseriesrenderer = new Simpleseriesrenderer ();        Simpleseriesrenderer.setcolor (Color.gray);        Renderer.addseriesrenderer (Simpleseriesrenderer);        Setchart (renderer);    return renderer; }//Get DataSet Private Xymultipleseriesdataset Getbardataset () {Xymultipleseriesdataset DataSet= new Xymultipleseriesdataset ();        Random random = new random ();            for (int i = 0; i < 2; i++) {Categoryseries series = new Categoryseries ("algorithm" + (i + 1));            for (int k = 0; k < k++) {Series.add (+ random.nextint ()% 150);        } dataset.addseries (Series.toxyseries ());    } return DataSet; }
Invocation part:
Xymultipleseriesrenderer renderer = Getbarrenderer ();        Intent intents = Chartfactory.getbarchartintent (this, Getbardataset (), renderer, BarChart.Type.DEFAULT);        StartActivity (intents);
Operating effects such as:

See the official development documentation in the download file for more information on how to use it.

Introduction and use of Achartengine (Google's Graphics toolkit for Android)

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.