Android Achartenginee interpretation of source code framework

Source: Internet
Author: User

From the last week to check out the source code of the Android Achartenginee, have been looking at how this thing is used, and how the bottom layer is realized, the recent week to understand this thing first sent up, that is, to do a summary, I also hope to help the children who want to learn this open source project. Then we'll cut to the chase.

What Android Achartenginee is, it's an open-source chart for Apache project, which is designed to make it easy for Android apps to draw that difficult chart, such as pie charts, graphs, histograms, and web-side high Chart similar, after mastering the project, just want us to assemble our data into the Achartenginee required format, and then call the corresponding API set the corresponding parameters, you can draw the chart you want to draw out, very powerful. Today, let's take a look at the overall architecture of project as I understand it.

First look at the code structure of the source project,

This is the structure of the whole project. The image package only has three images (skipped) used in the program. In the util package, some algorithm-related tool classes are mainly put in. See also don't understand very much. Tools are mainly used to control the entire chart to zoom out of the tool class, and do not explain, the main analysis of the chart, Renderer,model this package and chartfactory. Graphicalview of these two classes.

First, analysis of the role of renderer this package. First of all, the meaning of the word is the meaning of the rendering, from the literal meaning is probably able to know that the class under the package is mainly used to render the style of the chart. In other words, it is primarily used 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 classes that have seen the source code to know. Defaultrenderer is the parent class of Dialrenderer,xymultipleseriesrenderer, Simpleseriesrenderer is the parent of xyseriesrenderer, so we have two groups to explain.

1) Deaultrenderer and its subclasses renderer are rendered for the entire chart. That is to say: they are used to set the style of the entire chart, Defaultrenderer defines some common properties for all charts, such as Mcharttitle,mbackground. Specific properties can look at the source code, Dialrenderer is inherited from the Defaultrenderer class, in addition to those common attributes of the parent class, he other unique properties, Dialrenderer is mainly used to render pie chart renderer. For example: Different types of pie chart, column chart and so can use this renderer to do rendering; Xymultipleseriesrenderer also has the attributes of the parent class, and he himself has a lot of 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 father of Xyseriesrenderer, as I understand it. Both renderers render different effects for each point in detail, and simpleseriesrenderer is primarily used to render the points in a chart of a pie chart. The Xyseriesrenderer is the main point of the axis to render.

Two. Analyze the role of the model package, as seen in the class in the model package:

This package consists mainly of a collection of some chart points, different types of charts. We are going to use the corresponding object to load the set of points for different types. In: Categoryseries is the point set used to load the pie chart, and Multiplecategoryseries is the point set used to load the doughnut chart. Rangecategoryseries is a set of points used to load a histogram. Timeseries,xyseries,xyvalueseries is primarily used to load axis point sets. Xymultipleseriesdataset is a set of three points above (because there may be multiple images in our axes).


Three. Again analyze the function of the chart package, as seen in the classes in the chart package:

All of the classes in this package are the classes that are responsible for drawing the chart in detail, all of which provide different drawing methods for different charts. By the name of the class you can know that they are used to draw those charts. The details are 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 detailed chart view, Let's do the show.

This is my understanding of this open source project macro. Detailed implementation steps do not want to go deep to see, it is very difficult to understand. Just to understand the overall role of the different classes of project, can be skilled application, on the line.

Summary: The overall structure of project is very clear and is responsible for rendering the class. The class that is responsible for assembling the data. And a class that is really responsible for drawing by using the settings in the render class and the data in the data class.

Android Achartenginee Commentary source code framework interpretation

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.