11package com .vk59 .graphviewlibrary ;
22
3-
43import android .content .Context ;
54import android .graphics .Canvas ;
65import android .graphics .Color ;
1312import java .util .ArrayList ;
1413
1514
16-
17-
1815public class GraphView extends View {
1916 private ArrayList <GraphData > allGraphData = new ArrayList <>();
2017 private ArrayList <ArrayList <Moment >> moments = new ArrayList <>();
2118 private ArrayList <Integer > colors = new ArrayList <>();
2219 private ArrayList <String > labels = new ArrayList <>();
2320
24- private boolean drawing = false ;
2521 private boolean isInitialized = false ;
2622 private boolean isLegendEnable = true ;
27- private boolean isRemoved = false ;
23+ // private boolean isRemoved = false;
2824
2925 private String xName = "" ;
3026 private String yName = "" ;
@@ -70,10 +66,6 @@ private void minMaxInit(GraphData data) {
7066 }
7167 }
7268
73- private void setDrawing (boolean drawing ) {
74- this .drawing = drawing ;
75- }
76-
7769 public void addGraphData (GraphData data ) {
7870 moments .add (data .getData ());
7971 colors .add (data .getColor ());
@@ -83,7 +75,6 @@ public void addGraphData(GraphData data) {
8375 }
8476
8577 public void drawGraph () {
86- setDrawing (true );
8778 invalidate ();
8879 }
8980
@@ -105,7 +96,7 @@ public void removeGraphData(int index) {
10596 allGraphData .remove (index );
10697 colors .remove (index );
10798 labels .remove (index );
108- isRemoved = true ;
99+ // isRemoved = true;
109100 invalidate ();
110101 }
111102
@@ -114,7 +105,7 @@ public void removeAllGraphData() {
114105 moments .removeAll (moments );
115106 colors .removeAll (colors );
116107 labels .removeAll (labels );
117- isRemoved = true ;
108+ // isRemoved = true;
118109 invalidate ();
119110 }
120111
@@ -142,7 +133,6 @@ private void drawView(Canvas canvas) {
142133 setNoDataText (canvas );
143134 }
144135 } finally {
145- setDrawing (false );
146136 }
147137 }
148138 }
@@ -219,9 +209,7 @@ private void drawGraphs(Canvas canvas) {
219209 }
220210 }
221211
222-
223212 private void drawGrid (Canvas canvas ) {
224-
225213 Paint paintGrid = new Paint ();
226214 paintGrid .setColor (getResources ().getColor (R .color .grid ));
227215 paintGrid .setStrokeWidth (1f );
@@ -238,7 +226,6 @@ private void drawGrid(Canvas canvas) {
238226 }
239227 }
240228
241-
242229 private void drawText (Canvas canvas ) {
243230 int textSize = (int ) (padding * 0.5 );
244231 Paint paintTextHorizontal = new Paint ();
@@ -277,7 +264,6 @@ private void drawText(Canvas canvas) {
277264 }
278265
279266 private void drawNamesOfAxis (Canvas canvas ) {
280- // names of Axis
281267 int nameAxisSize = (int ) ((int ) padding * 0.7f );
282268
283269 Paint paintAxis = new Paint ();
@@ -366,6 +352,6 @@ private void getMinMaxValues() {
366352 if (graph .getMaxY () > maxY ) maxY = graph .getMaxY ();
367353 if (graph .getMinY () < minY ) minY = graph .getMinY ();
368354 }
369- isRemoved = false ;
355+ // isRemoved = false;
370356 }
371357}
0 commit comments