├── .gitignore
├── Magnificent Chart Demo
├── .gitignore
├── Magnificent Chart Demo.iml
├── build.gradle
├── proguard-rules.txt
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── ic_launcher-web.png
│ ├── java
│ └── com
│ │ └── hornet
│ │ └── magnificentchartdemo
│ │ ├── MagnificentChart.java
│ │ ├── MagnificentChartItem.java
│ │ └── MainActivity.java
│ └── res
│ ├── drawable-hdpi
│ └── ic_launcher.png
│ ├── drawable-mdpi
│ └── ic_launcher.png
│ ├── drawable-xhdpi
│ └── ic_launcher.png
│ ├── drawable-xxhdpi
│ └── ic_launcher.png
│ ├── layout
│ └── activity_main.xml
│ ├── menu
│ └── main.xml
│ ├── values-w820dp
│ └── dimens.xml
│ └── values
│ ├── attrs.xml
│ ├── dimens.xml
│ ├── strings.xml
│ └── styles.xml
├── MagnificentChart.iml
├── MagnificentChartDemo.iml
├── README.md
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── local.properties
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | #built application files
2 | *.apk
3 | *.ap_
4 |
5 | # files for the dex VM
6 | *.dex
7 |
8 | # Java class files
9 | *.class
10 |
11 | # generated files
12 | bin/
13 | gen/
14 |
15 | # Local configuration file (sdk path, etc)
16 | local.properties
17 |
18 | # Windows thumbnail db
19 | Thumbs.db
20 |
21 | # OSX files
22 | .DS_Store
23 |
24 | # Eclipse project files
25 | .classpath
26 | .project
27 |
28 | # Android Studio
29 | .idea
30 | #.idea/workspace.xml - remove # and delete .idea if it better suit your needs.
31 | .gradle
32 | build/
33 |
--------------------------------------------------------------------------------
/Magnificent Chart Demo/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/Magnificent Chart Demo/Magnificent Chart Demo.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/Magnificent Chart Demo/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | mavenCentral()
4 | }
5 | dependencies {
6 | classpath 'com.android.tools.build:gradle:0.9.0'
7 | }
8 | }
9 | apply plugin: 'android'
10 |
11 | repositories {
12 | mavenCentral()
13 | }
14 |
15 | android {
16 | compileSdkVersion 14
17 | buildToolsVersion "19.1.0"
18 |
19 | defaultConfig {
20 | minSdkVersion 14
21 | targetSdkVersion 14
22 | versionCode 1
23 | versionName "1.0"
24 | }
25 | buildTypes {
26 | release {
27 | runProguard false
28 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
29 | }
30 | }
31 | }
32 |
33 | dependencies {
34 | }
35 |
--------------------------------------------------------------------------------
/Magnificent Chart Demo/proguard-rules.txt:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Applications/Android Studio.app/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the ProGuard
5 | # include property in project.properties.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
--------------------------------------------------------------------------------
/Magnificent Chart Demo/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
10 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Magnificent Chart Demo/src/main/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Geek-1001/MagnificentChart/10a5cb404cc3c530234e267b909e28e35cbf3c2e/Magnificent Chart Demo/src/main/ic_launcher-web.png
--------------------------------------------------------------------------------
/Magnificent Chart Demo/src/main/java/com/hornet/magnificentchartdemo/MagnificentChart.java:
--------------------------------------------------------------------------------
1 | package com.hornet.magnificentchartdemo;
2 |
3 | import android.content.Context;
4 | import android.content.res.TypedArray;
5 | import android.graphics.Canvas;
6 | import android.graphics.Color;
7 | import android.graphics.Paint;
8 | import android.graphics.Path;
9 | import android.graphics.Point;
10 | import android.graphics.RectF;
11 | import android.graphics.Typeface;
12 | import android.util.AttributeSet;
13 | import android.util.Log;
14 | import android.view.Display;
15 | import android.view.View;
16 | import android.view.WindowManager;
17 |
18 | import java.util.List;
19 |
20 | /**
21 | * Created by Ahmed on 30.01.14.
22 | */
23 | public class MagnificentChart extends View {
24 |
25 | // #MARK - Constants
26 |
27 | // default initialization params
28 | public static final float ANIMATION_SPEED_DEFAULT = 6.5f;
29 | public static final float ANIMATION_SPEED_SLOW = 1.0f;
30 | public static final float ANIMATION_SPEED_FAST = 10.0f;
31 | public static final float ANIMATION_SPEED_NORMAL = 3.5f;
32 |
33 | // view properties
34 | private List chartItemsList;
35 | private int maxValue;
36 | private boolean isTitleShowing;
37 | private boolean isAnimated;
38 | private boolean isRound;
39 | private boolean isShadowShowing;
40 | private int shadowBackgroundColor;
41 | private int chartBackgroundColor;
42 | private Context context;
43 | private Typeface typeface = null;
44 | private int width;
45 | private int height;
46 | private float animationSpeed = 6.5f;
47 |
48 | private float globalCurrentAngle = 0.0f;
49 |
50 |
51 |
52 | // #MARK - Constructors
53 |
54 | public MagnificentChart(Context context) {
55 | super(context);
56 | init(context, null, 0, false, false, true, false, Color.parseColor("#DDDDDD"), Color.parseColor("#FFFFFF"));
57 | }
58 |
59 | public MagnificentChart(Context context, List itemsList, int maxValue){
60 | super(context);
61 | init(context, itemsList, maxValue, false, false, true, false, Color.parseColor("#DDDDDD"), Color.parseColor("#FFFFFF"));
62 | }
63 |
64 | public MagnificentChart(Context context, List itemsList, int maxValue, boolean isAnimated, boolean isRound, boolean showShadow, boolean showTitle){
65 | super(context);
66 | init(context, itemsList, maxValue, isAnimated, isRound, showShadow, showTitle, Color.parseColor("#DDDDDD"), Color.parseColor("#FFFFFF"));
67 | }
68 |
69 | public MagnificentChart(Context context, AttributeSet attrs) {
70 | super(context, attrs);
71 |
72 | TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs, R.styleable.MagnificentChart, 0, 0);
73 | try {
74 | boolean isAnimated = typedArray.getBoolean(R.styleable.MagnificentChart_animation, false);
75 | boolean isRound = typedArray.getBoolean(R.styleable.MagnificentChart_round, false);
76 | boolean showShadow = typedArray.getBoolean(R.styleable.MagnificentChart_shadow, true);
77 | boolean showTitle = typedArray.getBoolean(R.styleable.MagnificentChart_showTitle, false);
78 | int shadowColor = typedArray.getColor(R.styleable.MagnificentChart_shadowColor, Color.parseColor("#F2F2F2"));
79 | int backgroundColor = typedArray.getColor(R.styleable.MagnificentChart_background, Color.parseColor("#FFFFFF"));
80 |
81 | init(context, null, 0, isAnimated, isRound, showShadow, showTitle, shadowColor, backgroundColor);
82 | } finally {
83 | typedArray.recycle();
84 | }
85 | }
86 |
87 | // #MARK - Override class methods
88 |
89 | @Override
90 | protected void onDraw(Canvas canvas){
91 | super.onDraw(canvas);
92 | canvas.save();
93 | if(width != height){
94 | return;
95 | }
96 |
97 | if(this.isAnimated){
98 | animatedDraw(canvas);
99 | } else {
100 | regularDraw(canvas);
101 | }
102 |
103 | canvas.restore();
104 | }
105 |
106 | @Override
107 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec){
108 | setMeasuredDimension(measureWidth(widthMeasureSpec), measureHeight(heightMeasureSpec));
109 | }
110 |
111 | @Override
112 | protected void onSizeChanged (int width, int height, int oldWidth, int oldHeight){
113 | this.width = width;
114 | this.height = height;
115 | }
116 |
117 | // #MARK - Custom methods
118 |
119 | private void init(Context context, List itemsList, int maxValue, boolean isAnimated, boolean isRound, boolean showShadow, boolean showTitle, int shadowColor, int backgroundColor){
120 | this.context = context;
121 | this.chartItemsList = itemsList;
122 | this.isAnimated = isAnimated;
123 | this.isRound = isRound;
124 | this.isShadowShowing = showShadow;
125 | this.shadowBackgroundColor = shadowColor;
126 | this.chartBackgroundColor = backgroundColor;
127 | this.maxValue = maxValue;
128 | this.isTitleShowing = showTitle;
129 | }
130 |
131 | private int measureWidth(int widthMeasureSpec){
132 | int result = 0;
133 | int specMode = MeasureSpec.getMode(widthMeasureSpec);
134 | int specSize = MeasureSpec.getSize(widthMeasureSpec);
135 | WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
136 | Display display = windowManager.getDefaultDisplay();
137 | Point size = new Point();
138 | display.getSize(size);
139 | int screenWidth = size.x;
140 | if(specMode == MeasureSpec.EXACTLY){
141 | result = specSize;
142 | } else {
143 | result = screenWidth;
144 | if(specMode == MeasureSpec.AT_MOST){
145 | result = Math.min(result, specSize);
146 | }
147 | }
148 | this.width = result;
149 | return result;
150 | }
151 |
152 | private int measureHeight(int heightMeasureSpec){
153 | int result = 0;
154 | int specMode = MeasureSpec.getMode(heightMeasureSpec);
155 | int specSize = MeasureSpec.getSize(heightMeasureSpec);
156 | WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
157 | Display display = windowManager.getDefaultDisplay();
158 | Point size = new Point();
159 | display.getSize(size);
160 | int screenHeight = size.y;
161 | if(specMode == MeasureSpec.EXACTLY){
162 | result = specSize;
163 | } else {
164 | result = screenHeight;
165 | if(specMode == MeasureSpec.AT_MOST){
166 | result = Math.min(result, specSize);
167 | }
168 | }
169 | this.height = result;
170 | return result;
171 | }
172 |
173 |
174 | public void setAnimationState(boolean state){
175 | this.isAnimated = state;
176 | invalidate();
177 | }
178 |
179 | public void setAnimationSpeed(float animationSpeed){ // use just value ANIMATION_SPEED_... from current class
180 | if(animationSpeed == ANIMATION_SPEED_DEFAULT || animationSpeed == ANIMATION_SPEED_SLOW || animationSpeed == ANIMATION_SPEED_FAST || animationSpeed == ANIMATION_SPEED_NORMAL){
181 | this.animationSpeed = animationSpeed;
182 | } else {
183 | this.animationSpeed = ANIMATION_SPEED_DEFAULT;
184 | }
185 | invalidate();
186 | }
187 |
188 | public void setRound(boolean state){
189 | this.isRound = state;
190 | invalidate();
191 | }
192 |
193 | public void setShadowShowingState(boolean state){
194 | this.isShadowShowing = state;
195 | invalidate();
196 | }
197 |
198 | public boolean getAnimationState(){
199 | return this.isAnimated;
200 | }
201 |
202 | public boolean getRound(){
203 | return this.isRound;
204 | }
205 |
206 | public boolean getShadowShowingState(){
207 | return this.isShadowShowing;
208 | }
209 |
210 | public void setTitleShowingState(boolean state){
211 | this.isTitleShowing = state;
212 | invalidate();
213 | }
214 |
215 | public void setTypeface(Typeface typeface){
216 | this.typeface = typeface;
217 | invalidate();
218 | }
219 |
220 | public void setChartItemsList(List itemsList){
221 | this.chartItemsList = itemsList;
222 | invalidate();
223 | }
224 |
225 | public void setShadowBackgroundColor(int color){
226 | this.shadowBackgroundColor = color;
227 | invalidate();
228 | }
229 |
230 | public void setChartBackgroundColor(int color){
231 | this.chartBackgroundColor = color;
232 | invalidate();
233 | }
234 |
235 | public void setMaxValue(int maxValue){
236 | this.maxValue = maxValue;
237 | invalidate();
238 | }
239 |
240 | private float getPercent(int value, int maxValue){
241 | float result = (float) value/maxValue;
242 | return result;
243 | }
244 |
245 | // #MARK - Drawing Methods
246 |
247 | private void regularDraw(Canvas canvas){
248 | Paint insideShadowPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
249 | insideShadowPaint.setColor(shadowBackgroundColor);
250 | Paint insideChartPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
251 | insideChartPaint.setColor(chartBackgroundColor);
252 | RectF rect = new RectF();
253 | rect.set(10, 10, width - 10, height - 10);
254 | drawMainCircle(canvas, insideShadowPaint, insideChartPaint, rect);
255 | canvas.rotate(-90f, rect.centerX(), rect.centerY());
256 |
257 | if(this.chartItemsList != null && this.maxValue > 0){
258 | drawItems(canvas, rect);
259 | canvas.rotate(90f, rect.centerX(), rect.centerY());
260 | drawInsideCircle(canvas, insideShadowPaint, insideChartPaint);
261 | }
262 | }
263 |
264 | private void animatedDraw(Canvas canvas){
265 | Paint insideShadowPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
266 | insideShadowPaint.setColor(shadowBackgroundColor);
267 | Paint insideChartPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
268 | insideChartPaint.setColor(chartBackgroundColor);
269 | RectF rect = new RectF();
270 | rect.set(10, 10, width - 10, height - 10);
271 | drawMainCircle(canvas, insideShadowPaint, insideChartPaint, rect);
272 | canvas.rotate(-90f, rect.centerX(), rect.centerY());
273 |
274 | if(chartItemsList != null && maxValue > 0){
275 | drawItems(canvas, rect);
276 |
277 | Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
278 | paint.setColor(chartBackgroundColor);
279 | RectF oval = new RectF();
280 | oval.set(8, 8, width - 8, height - 8);
281 | Path path = new Path();
282 | path.moveTo(oval.centerX(), oval.centerY());
283 | path.addArc(oval, globalCurrentAngle, 360.0f - globalCurrentAngle);
284 | path.lineTo(oval.centerX(), oval.centerY());
285 |
286 | canvas.drawPath(path, paint);
287 | globalCurrentAngle += animationSpeed; // <-- animation speed
288 |
289 | canvas.rotate(90f, rect.centerX(), rect.centerY());
290 | if(!isRound){
291 | if(isShadowShowing){
292 | canvas.drawCircle(width/2, height/2, width/4 - 10, insideShadowPaint);
293 | }
294 | canvas.drawCircle(width/2, height/2, width/4 - 20, insideChartPaint);
295 | }
296 |
297 | if(globalCurrentAngle >= 360){
298 | globalCurrentAngle = 0.0f;
299 | canvas.rotate(-90f, rect.centerX(), rect.centerY());
300 | drawItems(canvas, rect);
301 | canvas.rotate(90f, rect.centerX(), rect.centerY());
302 | drawInsideCircle(canvas, insideShadowPaint, insideChartPaint);
303 | return;
304 | }
305 | invalidate();
306 | }
307 | }
308 |
309 | private void drawInsideCircle(Canvas canvas, Paint insideShadowPaint, Paint insideChartPaint){
310 | if(!isRound){
311 | if(isShadowShowing){
312 | canvas.drawCircle(width/2, height/2, width/4 - 10, insideShadowPaint);
313 | }
314 | canvas.drawCircle(width/2, height/2, width/4 - 20, insideChartPaint);
315 | }
316 | }
317 |
318 | private void drawMainCircle(Canvas canvas, Paint insideShadowPaint, Paint insideChartPaint, RectF mainRectangle){
319 | if(isShadowShowing){
320 | canvas.drawCircle(width/2, height/2, width/2, insideShadowPaint);
321 | }
322 | canvas.drawArc(mainRectangle, 0f, 360f, true, insideChartPaint);
323 | }
324 |
325 | private void drawItems(Canvas canvas, RectF mainRectangle){
326 | float startAngle = 0f;
327 | float anglesSum = 0f;
328 | Paint currentPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
329 | for(int i = 0; i < chartItemsList.size(); ++i){
330 | MagnificentChartItem currentItem = chartItemsList.get(i);
331 | int color = currentItem.color;
332 | String title = currentItem.title;
333 | int value = currentItem.value;
334 | float currentPercentValue = getPercent(value, maxValue);
335 | float currentAngle = currentPercentValue * 360;
336 | anglesSum += currentAngle;
337 | currentPaint.setColor(color);
338 | canvas.drawArc(mainRectangle, startAngle, currentAngle, true, currentPaint);
339 | startAngle += currentAngle;
340 | }
341 | }
342 |
343 | }
344 |
--------------------------------------------------------------------------------
/Magnificent Chart Demo/src/main/java/com/hornet/magnificentchartdemo/MagnificentChartItem.java:
--------------------------------------------------------------------------------
1 | package com.hornet.magnificentchartdemo;
2 |
3 | /**
4 | * Created by Ahmed on 30.01.14.
5 | */
6 | public class MagnificentChartItem {
7 |
8 | // #MARK - Constants
9 |
10 | public int color;
11 | public int value;
12 | public String title;
13 |
14 | // #MARK - Constructors
15 |
16 | MagnificentChartItem(String title, int value, int color){
17 | this.color = color;
18 | this.value = value;
19 | this.title = title;
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/Magnificent Chart Demo/src/main/java/com/hornet/magnificentchartdemo/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.hornet.magnificentchartdemo;
2 |
3 | import android.app.Activity;
4 | import android.app.ActionBar;
5 | import android.app.Fragment;
6 | import android.graphics.Color;
7 | import android.os.Bundle;
8 | import android.view.LayoutInflater;
9 | import android.view.Menu;
10 | import android.view.MenuItem;
11 | import android.view.View;
12 | import android.view.ViewGroup;
13 | import android.os.Build;
14 |
15 | import java.util.ArrayList;
16 | import java.util.List;
17 |
18 | public class MainActivity extends Activity {
19 |
20 | MagnificentChart magnificentChart;
21 |
22 | @Override
23 | protected void onCreate(Bundle savedInstanceState) {
24 | super.onCreate(savedInstanceState);
25 | setContentView(R.layout.activity_main);
26 |
27 | MagnificentChartItem firstItem = new MagnificentChartItem("first", 30, Color.parseColor("#BAF0A2"));
28 | MagnificentChartItem secondItem = new MagnificentChartItem("second", 12, Color.parseColor("#2F6994"));
29 | MagnificentChartItem thirdItem = new MagnificentChartItem("third", 3, Color.parseColor("#FF6600"));
30 | MagnificentChartItem fourthItem = new MagnificentChartItem("fourth", 41, Color.parseColor("#800080"));
31 | MagnificentChartItem fifthItem = new MagnificentChartItem("fifth", 14, Color.parseColor("#708090"));
32 |
33 | List chartItemsList = new ArrayList();
34 | chartItemsList.add(firstItem);
35 | chartItemsList.add(secondItem);
36 | chartItemsList.add(thirdItem);
37 | chartItemsList.add(fourthItem);
38 | chartItemsList.add(fifthItem);
39 |
40 | magnificentChart = (MagnificentChart) findViewById(R.id.magnificentChart);
41 |
42 | magnificentChart.setChartItemsList(chartItemsList);
43 | magnificentChart.setMaxValue(100);
44 |
45 | }
46 |
47 | public void onClick(View view){
48 | switch(view.getId()){
49 | case R.id.animationButton:
50 | if(magnificentChart.getAnimationState()){
51 | magnificentChart.setAnimationState(false);
52 | } else {
53 | magnificentChart.setAnimationState(true);
54 | }
55 | break;
56 |
57 | case R.id.roundButton:
58 | if(magnificentChart.getRound()){
59 | magnificentChart.setRound(false);
60 | } else {
61 | magnificentChart.setRound(true);
62 | }
63 | break;
64 |
65 | case R.id.shadowButton:
66 | if(magnificentChart.getShadowShowingState()){
67 | magnificentChart.setShadowShowingState(false);
68 | } else {
69 | magnificentChart.setShadowShowingState(true);
70 | }
71 | break;
72 |
73 | case R.id.animationSpeedDefault:
74 | magnificentChart.setAnimationSpeed(MagnificentChart.ANIMATION_SPEED_DEFAULT);
75 | break;
76 |
77 | case R.id.animationSpeedSlow:
78 | magnificentChart.setAnimationSpeed(MagnificentChart.ANIMATION_SPEED_SLOW);
79 | break;
80 |
81 | case R.id.animationSpeedFast:
82 | magnificentChart.setAnimationSpeed(MagnificentChart.ANIMATION_SPEED_FAST);
83 | break;
84 |
85 | case R.id.animationSpeedNormal:
86 | magnificentChart.setAnimationSpeed(MagnificentChart.ANIMATION_SPEED_NORMAL);
87 | break;
88 | }
89 | }
90 |
91 |
92 | @Override
93 | public boolean onCreateOptionsMenu(Menu menu) {
94 | getMenuInflater().inflate(R.menu.main, menu);
95 | return true;
96 | }
97 |
98 | @Override
99 | public boolean onOptionsItemSelected(MenuItem item) {
100 | int id = item.getItemId();
101 | if (id == R.id.action_settings) {
102 | return true;
103 | }
104 | return super.onOptionsItemSelected(item);
105 | }
106 |
107 | }
108 |
--------------------------------------------------------------------------------
/Magnificent Chart Demo/src/main/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Geek-1001/MagnificentChart/10a5cb404cc3c530234e267b909e28e35cbf3c2e/Magnificent Chart Demo/src/main/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Magnificent Chart Demo/src/main/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Geek-1001/MagnificentChart/10a5cb404cc3c530234e267b909e28e35cbf3c2e/Magnificent Chart Demo/src/main/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Magnificent Chart Demo/src/main/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Geek-1001/MagnificentChart/10a5cb404cc3c530234e267b909e28e35cbf3c2e/Magnificent Chart Demo/src/main/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Magnificent Chart Demo/src/main/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Geek-1001/MagnificentChart/10a5cb404cc3c530234e267b909e28e35cbf3c2e/Magnificent Chart Demo/src/main/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Magnificent Chart Demo/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
13 |
14 |
19 |
20 |
26 |
27 |
33 |
34 |
40 |
41 |
47 |
48 |
54 |
55 |
61 |
62 |
68 |
69 |
70 |
71 |
72 |
73 |
84 |
85 |
86 |
87 |
88 |
--------------------------------------------------------------------------------
/Magnificent Chart Demo/src/main/res/menu/main.xml:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/Magnificent Chart Demo/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/Magnificent Chart Demo/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Magnificent Chart Demo/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Magnificent Chart Demo/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | MagnificentChartDemo
5 | Hello world!
6 | Settings
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Magnificent Chart Demo/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/MagnificentChart.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/MagnificentChartDemo.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | #MagnificentChart
2 |
3 | Simple open source Android library for round charts.
4 |
5 |
6 |
7 |
8 |
9 | ##Usage:
10 |
11 | ###Step 1
12 |
13 | declare MagnificentChart in your xml layout
14 |
15 |
24 |
25 |
26 | ###Step 2
27 |
28 | Find object in your Activity/Fragment
29 |
30 | MagnificentChart magnificentChart = (MagnificentChart) findViewById(R.id.magnificentChart);
31 |
32 |
33 | ###Step 3
34 |
35 | Create segments for diagram and set them to List\
36 |
37 | MagnificentChartItem firstItem = new MagnificentChartItem("first", 23, Color.parseColor("#BAF0A2"));
38 | List chartItemsList = new ArrayList();
39 | chartItemsList.add(firstItem);
40 |
41 | ###Step 4
42 |
43 | Set chart items to MagnificentChart object.
44 | And set max value for chart.
45 |
46 | magnificentChart.setChartItemsList(chartItemsList);
47 | magnificentChart.setMaxValue(100);
48 |
49 | ###Step 5
50 |
51 | Enjoy!
52 |
53 |
54 | ##Implementation:
55 |
56 | ###Step 1
57 |
58 | Copy **MagnificentCgart** and **MagnificentChartItem** classes into your project.
59 | ###Step 2
60 |
61 | Change packages name.
62 |
63 | ###Step 3
64 |
65 | In **/value/attr** file
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 | ###Step 4
76 |
77 | Enjoy!
78 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 | buildscript {
3 | repositories {
4 | jcenter()
5 | }
6 | dependencies {
7 | classpath 'com.android.tools.build:gradle:0.12.+'
8 |
9 | // NOTE: Do not place your application dependencies here; they belong
10 | // in the individual module build.gradle files
11 | }
12 | }
13 |
14 | allprojects {
15 | repositories {
16 | jcenter()
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Settings specified in this file will override any Gradle settings
5 | # configured through the IDE.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Geek-1001/MagnificentChart/10a5cb404cc3c530234e267b909e28e35cbf3c2e/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Apr 10 15:27:10 PDT 2013
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/local.properties:
--------------------------------------------------------------------------------
1 | ## This file is automatically generated by Android Studio.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file should *NOT* be checked into Version Control Systems,
5 | # as it contains information specific to your local configuration.
6 | #
7 | # Location of the SDK. This is only used by Gradle.
8 | # For customization when using a Version Control System, please read the
9 | # header note.
10 | sdk.dir=/Applications/Android Studio.app/sdk
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':Magnificent Chart Demo'
2 |
--------------------------------------------------------------------------------