Commits

Chayoung You committed caffe51

Replace tab with 4 spaces

  • Participants
  • Parent commits 4fe5491

Comments (0)

Files changed (7)

File HoloGraphLibrary/src/com/echo/holographlibrary/Bar.java

 
 public class Bar {
     private int mColor = 0xFF33B5E5;
-	private int mLabelColor = -1;
+    private int mLabelColor = -1;
     private int mSelectedColor = 0x8033B5E5;
-	private String mName = null;
-	private float mValue;
-	private String mValueString = null;
-	private Path mPath = null;
-	private Region mRegion = null;
+    private String mName = null;
+    private float mValue;
+    private String mValueString = null;
+    private Path mPath = null;
+    private Region mRegion = null;
 
-	public int getColor() {
-		return mColor;
-	}
-	public void setColor(int color) {
-		this.mColor = color;
-	}
-	public int getLabelColor() {
-		return mLabelColor == -1 ? mColor : mLabelColor;
-	}
-	public void setLabelColor(int labelColor) {
-		this.mLabelColor = labelColor;
-	}
+    public int getColor() {
+        return mColor;
+    }
+    public void setColor(int color) {
+        this.mColor = color;
+    }
+    public int getLabelColor() {
+        return mLabelColor == -1 ? mColor : mLabelColor;
+    }
+    public void setLabelColor(int labelColor) {
+        this.mLabelColor = labelColor;
+    }
 
     public int getSelectedColor() {
         return mSelectedColor;
     }
 
     public String getName() {
-		return mName;
-	}
-	public void setName(String name) {
-		this.mName = name;
-	}
-	public float getValue() {
-		return mValue;
-	}
-	public void setValue(float value) {
-		this.mValue = value;
-	}
+        return mName;
+    }
+    public void setName(String name) {
+        this.mName = name;
+    }
+    public float getValue() {
+        return mValue;
+    }
+    public void setValue(float value) {
+        this.mValue = value;
+    }
 
-	public String getValueString()
-	{
-		if (mValueString != null) {
-			return mValueString;
-		} else {
-			return String.valueOf(mValue);
-		}
-	}
+    public String getValueString()
+    {
+        if (mValueString != null) {
+            return mValueString;
+        } else {
+            return String.valueOf(mValue);
+        }
+    }
 
-	public void setValueString(final String valueString)
-	{
-		mValueString = valueString;
-	}
+    public void setValueString(final String valueString)
+    {
+        mValueString = valueString;
+    }
 
-	public Path getPath() {
-		return mPath;
-	}
-	public void setPath(Path path) {
-		this.mPath = path;
-	}
-	public Region getRegion() {
-		return mRegion;
-	}
-	public void setRegion(Region region) {
-		this.mRegion = region;
-	}
+    public Path getPath() {
+        return mPath;
+    }
+    public void setPath(Path path) {
+        this.mPath = path;
+    }
+    public Region getRegion() {
+        return mRegion;
+    }
+    public void setRegion(Region region) {
+        this.mRegion = region;
+    }
 
 }

File HoloGraphLibrary/src/com/echo/holographlibrary/BarGraph.java

                 }
             }
             else if(event.getAction() == MotionEvent.ACTION_CANCEL)
-            	mIndexSelected = -1;
+                mIndexSelected = -1;
 
             count++;
         }
     @Override
     protected void onDetachedFromWindow()
     {
-    	if(mFullImage != null)
-    		mFullImage.recycle();
+        if(mFullImage != null)
+            mFullImage.recycle();
 
-    	super.onDetachedFromWindow();
+        super.onDetachedFromWindow();
     }
 
     public void setOnBarClickedListener(OnBarClickedListener listener) {

File HoloGraphLibrary/src/com/echo/holographlibrary/Line.java

 import java.util.ArrayList;
 
 public class Line {
-	private ArrayList<LinePoint> points = new ArrayList<LinePoint>();
-	private int color;
-	private boolean showPoints = true;
-	// 6 has been the default prior to the addition of custom stroke widths
-	private int strokeWidth = 6;
-	// since this is a new addition, it has to default to false to be backwards compatible
-	private boolean isUsingDips = false;
+    private ArrayList<LinePoint> points = new ArrayList<LinePoint>();
+    private int color;
+    private boolean showPoints = true;
+    // 6 has been the default prior to the addition of custom stroke widths
+    private int strokeWidth = 6;
+    // since this is a new addition, it has to default to false to be backwards compatible
+    private boolean isUsingDips = false;
 
 
-	public boolean isUsingDips() {
-		return isUsingDips;
-	}
-	public void setUsingDips(boolean treatSizesAsDips) {
-		this.isUsingDips = treatSizesAsDips;
-	}
-	public int getStrokeWidth() {
-		return strokeWidth;
-	}
-	public void setStrokeWidth(int strokeWidth) {
-		if (strokeWidth < 0) {
-			throw new IllegalArgumentException("strokeWidth must not be less than zero");
-		}
-		this.strokeWidth = strokeWidth;
-	}
-	public int getColor() {
-		return color;
-	}
-	public void setColor(int color) {
-		this.color = color;
-	}
-	public ArrayList<LinePoint> getPoints() {
-		return points;
-	}
-	public void setPoints(ArrayList<LinePoint> points) {
-		this.points = points;
-	}
-	public void addPoint(LinePoint point){
-		LinePoint p;
-		for(int i = 0; i < points.size(); i++){
-			p = points.get(i);
-			if(point.getX() < p.getX()){
-				points.add(i, point);
-				return;
-			}
-		}
-		points.add(point);
-	}
+    public boolean isUsingDips() {
+        return isUsingDips;
+    }
+    public void setUsingDips(boolean treatSizesAsDips) {
+        this.isUsingDips = treatSizesAsDips;
+    }
+    public int getStrokeWidth() {
+        return strokeWidth;
+    }
+    public void setStrokeWidth(int strokeWidth) {
+        if (strokeWidth < 0) {
+            throw new IllegalArgumentException("strokeWidth must not be less than zero");
+        }
+        this.strokeWidth = strokeWidth;
+    }
+    public int getColor() {
+        return color;
+    }
+    public void setColor(int color) {
+        this.color = color;
+    }
+    public ArrayList<LinePoint> getPoints() {
+        return points;
+    }
+    public void setPoints(ArrayList<LinePoint> points) {
+        this.points = points;
+    }
+    public void addPoint(LinePoint point){
+        LinePoint p;
+        for(int i = 0; i < points.size(); i++){
+            p = points.get(i);
+            if(point.getX() < p.getX()){
+                points.add(i, point);
+                return;
+            }
+        }
+        points.add(point);
+    }
 
-	public void removePoint(LinePoint point){
-		points.remove(point);
-	}
-	public LinePoint getPoint(int index){
-		return points.get(index);
-	}
+    public void removePoint(LinePoint point){
+        points.remove(point);
+    }
+    public LinePoint getPoint(int index){
+        return points.get(index);
+    }
 
-	public LinePoint getPoint(float x, float y){
-		LinePoint p;
-		for(int i = 0; i < points.size(); i++){
-			p = points.get(i);
-			if(p.getX() == x && p.getY() == y)
-				return p;
-		}
-		return null;
-	}
-	public int getSize(){
-		return points.size();
-	}
-	public boolean isShowingPoints() {
-		return showPoints;
-	}
-	public void setShowingPoints(boolean showPoints) {
-		this.showPoints = showPoints;
-	}
+    public LinePoint getPoint(float x, float y){
+        LinePoint p;
+        for(int i = 0; i < points.size(); i++){
+            p = points.get(i);
+            if(p.getX() == x && p.getY() == y)
+                return p;
+        }
+        return null;
+    }
+    public int getSize(){
+        return points.size();
+    }
+    public boolean isShowingPoints() {
+        return showPoints;
+    }
+    public void setShowingPoints(boolean showPoints) {
+        this.showPoints = showPoints;
+    }
 
 }

File HoloGraphLibrary/src/com/echo/holographlibrary/LineGraph.java

 
 public class LineGraph extends View {
 
-	private static final int DEFAULT_PADDING = 10;
+    private static final int DEFAULT_PADDING = 10;
     private final int dipPadding;
     private final int mFillColor;
     private final float mStrokeWidth;
     private final int mStrokeSpacing;
-	private ArrayList<Line> lines = new ArrayList<Line>();
-	Paint paint = new Paint();
-	private float minY = 0, minX = 0;
-	private float maxY = 0, maxX = 0;
-	private double rangeYRatio = 0;
-	private double rangeXRatio = 0;
-	private boolean isMaxXUserSet = false;
-	private int lineToFill = -1;
-	private int indexSelected = -1;
-	private OnPointClickedListener listener;
-	private Bitmap fullImage;
-	private boolean shouldUpdate = false;
-	// since this is a new addition, it has to default to false to be backwards compatible
-	private boolean isUsingDips;
-
-	public LineGraph(Context context){
-		this(context, null);
-	}
-
-	public LineGraph(Context context, AttributeSet attrs) {
-		this(context, attrs, 0);
-	}
+    private ArrayList<Line> lines = new ArrayList<Line>();
+    Paint paint = new Paint();
+    private float minY = 0, minX = 0;
+    private float maxY = 0, maxX = 0;
+    private double rangeYRatio = 0;
+    private double rangeXRatio = 0;
+    private boolean isMaxXUserSet = false;
+    private int lineToFill = -1;
+    private int indexSelected = -1;
+    private OnPointClickedListener listener;
+    private Bitmap fullImage;
+    private boolean shouldUpdate = false;
+    // since this is a new addition, it has to default to false to be backwards compatible
+    private boolean isUsingDips;
+
+    public LineGraph(Context context){
+        this(context, null);
+    }
+
+    public LineGraph(Context context, AttributeSet attrs) {
+        this(context, attrs, 0);
+    }
 
     public LineGraph(Context context, AttributeSet attrs, int defStyleAttr) {
         super(context, attrs, defStyleAttr);
     }
 
     public boolean isUsingDips() {
-		return isUsingDips;
-	}
-
-	public void setUsingDips(boolean treatSizesAsDips) {
-		this.isUsingDips = treatSizesAsDips;
-	}
-
-	public void removeAllLines(){
-		while (lines.size() > 0){
-			lines.remove(0);
-		}
-		shouldUpdate = true;
-		postInvalidate();
-	}
-
-	public void addLine(Line line) {
-		lines.add(line);
-		shouldUpdate = true;
-		postInvalidate();
-	}
-	public void addPointToLine(int lineIndex, double x, double y){
-		addPointToLine(lineIndex, (float) x, (float) y);
-	}
-	public void addPointToLine(int lineIndex, float x, float y){
-		LinePoint p = new LinePoint(x, y);
-
-		addPointToLine(lineIndex, p);
-	}
-
-	public double getRangeYRatio(){
-		return rangeYRatio;
-	}
-
-	public void setRangeYRatio(double rr){
-		this.rangeYRatio = rr;
-	}
-	public double getRangeXRatio(){
-		return rangeXRatio;
-	}
-
-	public void setRangeXRatio(double rr){
-		this.rangeXRatio = rr;
-	}
-	public void addPointToLine(int lineIndex, LinePoint point){
-		Line line = getLine(lineIndex);
-		line.addPoint(point);
-		lines.set(lineIndex, line);
-		resetLimits();
-		shouldUpdate = true;
-		postInvalidate();
-	}
-
-	public void addPointsToLine(int lineIndex, LinePoint[] points){
-		Line line = getLine(lineIndex);
-		for(LinePoint point : points){
-			line.addPoint(point);
-		}
-		lines.set(lineIndex, line);
-		resetLimits();
-		shouldUpdate = true;
-		postInvalidate();
-	}
-
-	public void removeAllPointsAfter(int lineIndex, double x){
-		removeAllPointsBetween(lineIndex, x, getMaxX());
-	}
-	public void removeAllPointsBefore(int lineIndex, double x){
-		removeAllPointsBetween(lineIndex, getMinX(), x);
-	}
-
-	public void removeAllPointsBetween(int lineIndex, double startX, double finishX){
-		Line line = getLine(lineIndex);
-		LinePoint[] pts = new LinePoint[line.getPoints().size()];
-		pts = line.getPoints().toArray(pts);
-		for(LinePoint point : pts){
-			if(point.getX() >= startX && point.getX() <= finishX)
-				line.removePoint(point);
-		}
-		lines.set(lineIndex, line);
-		resetLimits();
-		shouldUpdate = true;
-		postInvalidate();
-	}
-	public void removePointsFromLine(int lineIndex, LinePoint[] points){
-		Line line = getLine(lineIndex);
-		for(LinePoint point : points){
-			line.removePoint(point);
-		}
-		lines.set(lineIndex, line);
-		resetLimits();
-		shouldUpdate = true;
-		postInvalidate();
-	}
-	public void removePointFromLine(int lineIndex, float x, float y){
-		LinePoint p = null;
-		Line line = getLine(lineIndex);
-		p = line.getPoint(x, y);
-		removePointFromLine(lineIndex, p);
-	}
-	public void removePointFromLine(int lineIndex, LinePoint point){
-		Line line = getLine(lineIndex);
-		line.removePoint(point);
-		lines.set(lineIndex, line);
-		resetLimits();
-		shouldUpdate = true;
-		postInvalidate();
-	}
-
-	public void resetYLimits(){
-		float range = getMaxY() - getMinY();
-		setRangeY(getMinY()-range*getRangeYRatio(), getMaxY()+range*getRangeYRatio());
-	}
-	public void resetXLimits(){
-		float range = getMaxX() - getMinX();
-		setRangeX(getMinX()-range*getRangeXRatio(), getMaxX()+range*getRangeXRatio());
-	}
-	public void resetLimits() {
-		resetYLimits();
-		resetXLimits();
-	}
-	public ArrayList<Line> getLines() {
-		return lines;
-	}
-	public void setLineToFill(int indexOfLine) {
-		this.lineToFill = indexOfLine;
-		shouldUpdate = true;
-		postInvalidate();
-	}
-	public int getLineToFill(){
-		return lineToFill;
-	}
-	public void setLines(ArrayList<Line> lines) {
-		this.lines = lines;
-	}
-	public Line getLine(int index) {
-		return lines.get(index);
-	}
-	public int getSize(){
-		return lines.size();
-	}
-
-	public void setRangeY(float min, float max) {
-		minY = min;
-		maxY = max;
-	}
-	private void setRangeY(double min, double max){
-		minY = (float)min;
-		maxY = (float)max;
-	}
-	public void setRangeX(float min, float max) {
-		minX = min;
-		maxX = max;
-		isMaxXUserSet = true;
-	}
-	private void setRangeX(double min, double max){
-		minX = (float)min;
-		maxX = (float)max;
-	}
-	public float getMaxY(){
-		float max = lines.get(0).getPoint(0).getY();
-		for (Line line : lines){
-			for (LinePoint point : line.getPoints()){
-				max = point.getY() > max ? point.getY() : max;
-			}
-		}
-		maxY = max;
-		return maxY;
-	}
-
-	public float getMinY(){
-		float min = lines.get(0).getPoint(0).getY();
-		for (Line line : lines){
-			for (LinePoint point : line.getPoints()){
-				min = point.getY() < min ? point.getY() : min;
-			}
-		}
-		minY = min;
-		return minY;
-	}
-	public float getMinLimY(){
-		return minY;
-	}
-	public float getMaxLimY(){
-		return maxY;
-	}
-	public float getMinLimX(){
-		return minX;
-	}
-	public float getMaxLimX(){
-		if (isMaxXUserSet) {
-			return maxX;
-		}
-		else {
-			return getMaxX();
-		}
-	}
-	public float getMaxX(){
-		float max = lines.size() > 0 ? lines.get(0).getPoint(0).getX() : 0;
-		for (Line line : lines){
-			for (LinePoint point : line.getPoints()){
-				max = point.getX() > max ? point.getX() : max;
-			}
-		}
-		maxX = max;
-		return maxX;
-
-	}
-	public float getMinX(){
-		float min = lines.size() > 0 ? lines.get(0).getPoint(0).getX() : 0;
-		for (Line line : lines){
-			for (LinePoint point : line.getPoints()){
-				min = point.getX() < min ? point.getX() : min;
-			}
-		}
-		minX = min;
-		return minX;
-	}
-
-	public void onDraw(Canvas ca) {
-		if (fullImage == null || shouldUpdate) {
-			fullImage = Bitmap.createBitmap(getWidth(), getHeight(), Config.ARGB_8888);
-			Canvas canvas = new Canvas(fullImage);
-
-			paint.reset();
-			Path path = new Path();
-
-			float bottomPadding = 10, topPadding = 10;
-			float sidePadding = 10;
-			if (isUsingDips) {
-				bottomPadding = dipPadding;
-				topPadding = dipPadding;
-				sidePadding = dipPadding;
-			}
-			float usableHeight = getHeight() - bottomPadding - topPadding;
-			float usableWidth = getWidth() - 2*sidePadding;
-
-			float maxY = getMaxLimY();
-			float minY = getMinLimY();
-			float maxX = getMaxLimX();
-			float minX = getMinLimX();
-
-
-			int lineCount = 0;
-			for (Line line : lines){
-				int count = 0;
-				float lastXPixels = 0, newYPixels = 0;
-				float lastYPixels = 0, newXPixels = 0;
-
-				if (lineCount == lineToFill){
-					paint.setColor(mFillColor);
-					paint.setStrokeWidth(mStrokeWidth);
-					for (int i = 10; i-getWidth() < getHeight(); i = i+mStrokeSpacing){
-						canvas.drawLine(i, getHeight()-bottomPadding, 0, getHeight()-bottomPadding-i, paint);
-					}
-
-					paint.reset();
-
-					paint.setXfermode(new PorterDuffXfermode(android.graphics.PorterDuff.Mode.CLEAR));
-					for (LinePoint p : line.getPoints()){
-						float yPercent = (p.getY()-minY)/(maxY - minY);
-						float xPercent = (p.getX()-minX)/(maxX - minX);
-						if (count == 0){
-							lastXPixels = sidePadding + (xPercent*usableWidth);
-							lastYPixels = getHeight() - bottomPadding - (usableHeight*yPercent);
-							path.moveTo(lastXPixels, lastYPixels);
-						} else {
-							newXPixels = sidePadding + (xPercent*usableWidth);
-							newYPixels = getHeight() - bottomPadding - (usableHeight*yPercent);
-							path.lineTo(newXPixels, newYPixels);
-							Path pa = new Path();
-							pa.moveTo(lastXPixels, lastYPixels);
-							pa.lineTo(newXPixels, newYPixels);
-							pa.lineTo(newXPixels, 0);
-							pa.lineTo(lastXPixels, 0);
-							pa.close();
-							canvas.drawPath(pa, paint);
-							lastXPixels = newXPixels;
-							lastYPixels = newYPixels;
-						}
-						count++;
-					}
-
-					path.reset();
-
-					path.moveTo(0, getHeight()-bottomPadding);
-					path.lineTo(sidePadding, getHeight()-bottomPadding);
-					path.lineTo(sidePadding, 0);
-					path.lineTo(0, 0);
-					path.close();
-					canvas.drawPath(path, paint);
-
-					path.reset();
-
-					path.moveTo(getWidth(), getHeight()-bottomPadding);
-					path.lineTo(getWidth()-sidePadding, getHeight()-bottomPadding);
-					path.lineTo(getWidth()-sidePadding, 0);
-					path.lineTo(getWidth(), 0);
-					path.close();
-
-					canvas.drawPath(path, paint);
-
-				}
-
-				lineCount++;
-			}
-
-			paint.reset();
-
-			paint.setColor(Color.BLACK);
-			paint.setAlpha(50);
-			paint.setAntiAlias(true);
-			canvas.drawLine(sidePadding, getHeight() - bottomPadding, getWidth()-sidePadding, getHeight()-bottomPadding, paint);
-			paint.setAlpha(255);
-
-			for (Line line : lines){
-				int count = 0;
-				float lastXPixels = 0, newYPixels = 0;
-				float lastYPixels = 0, newXPixels = 0;
-
-				paint.setColor(line.getColor());
-				paint.setStrokeWidth(getStrokeWidth(line));
-
-				for (LinePoint p : line.getPoints()){
-					float yPercent = (p.getY()-minY)/(maxY - minY);
-					float xPercent = (p.getX()-minX)/(maxX - minX);
-					if (count == 0){
-						lastXPixels = sidePadding + (xPercent*usableWidth);
-						lastYPixels = getHeight() - bottomPadding - (usableHeight*yPercent);
-					} else {
-						newXPixels = sidePadding + (xPercent*usableWidth);
-						newYPixels = getHeight() - bottomPadding - (usableHeight*yPercent);
-						canvas.drawLine(lastXPixels, lastYPixels, newXPixels, newYPixels, paint);
-						lastXPixels = newXPixels;
-						lastYPixels = newYPixels;
-					}
-					count++;
-				}
-			}
-
-
-			int pointCount = 0;
-
-			for (Line line : lines){
-
-				paint.setColor(line.getColor());
-				paint.setStrokeWidth(getStrokeWidth(line));
-				paint.setStrokeCap(Paint.Cap.ROUND);
-
-				if (line.isShowingPoints()){
-					for (LinePoint p : line.getPoints()){
-						float yPercent = (p.getY()-minY)/(maxY - minY);
-						float xPercent = (p.getX()-minX)/(maxX - minX);
-						float xPixels = sidePadding + (xPercent*usableWidth);
-						float yPixels = getHeight() - bottomPadding - (usableHeight*yPercent);
-
-						int outerRadius;
-						if (line.isUsingDips()) {
-							outerRadius = getPixelForDip(line.getStrokeWidth() + 4);
-						}
-						else {
-							outerRadius = line.getStrokeWidth() + 4;
-						}
-						int innerRadius = outerRadius / 2;
-
-						paint.setColor(p.getColor());
-						canvas.drawCircle(xPixels, yPixels, outerRadius, paint);
-						paint.setColor(Color.WHITE);
-						canvas.drawCircle(xPixels, yPixels, innerRadius, paint);
-
-						Path path2 = new Path();
-						path2.addCircle(xPixels, yPixels, 30, Direction.CW);
-						p.setPath(path2);
-						p.setRegion(new Region((int)(xPixels-30), (int)(yPixels-30), (int)(xPixels+30), (int)(yPixels+30)));
-
-						if (indexSelected == pointCount && listener != null){
+        return isUsingDips;
+    }
+
+    public void setUsingDips(boolean treatSizesAsDips) {
+        this.isUsingDips = treatSizesAsDips;
+    }
+
+    public void removeAllLines(){
+        while (lines.size() > 0){
+            lines.remove(0);
+        }
+        shouldUpdate = true;
+        postInvalidate();
+    }
+
+    public void addLine(Line line) {
+        lines.add(line);
+        shouldUpdate = true;
+        postInvalidate();
+    }
+    public void addPointToLine(int lineIndex, double x, double y){
+        addPointToLine(lineIndex, (float) x, (float) y);
+    }
+    public void addPointToLine(int lineIndex, float x, float y){
+        LinePoint p = new LinePoint(x, y);
+
+        addPointToLine(lineIndex, p);
+    }
+
+    public double getRangeYRatio(){
+        return rangeYRatio;
+    }
+
+    public void setRangeYRatio(double rr){
+        this.rangeYRatio = rr;
+    }
+    public double getRangeXRatio(){
+        return rangeXRatio;
+    }
+
+    public void setRangeXRatio(double rr){
+        this.rangeXRatio = rr;
+    }
+    public void addPointToLine(int lineIndex, LinePoint point){
+        Line line = getLine(lineIndex);
+        line.addPoint(point);
+        lines.set(lineIndex, line);
+        resetLimits();
+        shouldUpdate = true;
+        postInvalidate();
+    }
+
+    public void addPointsToLine(int lineIndex, LinePoint[] points){
+        Line line = getLine(lineIndex);
+        for(LinePoint point : points){
+            line.addPoint(point);
+        }
+        lines.set(lineIndex, line);
+        resetLimits();
+        shouldUpdate = true;
+        postInvalidate();
+    }
+
+    public void removeAllPointsAfter(int lineIndex, double x){
+        removeAllPointsBetween(lineIndex, x, getMaxX());
+    }
+    public void removeAllPointsBefore(int lineIndex, double x){
+        removeAllPointsBetween(lineIndex, getMinX(), x);
+    }
+
+    public void removeAllPointsBetween(int lineIndex, double startX, double finishX){
+        Line line = getLine(lineIndex);
+        LinePoint[] pts = new LinePoint[line.getPoints().size()];
+        pts = line.getPoints().toArray(pts);
+        for(LinePoint point : pts){
+            if(point.getX() >= startX && point.getX() <= finishX)
+                line.removePoint(point);
+        }
+        lines.set(lineIndex, line);
+        resetLimits();
+        shouldUpdate = true;
+        postInvalidate();
+    }
+    public void removePointsFromLine(int lineIndex, LinePoint[] points){
+        Line line = getLine(lineIndex);
+        for(LinePoint point : points){
+            line.removePoint(point);
+        }
+        lines.set(lineIndex, line);
+        resetLimits();
+        shouldUpdate = true;
+        postInvalidate();
+    }
+    public void removePointFromLine(int lineIndex, float x, float y){
+        LinePoint p = null;
+        Line line = getLine(lineIndex);
+        p = line.getPoint(x, y);
+        removePointFromLine(lineIndex, p);
+    }
+    public void removePointFromLine(int lineIndex, LinePoint point){
+        Line line = getLine(lineIndex);
+        line.removePoint(point);
+        lines.set(lineIndex, line);
+        resetLimits();
+        shouldUpdate = true;
+        postInvalidate();
+    }
+
+    public void resetYLimits(){
+        float range = getMaxY() - getMinY();
+        setRangeY(getMinY()-range*getRangeYRatio(), getMaxY()+range*getRangeYRatio());
+    }
+    public void resetXLimits(){
+        float range = getMaxX() - getMinX();
+        setRangeX(getMinX()-range*getRangeXRatio(), getMaxX()+range*getRangeXRatio());
+    }
+    public void resetLimits() {
+        resetYLimits();
+        resetXLimits();
+    }
+    public ArrayList<Line> getLines() {
+        return lines;
+    }
+    public void setLineToFill(int indexOfLine) {
+        this.lineToFill = indexOfLine;
+        shouldUpdate = true;
+        postInvalidate();
+    }
+    public int getLineToFill(){
+        return lineToFill;
+    }
+    public void setLines(ArrayList<Line> lines) {
+        this.lines = lines;
+    }
+    public Line getLine(int index) {
+        return lines.get(index);
+    }
+    public int getSize(){
+        return lines.size();
+    }
+
+    public void setRangeY(float min, float max) {
+        minY = min;
+        maxY = max;
+    }
+    private void setRangeY(double min, double max){
+        minY = (float)min;
+        maxY = (float)max;
+    }
+    public void setRangeX(float min, float max) {
+        minX = min;
+        maxX = max;
+        isMaxXUserSet = true;
+    }
+    private void setRangeX(double min, double max){
+        minX = (float)min;
+        maxX = (float)max;
+    }
+    public float getMaxY(){
+        float max = lines.get(0).getPoint(0).getY();
+        for (Line line : lines){
+            for (LinePoint point : line.getPoints()){
+                max = point.getY() > max ? point.getY() : max;
+            }
+        }
+        maxY = max;
+        return maxY;
+    }
+
+    public float getMinY(){
+        float min = lines.get(0).getPoint(0).getY();
+        for (Line line : lines){
+            for (LinePoint point : line.getPoints()){
+                min = point.getY() < min ? point.getY() : min;
+            }
+        }
+        minY = min;
+        return minY;
+    }
+    public float getMinLimY(){
+        return minY;
+    }
+    public float getMaxLimY(){
+        return maxY;
+    }
+    public float getMinLimX(){
+        return minX;
+    }
+    public float getMaxLimX(){
+        if (isMaxXUserSet) {
+            return maxX;
+        }
+        else {
+            return getMaxX();
+        }
+    }
+    public float getMaxX(){
+        float max = lines.size() > 0 ? lines.get(0).getPoint(0).getX() : 0;
+        for (Line line : lines){
+            for (LinePoint point : line.getPoints()){
+                max = point.getX() > max ? point.getX() : max;
+            }
+        }
+        maxX = max;
+        return maxX;
+
+    }
+    public float getMinX(){
+        float min = lines.size() > 0 ? lines.get(0).getPoint(0).getX() : 0;
+        for (Line line : lines){
+            for (LinePoint point : line.getPoints()){
+                min = point.getX() < min ? point.getX() : min;
+            }
+        }
+        minX = min;
+        return minX;
+    }
+
+    public void onDraw(Canvas ca) {
+        if (fullImage == null || shouldUpdate) {
+            fullImage = Bitmap.createBitmap(getWidth(), getHeight(), Config.ARGB_8888);
+            Canvas canvas = new Canvas(fullImage);
+
+            paint.reset();
+            Path path = new Path();
+
+            float bottomPadding = 10, topPadding = 10;
+            float sidePadding = 10;
+            if (isUsingDips) {
+                bottomPadding = dipPadding;
+                topPadding = dipPadding;
+                sidePadding = dipPadding;
+            }
+            float usableHeight = getHeight() - bottomPadding - topPadding;
+            float usableWidth = getWidth() - 2*sidePadding;
+
+            float maxY = getMaxLimY();
+            float minY = getMinLimY();
+            float maxX = getMaxLimX();
+            float minX = getMinLimX();
+
+
+            int lineCount = 0;
+            for (Line line : lines){
+                int count = 0;
+                float lastXPixels = 0, newYPixels = 0;
+                float lastYPixels = 0, newXPixels = 0;
+
+                if (lineCount == lineToFill){
+                    paint.setColor(mFillColor);
+                    paint.setStrokeWidth(mStrokeWidth);
+                    for (int i = 10; i-getWidth() < getHeight(); i = i+mStrokeSpacing){
+                        canvas.drawLine(i, getHeight()-bottomPadding, 0, getHeight()-bottomPadding-i, paint);
+                    }
+
+                    paint.reset();
+
+                    paint.setXfermode(new PorterDuffXfermode(android.graphics.PorterDuff.Mode.CLEAR));
+                    for (LinePoint p : line.getPoints()){
+                        float yPercent = (p.getY()-minY)/(maxY - minY);
+                        float xPercent = (p.getX()-minX)/(maxX - minX);
+                        if (count == 0){
+                            lastXPixels = sidePadding + (xPercent*usableWidth);
+                            lastYPixels = getHeight() - bottomPadding - (usableHeight*yPercent);
+                            path.moveTo(lastXPixels, lastYPixels);
+                        } else {
+                            newXPixels = sidePadding + (xPercent*usableWidth);
+                            newYPixels = getHeight() - bottomPadding - (usableHeight*yPercent);
+                            path.lineTo(newXPixels, newYPixels);
+                            Path pa = new Path();
+                            pa.moveTo(lastXPixels, lastYPixels);
+                            pa.lineTo(newXPixels, newYPixels);
+                            pa.lineTo(newXPixels, 0);
+                            pa.lineTo(lastXPixels, 0);
+                            pa.close();
+                            canvas.drawPath(pa, paint);
+                            lastXPixels = newXPixels;
+                            lastYPixels = newYPixels;
+                        }
+                        count++;
+                    }
+
+                    path.reset();
+
+                    path.moveTo(0, getHeight()-bottomPadding);
+                    path.lineTo(sidePadding, getHeight()-bottomPadding);
+                    path.lineTo(sidePadding, 0);
+                    path.lineTo(0, 0);
+                    path.close();
+                    canvas.drawPath(path, paint);
+
+                    path.reset();
+
+                    path.moveTo(getWidth(), getHeight()-bottomPadding);
+                    path.lineTo(getWidth()-sidePadding, getHeight()-bottomPadding);
+                    path.lineTo(getWidth()-sidePadding, 0);
+                    path.lineTo(getWidth(), 0);
+                    path.close();
+
+                    canvas.drawPath(path, paint);
+
+                }
+
+                lineCount++;
+            }
+
+            paint.reset();
+
+            paint.setColor(Color.BLACK);
+            paint.setAlpha(50);
+            paint.setAntiAlias(true);
+            canvas.drawLine(sidePadding, getHeight() - bottomPadding, getWidth()-sidePadding, getHeight()-bottomPadding, paint);
+            paint.setAlpha(255);
+
+            for (Line line : lines){
+                int count = 0;
+                float lastXPixels = 0, newYPixels = 0;
+                float lastYPixels = 0, newXPixels = 0;
+
+                paint.setColor(line.getColor());
+                paint.setStrokeWidth(getStrokeWidth(line));
+
+                for (LinePoint p : line.getPoints()){
+                    float yPercent = (p.getY()-minY)/(maxY - minY);
+                    float xPercent = (p.getX()-minX)/(maxX - minX);
+                    if (count == 0){
+                        lastXPixels = sidePadding + (xPercent*usableWidth);
+                        lastYPixels = getHeight() - bottomPadding - (usableHeight*yPercent);
+                    } else {
+                        newXPixels = sidePadding + (xPercent*usableWidth);
+                        newYPixels = getHeight() - bottomPadding - (usableHeight*yPercent);
+                        canvas.drawLine(lastXPixels, lastYPixels, newXPixels, newYPixels, paint);
+                        lastXPixels = newXPixels;
+                        lastYPixels = newYPixels;
+                    }
+                    count++;
+                }
+            }
+
+
+            int pointCount = 0;
+
+            for (Line line : lines){
+
+                paint.setColor(line.getColor());
+                paint.setStrokeWidth(getStrokeWidth(line));
+                paint.setStrokeCap(Paint.Cap.ROUND);
+
+                if (line.isShowingPoints()){
+                    for (LinePoint p : line.getPoints()){
+                        float yPercent = (p.getY()-minY)/(maxY - minY);
+                        float xPercent = (p.getX()-minX)/(maxX - minX);
+                        float xPixels = sidePadding + (xPercent*usableWidth);
+                        float yPixels = getHeight() - bottomPadding - (usableHeight*yPercent);
+
+                        int outerRadius;
+                        if (line.isUsingDips()) {
+                            outerRadius = getPixelForDip(line.getStrokeWidth() + 4);
+                        }
+                        else {
+                            outerRadius = line.getStrokeWidth() + 4;
+                        }
+                        int innerRadius = outerRadius / 2;
+
+                        paint.setColor(p.getColor());
+                        canvas.drawCircle(xPixels, yPixels, outerRadius, paint);
+                        paint.setColor(Color.WHITE);
+                        canvas.drawCircle(xPixels, yPixels, innerRadius, paint);
+
+                        Path path2 = new Path();
+                        path2.addCircle(xPixels, yPixels, 30, Direction.CW);
+                        p.setPath(path2);
+                        p.setRegion(new Region((int)(xPixels-30), (int)(yPixels-30), (int)(xPixels+30), (int)(yPixels+30)));
+
+                        if (indexSelected == pointCount && listener != null){
                             paint.setColor(p.getSelectedColor());
-							canvas.drawPath(p.getPath(), paint);
-							paint.setAlpha(255);
-						}
-
-						pointCount++;
-					}
-				}
-			}
-
-			shouldUpdate = false;
-		}
-
-		ca.drawBitmap(fullImage, 0, 0, null);
-	}
-
-	private int getStrokeWidth(Line line) {
-		int strokeWidth;
-		if (line.isUsingDips()) {
-			strokeWidth = getPixelForDip(line.getStrokeWidth());
-		}
-		else {
-			strokeWidth = line.getStrokeWidth();
-		}
-		return strokeWidth;
-	}
-
-	private int getPixelForDip(int dipValue) {
-		return (int) TypedValue.applyDimension(
-				TypedValue.COMPLEX_UNIT_DIP,
-				dipValue,
-				getResources().getDisplayMetrics());
-	}
-
-	@Override
-	public boolean onTouchEvent(MotionEvent event) {
-
-	    Point point = new Point();
-	    point.x = (int) event.getX();
-	    point.y = (int) event.getY();
-
-	    int count = 0;
-	    int lineCount = 0;
-	    int pointCount = 0;
-
-	    Region r = new Region();
-	    for (Line line : lines){
-	    	pointCount = 0;
-	    	for (LinePoint p : line.getPoints()){
-
-	    		if (p.getPath() != null && p.getRegion() != null){
-	    			r.setPath(p.getPath(), p.getRegion());
-			    	if (r.contains((int)point.x,(int) point.y) && event.getAction() == MotionEvent.ACTION_DOWN){
-			    		indexSelected = count;
-			    	} else if (event.getAction() == MotionEvent.ACTION_UP){
-			    		if (r.contains((int)point.x,(int) point.y) && listener != null){
-			    			listener.onClick(lineCount, pointCount);
-			    		}
-			    		indexSelected = -1;
-			    	}
-	    		}
-
-		    	pointCount++;
-			    count++;
-	    	}
-	    	lineCount++;
-
-	    }
-
-	    if (event.getAction() == MotionEvent.ACTION_DOWN || event.getAction() == MotionEvent.ACTION_UP){
-	    	shouldUpdate = true;
-	    	postInvalidate();
-	    }
-
-
-
-	    return true;
-	}
-
-	public void setOnPointClickedListener(OnPointClickedListener listener) {
-		this.listener = listener;
-	}
-
-	public interface OnPointClickedListener {
-		abstract void onClick(int lineIndex, int pointIndex);
-	}
+                            canvas.drawPath(p.getPath(), paint);
+                            paint.setAlpha(255);
+                        }
+
+                        pointCount++;
+                    }
+                }
+            }
+
+            shouldUpdate = false;
+        }
+
+        ca.drawBitmap(fullImage, 0, 0, null);
+    }
+
+    private int getStrokeWidth(Line line) {
+        int strokeWidth;
+        if (line.isUsingDips()) {
+            strokeWidth = getPixelForDip(line.getStrokeWidth());
+        }
+        else {
+            strokeWidth = line.getStrokeWidth();
+        }
+        return strokeWidth;
+    }
+
+    private int getPixelForDip(int dipValue) {
+        return (int) TypedValue.applyDimension(
+                TypedValue.COMPLEX_UNIT_DIP,
+                dipValue,
+                getResources().getDisplayMetrics());
+    }
+
+    @Override
+    public boolean onTouchEvent(MotionEvent event) {
+
+        Point point = new Point();
+        point.x = (int) event.getX();
+        point.y = (int) event.getY();
+
+        int count = 0;
+        int lineCount = 0;
+        int pointCount = 0;
+
+        Region r = new Region();
+        for (Line line : lines){
+            pointCount = 0;
+            for (LinePoint p : line.getPoints()){
+
+                if (p.getPath() != null && p.getRegion() != null){
+                    r.setPath(p.getPath(), p.getRegion());
+                    if (r.contains((int)point.x,(int) point.y) && event.getAction() == MotionEvent.ACTION_DOWN){
+                        indexSelected = count;
+                    } else if (event.getAction() == MotionEvent.ACTION_UP){
+                        if (r.contains((int)point.x,(int) point.y) && listener != null){
+                            listener.onClick(lineCount, pointCount);
+                        }
+                        indexSelected = -1;
+                    }
+                }
+
+                pointCount++;
+                count++;
+            }
+            lineCount++;
+
+        }
+
+        if (event.getAction() == MotionEvent.ACTION_DOWN || event.getAction() == MotionEvent.ACTION_UP){
+            shouldUpdate = true;
+            postInvalidate();
+        }
+
+
+
+        return true;
+    }
+
+    public void setOnPointClickedListener(OnPointClickedListener listener) {
+        this.listener = listener;
+    }
+
+    public interface OnPointClickedListener {
+        abstract void onClick(int lineIndex, int pointIndex);
+    }
 }

File HoloGraphLibrary/src/com/echo/holographlibrary/LinePoint.java

 import android.graphics.Region;
 
 public class LinePoint {
-	private float mX = 0;
-	private float mY = 0;
-	private Path mPath;
-	private Region mRegion;
+    private float mX = 0;
+    private float mY = 0;
+    private Path mPath;
+    private Region mRegion;
     private int mColor = 0xFF000000;
     private int mSelectedColor = 0x8033B5E5;
 
     public LinePoint(){
     }
 
-	public LinePoint(double x, double y){
-		this.mX = (float)x;
-		this.mY = (float)y;
-	}
-	public LinePoint(float x, float y){
-		this.mX = x;
-		this.mY = y;
-	}
-	public float getX() {
-		return mX;
-	}
-	public void setX(float x) {
-		this.mX = x;
-	}
-	public float getY() {
-		return mY;
-	}
-	public void setY(float y) {
-		this.mY = y;
-	}
+    public LinePoint(double x, double y){
+        this.mX = (float)x;
+        this.mY = (float)y;
+    }
+    public LinePoint(float x, float y){
+        this.mX = x;
+        this.mY = y;
+    }
+    public float getX() {
+        return mX;
+    }
+    public void setX(float x) {
+        this.mX = x;
+    }
+    public float getY() {
+        return mY;
+    }
+    public void setY(float y) {
+        this.mY = y;
+    }
 
-	public void setX(double x){
-		this.mX = (float) x;
-	}
+    public void setX(double x){
+        this.mX = (float) x;
+    }
 
-	public void setY(double y){
-		this.mY = (float) y;
-	}
-	public Region getRegion() {
-		return mRegion;
-	}
-	public void setRegion(Region region) {
-		this.mRegion = region;
-	}
-	public Path getPath() {
-		return mPath;
-	}
-	public void setPath(Path path) {
-		this.mPath = path;
-	}
+    public void setY(double y){
+        this.mY = (float) y;
+    }
+    public Region getRegion() {
+        return mRegion;
+    }
+    public void setRegion(Region region) {
+        this.mRegion = region;
+    }
+    public Path getPath() {
+        return mPath;
+    }
+    public void setPath(Path path) {
+        this.mPath = path;
+    }
 
-	@Override
-	public String toString(){
-		return "x= " + mX + ", y= " + mY;
-	}
+    @Override
+    public String toString(){
+        return "x= " + mX + ", y= " + mY;
+    }
 
     public int getColor() {
         return mColor;

File HoloGraphLibrary/src/com/echo/holographlibrary/PieGraph.java

     private Paint mPaint = new Paint();
     private Path mPath = new Path();
     private int mSelectedIndex = -1;
-	private OnSliceClickedListener mListener;
-	private boolean mDrawCompleted = false;
+    private OnSliceClickedListener mListener;
+    private boolean mDrawCompleted = false;
 
-	public PieGraph(Context context) {
-		this(context, null);
-	}
+    public PieGraph(Context context) {
+        this(context, null);
+    }
 
     public PieGraph(Context context, AttributeSet attrs) {
         this(context, attrs, 0);
     }
 
     public PieGraph(Context context, AttributeSet attrs, int defStyle) {
-		super(context, attrs);
+        super(context, attrs);
 
         TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.PieGraph, 0, 0);
         mInnerCircleRatio = a.getInt(R.styleable.PieGraph_innerCircleRatio, 0);
         mPadding = a.getDimensionPixelSize(R.styleable.PieGraph_slicePadding, 0);
-	}
-
-	public void onDraw(Canvas canvas) {
-		canvas.drawColor(Color.TRANSPARENT);
-		mPaint.reset();
-		mPaint.setAntiAlias(true);
-		float midX, midY, radius, innerRadius;
-		mPath.reset();
-
-		float currentAngle = 270;
-		float currentSweep = 0;
-		int totalValue = 0;
-
-		midX = getWidth()/2;
-		midY = getHeight()/2;
-		if (midX < midY){
-			radius = midX;
-		} else {
-			radius = midY;
-		}
-		radius -= mPadding;
-		innerRadius = radius * mInnerCircleRatio / 255;
-
-		for (PieSlice slice : mSlices){
-			totalValue += slice.getValue();
-		}
-
-		int count = 0;
-		for (PieSlice slice : mSlices){
-			Path p = new Path();
+    }
+
+    public void onDraw(Canvas canvas) {
+        canvas.drawColor(Color.TRANSPARENT);
+        mPaint.reset();
+        mPaint.setAntiAlias(true);
+        float midX, midY, radius, innerRadius;
+        mPath.reset();
+
+        float currentAngle = 270;
+        float currentSweep = 0;
+        int totalValue = 0;
+
+        midX = getWidth()/2;
+        midY = getHeight()/2;
+        if (midX < midY){
+            radius = midX;
+        } else {
+            radius = midY;
+        }
+        radius -= mPadding;
+        innerRadius = radius * mInnerCircleRatio / 255;
+
+        for (PieSlice slice : mSlices){
+            totalValue += slice.getValue();
+        }
+
+        int count = 0;
+        for (PieSlice slice : mSlices){
+            Path p = new Path();
             if (mSelectedIndex == count && mListener != null){
                 mPaint.setColor(slice.getSelectedColor());
             }
             else {
                 mPaint.setColor(slice.getColor());
             }
-			currentSweep = (slice.getValue()/totalValue)*(360);
-			p.arcTo(new RectF(midX-radius, midY-radius, midX+radius, midY+radius),
+            currentSweep = (slice.getValue()/totalValue)*(360);
+            p.arcTo(new RectF(midX-radius, midY-radius, midX+radius, midY+radius),
                     currentAngle+mPadding, currentSweep - mPadding);
-			p.arcTo(new RectF(midX-innerRadius, midY-innerRadius, midX+innerRadius, midY+innerRadius),
+            p.arcTo(new RectF(midX-innerRadius, midY-innerRadius, midX+innerRadius, midY+innerRadius),
                     (currentAngle+mPadding) + (currentSweep - mPadding), -(currentSweep-mPadding));
-			p.close();
+            p.close();
 
-			slice.setPath(p);
-			slice.setRegion(new Region((int)(midX-radius), (int)(midY-radius),
+            slice.setPath(p);
+            slice.setRegion(new Region((int)(midX-radius), (int)(midY-radius),
                     (int)(midX+radius), (int)(midY+radius)));
-			canvas.drawPath(p, mPaint);
-			currentAngle = currentAngle+currentSweep;
-
-			count++;
-		}
-		mDrawCompleted = true;
-	}
-
-	@Override
-	public boolean onTouchEvent(MotionEvent event) {
-
-		if (mDrawCompleted) {
-
-			Point point = new Point();
-			point.x = (int) event.getX();
-			point.y = (int) event.getY();
-
-			int count = 0;
-			for (PieSlice slice : mSlices){
-				Region r = new Region();
-				r.setPath(slice.getPath(), slice.getRegion());
-				if (r.contains((int)point.x,(int) point.y) && event.getAction() == MotionEvent.ACTION_DOWN){
-					mSelectedIndex = count;
-				} else if (event.getAction() == MotionEvent.ACTION_UP){
-					if (r.contains((int)point.x,(int) point.y) && mListener != null){
-						if (mSelectedIndex > -1){
-							mListener.onClick(mSelectedIndex);
-						}
-						mSelectedIndex = -1;
-					}
-
-				}
-				else if(event.getAction() == MotionEvent.ACTION_CANCEL)
-					mSelectedIndex = -1;
-				count++;
-			}
-
-			if (event.getAction() == MotionEvent.ACTION_DOWN ||
+            canvas.drawPath(p, mPaint);
+            currentAngle = currentAngle+currentSweep;
+
+            count++;
+        }
+        mDrawCompleted = true;
+    }
+
+    @Override
+    public boolean onTouchEvent(MotionEvent event) {
+
+        if (mDrawCompleted) {
+
+            Point point = new Point();
+            point.x = (int) event.getX();
+            point.y = (int) event.getY();
+
+            int count = 0;
+            for (PieSlice slice : mSlices){
+                Region r = new Region();
+                r.setPath(slice.getPath(), slice.getRegion());
+                if (r.contains((int)point.x,(int) point.y) && event.getAction() == MotionEvent.ACTION_DOWN){
+                    mSelectedIndex = count;
+                } else if (event.getAction() == MotionEvent.ACTION_UP){
+                    if (r.contains((int)point.x,(int) point.y) && mListener != null){
+                        if (mSelectedIndex > -1){
+                            mListener.onClick(mSelectedIndex);
+                        }
+                        mSelectedIndex = -1;
+                    }
+
+                }
+                else if(event.getAction() == MotionEvent.ACTION_CANCEL)
+                    mSelectedIndex = -1;
+                count++;
+            }
+
+            if (event.getAction() == MotionEvent.ACTION_DOWN ||
                     event.getAction() == MotionEvent.ACTION_UP ||
                     event.getAction() == MotionEvent.ACTION_CANCEL){
-				postInvalidate();
-			}
-	    }
-	    return true;
-	}
-
-	public ArrayList<PieSlice> getSlices() {
-		return mSlices;
-	}
-
-	public void setSlices(ArrayList<PieSlice> slices) {
-		this.mSlices = slices;
-		postInvalidate();
-	}
-
-	public PieSlice getSlice(int index) {
-		return mSlices.get(index);
-	}
-
-	public void addSlice(PieSlice slice) {
-		this.mSlices.add(slice);
-		postInvalidate();
-	}
-
-	public void setOnSliceClickedListener(OnSliceClickedListener listener) {
-		this.mListener = listener;
-	}
-
-	public void removeSlices(){
-		for (int i = mSlices.size()-1; i >= 0; i--){
-			mSlices.remove(i);
-		}
-		postInvalidate();
-	}
-
-	public interface OnSliceClickedListener {
-		public abstract void onClick(int index);
-	}
+                postInvalidate();
+            }
+        }
+        return true;
+    }
+
+    public ArrayList<PieSlice> getSlices() {
+        return mSlices;
+    }
+
+    public void setSlices(ArrayList<PieSlice> slices) {
+        this.mSlices = slices;
+        postInvalidate();
+    }
+
+    public PieSlice getSlice(int index) {
+        return mSlices.get(index);
+    }
+
+    public void addSlice(PieSlice slice) {
+        this.mSlices.add(slice);
+        postInvalidate();
+    }
+
+    public void setOnSliceClickedListener(OnSliceClickedListener listener) {
+        this.mListener = listener;
+    }
+
+    public void removeSlices(){
+        for (int i = mSlices.size()-1; i >= 0; i--){
+            mSlices.remove(i);
+        }
+        postInvalidate();
+    }
+
+    public interface OnSliceClickedListener {
+        public abstract void onClick(int index);
+    }
 }

File HoloGraphLibrary/src/com/echo/holographlibrary/PieSlice.java

 import android.graphics.Region;
 
 public class PieSlice {
-	private int mColor = 0xFF33B5E5;
+    private int mColor = 0xFF33B5E5;
     private int mSelectedColor = 0x8033B5E5;
-	private float mValue;
-	private String mTitle;
-	private Path mPath;
-	private Region mRegion;
+    private float mValue;
+    private String mTitle;
+    private Path mPath;
+    private Region mRegion;
 
-	public String getTitle() {
-		return mTitle;
-	}
-	public void setTitle(String title) {
-		this.mTitle = title;
-	}
-	public int getColor() {
-		return mColor;
-	}
-	public void setColor(int color) {
-		this.mColor = color;
-	}
+    public String getTitle() {
+        return mTitle;
+    }
+    public void setTitle(String title) {
+        this.mTitle = title;
+    }
+    public int getColor() {
+        return mColor;
+    }
+    public void setColor(int color) {
+        this.mColor = color;
+    }
 
     public int getSelectedColor() {
         return mSelectedColor;
     }
 
     public float getValue() {
-		return mValue;
-	}
-	public void setValue(float value) {
-		this.mValue = value;
-	}
-	public Path getPath() {
-		return mPath;
-	}
-	public void setPath(Path path) {
-		this.mPath = path;
-	}
-	public Region getRegion() {
-		return mRegion;
-	}
-	public void setRegion(Region region) {
-		this.mRegion = region;
-	}
+        return mValue;
+    }
+    public void setValue(float value) {
+        this.mValue = value;
+    }
+    public Path getPath() {
+        return mPath;
+    }
+    public void setPath(Path path) {
+        this.mPath = path;
+    }
+    public Region getRegion() {
+        return mRegion;
+    }
+    public void setRegion(Region region) {
+        this.mRegion = region;
+    }
 
 }