Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilJay committed May 8, 2014
1 parent a484bc7 commit 0fda41e
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,50 @@ Features
- Animated drawing (bar representig the value fills up animated)

![alt tag](https://raw.github.com/PhilJay/MPChart/master/screenshots/demo.png)

Usage
=======

Simply **copy the CircleDisplay.java** file into your project.
For using the <code>CircleDisplay</code>, define it in .xml:
```xml
<com.philjay.circledisplay.CircleDisplay
android:id="@+id/circleDisplay"
android:layout_width="match_parent"
android:layout_height="match_parent" />
```
```java
CircleDisplay cd = (CircleDisplay) findViewById(R.id.circleDisplay);
```

or create it in code:
```java
CircleDisplay cd = new CircleDisplay(Context);
```

**Style** your <code>CircleDisplay</code>, and **show values**.

**Styling methods:**

- <code>setColor(int color)</code>: Use this method to set the color for the arc/bar that represents the value.
- <code>setStartAngle(float angle)</code>: Set the starting angle of your arc/bar. By default, it starts at the top of the view (270°).
- <code>setAnimDuration(int millis)</code>: Set the duration in milliseconds it takes to animate/build up the bar.
- <code>setTextSize(float size)</code>: Set the size of the text in the center of the view.
- <code>setValueWidthPercent(float percentFromTotalWidth)</code>: Set the width of the value bar/arc in percent of the circle radius.
-
**Showing values:**

- <code>public void showValue(float toShow, float total, boolean animated)</code>: Shows the given value. A maximumvalue also needs to be provided. Set animated to true to animate the displaying of the value.
- <code>public void showPercentage(float percentage, boolean animated)</code>: Shows the given percentage value. Set animated to true to animate the displaying of the value.

**Full example:**
```java
CircleDisplay cd = (CircleDisplay) findViewById(R.id.circleDisplay);
cd.setAnimDuration(3000);
cd.setValueWidthPercent(55f);
cd.setTextSize(36f);
cd.setColor(Color.GREEN);
cd.setDrawText(true);
cd.setDrawInnerCircle(true);
cd.showPercentage(75f, true);
```

0 comments on commit 0fda41e

Please sign in to comment.