Android Achartenginee the custom chart class explained

Source: Internet
Author: User

Some time ago downloaded the source code of the Achartenginee, and the source of the framework of some understanding, explaining the whole framework of the components and the role of each part, the most recent week, the main look at the source of the demo part, that is how to use the chart engine, Demo code is much easier than the source. But after looking at the demo code, found that all the data are written in the class, unable to meet our own needs, demo packaging is not good, because the whole framework of the most frequently used in the diagram class to do a custom package, After my own encapsulation, and then draw the chart, as long as we are in the external data set to be drawn in accordance with the required format of the assembly, directly call me to re-encapsulate the good, to draw, to use more convenient.

Let's take a look at the entire framework of my re-encapsulation project:

Only the same more commonly used charts are encapsulated, not commonly used to re-encapsulate.

Basechart is the base class for all charts, and the class contains some common properties and methods for all charts, such as: The parent class defines the drawing method of two charts, one returns a intent, returns a intent, jumps to the activity to display the chart, The other is to directly return a graphicalview, can be directly in the current layout of the display, according to the actual situation to call two different implementation methods, the base class also contains some of the properties of all the charts will be used, including: chart title, color, spacing and so on.

Barchart is a package of basic histogram, Budgetdoughnutchart is a multi-layered pie chart of a package, Budgetpiechart is a pie chart encapsulation, Curvechart is the package of graphs, The Rangebarchart is an encapsulation of the differential histogram, Stackedbarchart is the encapsulation of the stacked histogram, and Scatterchart is the encapsulation of the scatter plot.

Drawchart is an interface that defines two methods, which are the two methods of drawing that our base class implements. Here are a few of the chart effects that are implemented by calling your own packaged drawing class, and you can plot the chart as soon as you pass in the data.

1. Scatter chart: 2. Pie chart: 3. Bar chart

Through their own packaging, as long as the incoming assembled data can be drawn out of the chart, not only convenient to use, but also to better encapsulate the code. The following will be my own project, there is a need to download reference to my resources.

Android Achartenginee the custom chart class explained

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.