Update gradle and manifest file.
This commit is contained in:
commit
350851c011
3 changed files with 9 additions and 147 deletions
|
@ -1,13 +1,13 @@
|
|||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 19
|
||||
compileSdkVersion 21
|
||||
buildToolsVersion '21.1.1'
|
||||
defaultConfig {
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 19
|
||||
versionCode 30
|
||||
versionName '2.0.0'
|
||||
targetSdkVersion 21
|
||||
versionCode 33
|
||||
versionName '2.0.1'
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
|
|
|
@ -56,12 +56,6 @@
|
|||
<scope>provided</scope>
|
||||
<version>4.1.1.4</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.nineoldandroids</groupId>
|
||||
<artifactId>library</artifactId>
|
||||
<version>2.4.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
|
|
142
README.md
142
README.md
|
@ -3,7 +3,7 @@
|
|||
MPAndroidChart
|
||||
=======
|
||||
|
||||
A simple charting library for Android, supporting line-, bar-, scatter-, candlestick- and piecharts, as well as scaling, dragging, selecting and animations. **Supporting Android 2.2 (API level 8)** and upwards.
|
||||
A simple charting library for Android, supporting line-, bar-, scatter-, candlestick-, pie- and radarcharts (spider web), as well as scaling, dragging, selecting and animations. **Supporting Android 2.2 (API level 8)** and upwards.
|
||||
|
||||
Remember: *It's all about the looks.*
|
||||
|
||||
|
@ -53,6 +53,7 @@ Features
|
|||
**Core features:**
|
||||
- Scaling on both axes (with touch-gesture, axes separately or pinch-zoom)
|
||||
- Dragging / Panning (with touch-gesture)
|
||||
- Combined-Charts (line-, bar-, scatter-, candle-data)
|
||||
- Finger drawing (draw values into the chart with touch-gesture)
|
||||
- Highlighting values (with customizeable popup-views)
|
||||
- Multiple / Separate Axes
|
||||
|
@ -152,144 +153,11 @@ dependencies {
|
|||
- Import the library folder (`MPChartLib`) into your Eclipse workspace
|
||||
- Add it as a reference to your project: [referencing library projects in Eclipse](http://developer.android.com/tools/projects/projects-eclipse.html#ReferencingLibraryProject)
|
||||
|
||||
Getting Started
|
||||
Documentation
|
||||
=======
|
||||
For a **detailed documentation**, please have a look at the [**Wiki**](https://github.com/PhilJay/MPAndroidChart/wiki).
|
||||
|
||||
For getting started, rely on the **"MPChartExample"** folder and check out the examples in that project. The example project is also [**available in the Google PlayStore**](https://play.google.com/store/apps/details?id=com.xxmassdeveloper.mpchartexample).
|
||||
|
||||
For a **detailed documentation**, please refer the [**Wiki**](https://github.com/PhilJay/MPAndroidChart/wiki).
|
||||
|
||||
**Other:**
|
||||
- <code>saveToGallery(String title)</code>: Saves the current chart state as an image to the gallery.
|
||||
- <code>saveToPath(String title, String pathOnSD)</code>: Saves the current chart state as an image to the specified path.
|
||||
- <code>setScaleMinima(float x, float y)</code>: Sets the minimum scale factors for x- and y-axis. If set for example to 3f, the user will not be able to fully zoom out.
|
||||
- <code>centerViewPort(int xIndex, float val)</code>: This method makes it possible to aim the center of the view (what you can see from the chart) to a specific position inside the chart, described by the index on the x-axis and the value on the y-axis. This also works very well in combination with the `setScaleMinima(...)` method.
|
||||
- <code>fitScreen()</code>: Resets all zooming and dragging and makes the chart fit exactly it's bounds.
|
||||
|
||||
**Displaying / styling legends:**
|
||||
|
||||
By default, all chart types support legends and will automatically generate and draw a legend after setting data for the chart. If a legend should be drawn or not can be enabled/disabled using the
|
||||
|
||||
- `setDrawLegend(boolean enabled)`
|
||||
|
||||
method.
|
||||
|
||||
The number of entries the automatically generated legend contains depends on the number of different colors (across all `DataSet` objects) as well as on the `DataSet` labels. The labels of the `Legend` depend on the labels set for the used `DataSet` objects in the chart. If no labels for the `DataSet` objects have been specified, the chart will automatically generate them. If multiple colors are used for one `DataSet`, those colors are grouped and only described by one label.
|
||||
|
||||
For customizing the `Legend`, use you can retreive the `Legend` object from the chart **after setting data** using the `getLegend()` method.
|
||||
|
||||
```java
|
||||
// setting data...
|
||||
chart.setData(....);
|
||||
|
||||
Legend l = chart.getLegend();
|
||||
l.setFormSize(10f); // set the size of the legend forms/shapes
|
||||
l.setForm(LegendForm.CIRCLE); // set what type of form/shape should be used
|
||||
l.setPosition(LegendPosition.BELOW_CHART_LEFT);
|
||||
l.setTypeface(...);
|
||||
l.setXEntrySpace(5f); // set the space between the legend entries on the x-axis
|
||||
l.setYEntrySpace(5f); // set the space between the legend entries on the y-axis
|
||||
// and many more...
|
||||
```
|
||||
|
||||
|
||||
**Displaying / styling labels:**
|
||||
|
||||
Labels (classes `XLabel` and `YLabel`) are used to describe the values of the chart on the x- and y-axis. While the x-axis labels display what is handed over to the `ChartData` object as an `ArrayList<String>` ("xVals"), the y-axis labels depend on the actual values that are set for the chart.
|
||||
|
||||
Labels can be enabled/disabled, using the methods:
|
||||
|
||||
- `setDrawXLabels(boolean enabled)`
|
||||
- `setDrawYLabels(boolean enabled)`
|
||||
|
||||
the chart provides.
|
||||
In order to apply a different styling to the labels, the methods `getYLabels()` and `getXLabels()` can be used to acquire the labels object and modify it.
|
||||
|
||||
Example:
|
||||
|
||||
```java
|
||||
XLabels xl = mChart.getXLabels();
|
||||
xl.setPosition(XLabelPosition.BOTTOM); // set the position
|
||||
xl.setTypeface(...); // set a different font
|
||||
xl.setTextSize(12f); // set the textsize
|
||||
xl.setSpaceBetweenLabels(3); // set how many characters of space should be between the labels
|
||||
//... and more
|
||||
|
||||
YLabels yl = mChart.getYLabels();
|
||||
yl.setPosition(YLabelPosition.BOTH_SIDED); // set the position
|
||||
yl.setTypeface(...); // set a different font
|
||||
yl.setTextSize(12f); // set the textsize
|
||||
yl.setLabelCount(6); // set how many label entries should be displayed
|
||||
//... and more
|
||||
|
||||
```
|
||||
|
||||
**Limit Lines:**
|
||||
|
||||
Limit lines (class `LimitLine`) are (as the name might indicate) plain and simple lines that can be set for all `Line-, Bar- and ScatterData` objects. They can be used to **provide additional information** for the user.
|
||||
|
||||
As an example, your chart might display various blood pressure measurement results the user logged with an application. In order to inform the user that a systolic blood pressure of over 140 mmHg is considered to be a health risk, you could add a `LimitLine` at 140 to provide that information.
|
||||
|
||||
```java
|
||||
|
||||
LineData ld = new LineData(...);
|
||||
|
||||
LimitLine ll = new LimitLine(140f);
|
||||
ll.setLineColor(Color.RED);
|
||||
ll.setLineWidth(4f);
|
||||
// .. and more styling options
|
||||
|
||||
ld.addLimitLine(ll);
|
||||
```
|
||||
|
||||
**Dynamically adding data (real time):**
|
||||
|
||||
For **adding new data** to the chart dynamically, there are various methods that allow to either add `Entry` objects to an existing `DataSet` or `DataSet` objects to an existing `ChartData` object.
|
||||
|
||||
Class `DataSet` (and all subclasses):
|
||||
- `addEntry(Entry e)`: Adds the given `Entry` object to the `DataSet`.
|
||||
|
||||
Class `ChartData` (and all subclasses):
|
||||
- `addEntry(Entry e, int dataSetIndex)`: Adds the given `Entry` to the `DataSet` at the specified dataset index.
|
||||
- `addDataSet(DataSet d)`: Adds the given `DataSet` object to the `ChartData` object.
|
||||
|
||||
In addition to that, there are also methods for **removing data dynamically**.
|
||||
|
||||
Class `DataSet` (and all subclasses):
|
||||
- `public boolean removeEntry(Entry e)`: Removes the given `Entry` object from the `DataSet`. Returns true if successful.
|
||||
- `public boolean removeEntry(int xIndex)`: Removes the `Entry` at the given x-index from the `DataSet`. Returns true if successful.
|
||||
|
||||
Class `ChartData` (and all subclasses):
|
||||
- `public boolean removeEntry(Entry e, int dataSetIndex)`: Removes the given `Entry` object from the `DataSet` with the given dataset index. Returns true if successful.
|
||||
- `public boolean removeEntry(int xIndex, int dataSetIndex)`: Removes the `Entry` at the given x-index from the `DataSet` with the given dataset index. Returns true if successful.
|
||||
- `public boolean removeDataSet(DataSet d)`: Removes the given `DataSet` object from the `ChartData` object. Returns true if successful.
|
||||
- `public boolean removeDataSet(int index)`: Removes the `DataSet` at the given index from the `ChartData` object. Returns true if successful.
|
||||
|
||||
|
||||
**Animations:**
|
||||
|
||||
All chart types support animations that can be used to create / build up the chart in an awesome looking way. Three different kinds of animation methods exist that animate either both, or x- and y-axis separately:
|
||||
|
||||
- `animateX(int durationMillis)`: Animates the charts values on the horizontal axis, meaning that the chart will build up within the specified time from left to right.
|
||||
- `animateY(int durationMillis)`: Animates the charts values on the vertical axis, meaning that the chart will build up within the specified time from bottom to top.
|
||||
- `animateXY(int xDuration, int yDuration)`: Animates both horizontal and vertical axis, resulting in a left/right bottom/top build-up.
|
||||
|
||||
```java
|
||||
mChart.animateX(3000); // animate horizontal 3000 milliseconds
|
||||
// or:
|
||||
mChart.animateY(3000); // animate vertical 3000 milliseconds
|
||||
// or:
|
||||
mChart.animateXY(3000, 3000); // animate horizontal and vertical 3000 milliseconds
|
||||
```
|
||||
|
||||
If `animate(...)` (of any kind) is called, no further calling of `invalidate()` is necessary to refresh the chart.
|
||||
|
||||
In order to support animations below Honeycomb, this library makes use of the awesome [**nineoldandroids library**](https://github.com/JakeWharton/NineOldAndroids) developed by Jake Wharton.
|
||||
|
||||
More documentation and example code coming soon.
|
||||
|
||||
This chart library is intended to fill the gap between popular charting libraries like "GraphView" or "achartengine".
|
||||
|
||||
Furthermore, you can also rely on the [**MPChartExample**](https://github.com/PhilJay/MPAndroidChart/tree/master/MPChartExample) folder and check out the example code in that project. The corresponding application to the example project is also [**available in the Google PlayStore**](https://play.google.com/store/apps/details?id=com.xxmassdeveloper.mpchartexample).
|
||||
|
||||
License
|
||||
=======
|
||||
|
|
Loading…
Add table
Reference in a new issue