Android Achartenginee explanation of the source framework

Source: Internet
Author: User

From the last week, the Android Achartenginee source check out after it has been watching how this thing is used, and how the bottom layer is realized, the last week of the understanding of this thing first sent up, that is, to make a summary, Also hope to help to learn this open source project of children's shoes. Let's cut to the chase.

What is Android Achartenginee, an open source graphics project for Apache that is designed to make it easier for Android apps to draw that difficult chart, such as pie charts, graphs, histograms, etc., similar to the high chart on the web side, After mastering the project, as long as we assemble our data into Achartenginee required format, and then call the corresponding API set the corresponding parameters, you want to draw the chart out, very powerful. Today we will explain the overall structure of the project as I understand it.

First look at the code structure of the source project,

This is the structure of the entire project, image package only put in three of the application of the picture (skip), util package mainly put some algorithm related tool class, see also don't understand, tools mainly put in to control the whole chart zoom out of the tool class, also do not explain, the main analysis of the chart , Renderer,model this package and the Chartfactory,graphicalview of the two classes.

First, analyze the role of renderer this package, first of all, the meaning of the word is the meaning of rendering, from the literal meaning of probably know that the class under the package is mainly used to render the style of the chart, that is, mainly to control the appearance of the chart. Here's a look at renderer the classes in this package have those:

Can see, there are several Xxxrenderer class, see the source code can be known, Defaultrenderer is Dialrenderer,xymultipleseriesrenderer's parent class, Simpleseriesrenderer is the parent of xyseriesrenderer, so we can explain it in two groups.

1) Deaultrenderer and its subclasses renderer are rendered for the entire chart, that is, they are used to set the style of the entire chart, and Defaultrenderer defines some common attributes for all charts, such as: Mcharttitle , Mbackground, and so on, the specific details of the properties can be seen from the source; Dialrenderer is inherited from the Defaultrenderer class, in addition to those common attributes of the parent class, he has some of his own unique properties, Dialrenderer is mainly used to render the pie chart renderer, for example: different types of pie chart, column chart, etc. can be used to do rendering of this renderer, Xymultipleseriesrenderer also has the parents of those attributes, he also has many unique properties to set, Xymultipleseriesrenderer is primarily used to render an XY axis chart. This shows that we have to draw the different types of charts to use the corresponding renderer to render, to achieve the best results.

2) Simpleseriesrenderer is the parent of xyseriesrenderer, and as I understand it, the two renderers render different effects on each point. Simpleseriesrenderer is primarily used to render the points in a chart of a pie chart, while the xyseriesrenderer is primarily rendered on the Axis points.

Two. Further analysis of the role of the model package, the class in the model package:

This package contains a collection of some chart points, different types of charts, and we want to use the corresponding objects to load different types of point sets. Where: Categoryseries is the point set used to load the pie chart, Multiplecategoryseries is the point set used to load the doughnut chart, Rangecategoryseries is the point set used to load the histogram, TimeSeries, Xyseries,xyvalueseries is mainly used to load the axis point set, and Xymultipleseriesdataset is a collection of the above three point sets (because there may be multiple images in our axes).

Three. Again analyze the function of the chart package, the class in the chart package:

All the classes in this package are the classes that are responsible for drawing the chart, all of which provide different methods of drawing for different charts, and according to the class name, they are used to draw those charts. Specifically how to draw, I also can not understand.

The last thing to say is chartfactory this factory class, the function of this factory class is based on the different factory methods we call, and the corresponding dataset and renderer, call Graphicalview for us to generate a specific chart view, Let's do the show.

The above is my macro on the open source project some understanding, concrete implementation steps do not want to go into the deep to see, it is very difficult to understand, as long as we understand the whole project of the different classes of the role, to be proficient in the application, you can.

Summary: The structure of the entire project is very clear, responsible for the rendering of the class, is responsible for assembling the data class, and really responsible for the use of the settings in the rendering class and data classes in the data to draw the class.

Android Achartenginee explanation of the source framework

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.