├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── styles.xml │ │ │ │ └── colors.xml │ │ │ ├── drawable │ │ │ │ ├── jfdfdj.png │ │ │ │ ├── bg_null.png │ │ │ │ ├── marker3.png │ │ │ │ ├── line_bg_pressed.png │ │ │ │ ├── chart_view_selector_line.xml │ │ │ │ └── ac_bg_oval.xml │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── drawable-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── view_dash_line.xml │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── drawable-xhdpi │ │ │ │ ├── chart_popu.9.png │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── chart_popu_right.9.png │ │ │ │ ├── chart_thisyear_blue.xml │ │ │ │ └── chart_callserice_call_casecount.xml │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── ic_launcher.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ ├── layout │ │ │ │ ├── activity_line.xml │ │ │ │ ├── activity_a.xml │ │ │ │ ├── custom_marker_view.xml │ │ │ │ ├── custom_marker_view_layout.xml │ │ │ │ ├── custom_marker_view_2.xml │ │ │ │ └── activity_main.xml │ │ │ └── drawable-v24 │ │ │ │ └── ic_launcher_foreground.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── smartchart │ │ │ │ └── cn │ │ │ │ └── mpandroidchart │ │ │ │ ├── bean │ │ │ │ └── YomthEnity.java │ │ │ │ ├── view │ │ │ │ ├── MyMarkerView.java │ │ │ │ └── NewMarkerView.java │ │ │ │ └── utils │ │ │ │ └── BaseUtils.java │ │ ├── assets │ │ │ ├── test.json │ │ │ └── test1.json │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── smartchart │ │ │ └── cn │ │ │ └── mpandroidchart │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── smartchart │ │ └── cn │ │ └── mpandroidchart │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── MPChartLib ├── .gitignore ├── ic_launcher-web.png ├── .settings │ └── gradle │ │ └── org.springsource.ide.eclipse.gradle.core.prefs ├── src │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── github │ │ │ │ └── mikephil │ │ │ │ └── charting │ │ │ │ ├── interfaces │ │ │ │ ├── dataprovider │ │ │ │ │ ├── BubbleDataProvider.java │ │ │ │ │ ├── CandleDataProvider.java │ │ │ │ │ ├── ScatterDataProvider.java │ │ │ │ │ ├── LineDataProvider.java │ │ │ │ │ ├── BarDataProvider.java │ │ │ │ │ ├── CombinedDataProvider.java │ │ │ │ │ ├── BarLineScatterCandleBubbleDataProvider.java │ │ │ │ │ └── ChartInterface.java │ │ │ │ └── datasets │ │ │ │ │ ├── IBarLineScatterCandleBubbleDataSet.java │ │ │ │ │ ├── IBubbleDataSet.java │ │ │ │ │ ├── IRadarDataSet.java │ │ │ │ │ ├── IScatterDataSet.java │ │ │ │ │ ├── ILineScatterCandleRadarDataSet.java │ │ │ │ │ ├── ILineRadarDataSet.java │ │ │ │ │ ├── IBarDataSet.java │ │ │ │ │ ├── ICandleDataSet.java │ │ │ │ │ ├── IPieDataSet.java │ │ │ │ │ └── ILineDataSet.java │ │ │ │ ├── highlight │ │ │ │ ├── IHighlighter.java │ │ │ │ ├── PieHighlighter.java │ │ │ │ ├── Range.java │ │ │ │ ├── PieRadarHighlighter.java │ │ │ │ ├── HorizontalBarHighlighter.java │ │ │ │ └── RadarHighlighter.java │ │ │ │ ├── exception │ │ │ │ └── DrawingDataSetNotCreatedException.java │ │ │ │ ├── listener │ │ │ │ ├── OnDrawLineChartTouchListener.java │ │ │ │ ├── OnChartValueSelectedListener.java │ │ │ │ ├── OnDrawListener.java │ │ │ │ └── OnChartGestureListener.java │ │ │ │ ├── utils │ │ │ │ ├── ParseUtils.java │ │ │ │ ├── EntryXComparator.java │ │ │ │ ├── SPoolUtils.java │ │ │ │ ├── HorizontalViewPortHandler.java │ │ │ │ ├── StringUtils.java │ │ │ │ ├── MPPointD.java │ │ │ │ ├── TransformerHorizontalBarChart.java │ │ │ │ ├── FSize.java │ │ │ │ └── MPPointF.java │ │ │ │ ├── data │ │ │ │ ├── CandleData.java │ │ │ │ ├── LineData.java │ │ │ │ ├── BarLineScatterCandleBubbleData.java │ │ │ │ ├── BubbleData.java │ │ │ │ ├── ScatterData.java │ │ │ │ ├── RadarEntry.java │ │ │ │ ├── BarLineScatterCandleBubbleDataSet.java │ │ │ │ ├── RadarData.java │ │ │ │ ├── BubbleDataSet.java │ │ │ │ ├── BaseEntry.java │ │ │ │ ├── PieEntry.java │ │ │ │ ├── BubbleEntry.java │ │ │ │ ├── PieData.java │ │ │ │ └── filter │ │ │ │ │ └── Approximator.java │ │ │ │ ├── renderer │ │ │ │ ├── Renderer.java │ │ │ │ ├── scatter │ │ │ │ │ ├── IShapeRenderer.java │ │ │ │ │ ├── CrossShapeRenderer.java │ │ │ │ │ ├── ChevronDownShapeRenderer.java │ │ │ │ │ ├── ChevronUpShapeRenderer.java │ │ │ │ │ ├── XShapeRenderer.java │ │ │ │ │ ├── CircleShapeRenderer.java │ │ │ │ │ ├── SquareShapeRenderer.java │ │ │ │ │ └── TriangleShapeRenderer.java │ │ │ │ ├── LineScatterCandleRadarRenderer.java │ │ │ │ ├── XAxisRendererRadarChart.java │ │ │ │ └── LineRadarRenderer.java │ │ │ │ ├── model │ │ │ │ └── GradientColor.java │ │ │ │ ├── formatter │ │ │ │ ├── IAxisValueFormatter.java │ │ │ │ ├── ColorFormatter.java │ │ │ │ ├── IFillFormatter.java │ │ │ │ ├── IValueFormatter.java │ │ │ │ ├── DefaultFillFormatter.java │ │ │ │ ├── PercentFormatter.java │ │ │ │ ├── DefaultAxisValueFormatter.java │ │ │ │ ├── DefaultValueFormatter.java │ │ │ │ ├── IndexAxisValueFormatter.java │ │ │ │ └── StackedValueFormatter.java │ │ │ │ ├── entity │ │ │ │ ├── YoyListEntity.java │ │ │ │ ├── RealListEntity.java │ │ │ │ ├── PercentageEntity.java │ │ │ │ ├── BarDataEntity.java │ │ │ │ └── SourceEntity.java │ │ │ │ ├── charts │ │ │ │ ├── CandleStickChart.java │ │ │ │ ├── BubbleChart.java │ │ │ │ ├── LineChart.java │ │ │ │ └── ScatterChart.java │ │ │ │ ├── jobs │ │ │ │ ├── ViewPortJob.java │ │ │ │ ├── MoveViewJob.java │ │ │ │ ├── AnimatedMoveViewJob.java │ │ │ │ ├── AnimatedViewPortJob.java │ │ │ │ └── ZoomJob.java │ │ │ │ ├── components │ │ │ │ ├── IMarker.java │ │ │ │ ├── Description.java │ │ │ │ └── LegendEntry.java │ │ │ │ ├── buffer │ │ │ │ ├── AbstractBuffer.java │ │ │ │ └── HorizontalBarBuffer.java │ │ │ │ ├── newchart │ │ │ │ ├── StackBarChartEntry.java │ │ │ │ ├── GroupBarChartEntity.java │ │ │ │ └── BarChartEntity.java │ │ │ │ └── view │ │ │ │ └── LineChartInViewPager.java │ │ └── AndroidManifest.xml │ └── test │ │ └── java │ │ └── com │ │ └── github │ │ └── mikephil │ │ └── charting │ │ └── test │ │ ├── ApproximatorTest.java │ │ └── BarDataTest.java ├── project.properties ├── proguard-project.txt └── build.gradle ├── settings.gradle ├── screenshot ├── chart.png └── chart_cutom.png ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── .idea ├── vcs.xml ├── modules.xml ├── runConfigurations.xml ├── gradle.xml └── misc.xml ├── gradle.properties └── gradlew.bat /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /MPChartLib/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':MPChartLib' 2 | -------------------------------------------------------------------------------- /screenshot/chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangi789/MPAndroidChart/HEAD/screenshot/chart.png -------------------------------------------------------------------------------- /screenshot/chart_cutom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangi789/MPAndroidChart/HEAD/screenshot/chart_cutom.png -------------------------------------------------------------------------------- /MPChartLib/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangi789/MPAndroidChart/HEAD/MPChartLib/ic_launcher-web.png -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | MPAndroidChart 3 | 4 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangi789/MPAndroidChart/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/drawable/jfdfdj.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangi789/MPAndroidChart/HEAD/app/src/main/res/drawable/jfdfdj.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg_null.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangi789/MPAndroidChart/HEAD/app/src/main/res/drawable/bg_null.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/marker3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangi789/MPAndroidChart/HEAD/app/src/main/res/drawable/marker3.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangi789/MPAndroidChart/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangi789/MPAndroidChart/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangi789/MPAndroidChart/HEAD/app/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/line_bg_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangi789/MPAndroidChart/HEAD/app/src/main/res/drawable/line_bg_pressed.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangi789/MPAndroidChart/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangi789/MPAndroidChart/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/chart_popu.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangi789/MPAndroidChart/HEAD/app/src/main/res/drawable-xhdpi/chart_popu.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangi789/MPAndroidChart/HEAD/app/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangi789/MPAndroidChart/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangi789/MPAndroidChart/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangi789/MPAndroidChart/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangi789/MPAndroidChart/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/chart_popu_right.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangi789/MPAndroidChart/HEAD/app/src/main/res/drawable-xhdpi/chart_popu_right.9.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangi789/MPAndroidChart/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangi789/MPAndroidChart/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Sep 13 14:26:29 CST 2018 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip 7 | -------------------------------------------------------------------------------- /MPChartLib/.settings/gradle/org.springsource.ide.eclipse.gradle.core.prefs: -------------------------------------------------------------------------------- 1 | #org.springsource.ide.eclipse.gradle.core.preferences.GradleProjectPreferences 2 | #Mon Jan 18 23:02:46 CET 2016 3 | org.springsource.ide.eclipse.gradle.linkedresources= 4 | org.springsource.ide.eclipse.gradle.rootprojectloc=.. 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/chart_thisyear_blue.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/chart_callserice_call_casecount.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /MPChartLib/src/main/java/com/github/mikephil/charting/interfaces/dataprovider/BubbleDataProvider.java: -------------------------------------------------------------------------------- 1 | package com.github.mikephil.charting.interfaces.dataprovider; 2 | 3 | import com.github.mikephil.charting.data.BubbleData; 4 | 5 | public interface BubbleDataProvider extends BarLineScatterCandleBubbleDataProvider { 6 | 7 | BubbleData getBubbleData(); 8 | } 9 | -------------------------------------------------------------------------------- /MPChartLib/src/main/java/com/github/mikephil/charting/interfaces/dataprovider/CandleDataProvider.java: -------------------------------------------------------------------------------- 1 | package com.github.mikephil.charting.interfaces.dataprovider; 2 | 3 | import com.github.mikephil.charting.data.CandleData; 4 | 5 | public interface CandleDataProvider extends BarLineScatterCandleBubbleDataProvider { 6 | 7 | CandleData getCandleData(); 8 | } 9 | -------------------------------------------------------------------------------- /MPChartLib/src/main/java/com/github/mikephil/charting/interfaces/dataprovider/ScatterDataProvider.java: -------------------------------------------------------------------------------- 1 | package com.github.mikephil.charting.interfaces.dataprovider; 2 | 3 | import com.github.mikephil.charting.data.ScatterData; 4 | 5 | public interface ScatterDataProvider extends BarLineScatterCandleBubbleDataProvider { 6 | 7 | ScatterData getScatterData(); 8 | } 9 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /MPChartLib/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 12 | 13 | -------------------------------------------------------------------------------- /MPChartLib/src/main/java/com/github/mikephil/charting/interfaces/dataprovider/LineDataProvider.java: -------------------------------------------------------------------------------- 1 | package com.github.mikephil.charting.interfaces.dataprovider; 2 | 3 | import com.github.mikephil.charting.components.YAxis; 4 | import com.github.mikephil.charting.data.LineData; 5 | 6 | public interface LineDataProvider extends BarLineScatterCandleBubbleDataProvider { 7 | 8 | LineData getLineData(); 9 | 10 | YAxis getAxis(YAxis.AxisDependency dependency); 11 | } 12 | -------------------------------------------------------------------------------- /MPChartLib/src/main/java/com/github/mikephil/charting/interfaces/dataprovider/BarDataProvider.java: -------------------------------------------------------------------------------- 1 | package com.github.mikephil.charting.interfaces.dataprovider; 2 | 3 | import com.github.mikephil.charting.data.BarData; 4 | 5 | public interface BarDataProvider extends BarLineScatterCandleBubbleDataProvider { 6 | 7 | BarData getBarData(); 8 | boolean isDrawBarShadowEnabled(); 9 | boolean isDrawValueAboveBarEnabled(); 10 | boolean isHighlightFullBarEnabled(); 11 | } 12 | -------------------------------------------------------------------------------- /MPChartLib/src/main/java/com/github/mikephil/charting/interfaces/dataprovider/CombinedDataProvider.java: -------------------------------------------------------------------------------- 1 | package com.github.mikephil.charting.interfaces.dataprovider; 2 | 3 | import com.github.mikephil.charting.data.CombinedData; 4 | 5 | /** 6 | * Created by philipp on 11/06/16. 7 | */ 8 | public interface CombinedDataProvider extends LineDataProvider, BarDataProvider, BubbleDataProvider, CandleDataProvider, ScatterDataProvider { 9 | 10 | CombinedData getCombinedData(); 11 | } 12 | -------------------------------------------------------------------------------- /MPChartLib/src/main/java/com/github/mikephil/charting/highlight/IHighlighter.java: -------------------------------------------------------------------------------- 1 | package com.github.mikephil.charting.highlight; 2 | 3 | /** 4 | * Created by philipp on 10/06/16. 5 | */ 6 | public interface IHighlighter 7 | { 8 | 9 | /** 10 | * Returns a Highlight object corresponding to the given x- and y- touch positions in pixels. 11 | * 12 | * @param x 13 | * @param y 14 | * @return 15 | */ 16 | Highlight getHighlight(float x, float y); 17 | } 18 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/chart_view_selector_line.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/view_dash_line.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /MPChartLib/src/main/java/com/github/mikephil/charting/exception/DrawingDataSetNotCreatedException.java: -------------------------------------------------------------------------------- 1 | package com.github.mikephil.charting.exception; 2 | 3 | public class DrawingDataSetNotCreatedException extends RuntimeException { 4 | 5 | /** 6 | * 7 | */ 8 | private static final long serialVersionUID = 1L; 9 | 10 | public DrawingDataSetNotCreatedException() { 11 | super("Have to create a new drawing set first. Call ChartData's createNewDrawingDataSet() method"); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/test/java/com/smartchart/cn/mpandroidchart/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.smartchart.cn.mpandroidchart; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /MPChartLib/src/main/java/com/github/mikephil/charting/listener/OnDrawLineChartTouchListener.java: -------------------------------------------------------------------------------- 1 | package com.github.mikephil.charting.listener; 2 | 3 | import android.view.GestureDetector.SimpleOnGestureListener; 4 | import android.view.MotionEvent; 5 | import android.view.View; 6 | import android.view.View.OnTouchListener; 7 | 8 | public class OnDrawLineChartTouchListener extends SimpleOnGestureListener implements OnTouchListener { 9 | 10 | @Override 11 | public boolean onTouch(View v, MotionEvent event) { 12 | return false; 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_line.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 12 | -------------------------------------------------------------------------------- /MPChartLib/src/main/java/com/github/mikephil/charting/interfaces/datasets/IBarLineScatterCandleBubbleDataSet.java: -------------------------------------------------------------------------------- 1 | package com.github.mikephil.charting.interfaces.datasets; 2 | 3 | import com.github.mikephil.charting.data.Entry; 4 | 5 | /** 6 | * Created by philipp on 21/10/15. 7 | */ 8 | public interface IBarLineScatterCandleBubbleDataSet extends IDataSet { 9 | 10 | /** 11 | * Returns the color that is used for drawing the highlight indicators. 12 | * 13 | * @return 14 | */ 15 | int getHighLightColor(); 16 | } 17 | -------------------------------------------------------------------------------- /MPChartLib/src/main/java/com/github/mikephil/charting/utils/ParseUtils.java: -------------------------------------------------------------------------------- 1 | package com.github.mikephil.charting.utils; 2 | 3 | import org.json.JSONException; 4 | import org.json.JSONObject; 5 | 6 | /** 7 | * @author 张海洋 8 | * @Date on 2018/09/26. 9 | * @org 上海..科技有限公司 10 | * @describe 11 | */ 12 | 13 | 14 | public class ParseUtils { 15 | public void getData(String data) { 16 | try { 17 | JSONObject jsonObject=new JSONObject(data); 18 | } catch (JSONException e) { 19 | e.printStackTrace(); 20 | } 21 | 22 | } 23 | 24 | 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_a.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 14 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /MPChartLib/src/main/java/com/github/mikephil/charting/data/CandleData.java: -------------------------------------------------------------------------------- 1 | package com.github.mikephil.charting.data; 2 | 3 | import com.github.mikephil.charting.interfaces.datasets.ICandleDataSet; 4 | 5 | import java.util.ArrayList; 6 | import java.util.List; 7 | 8 | public class CandleData extends BarLineScatterCandleBubbleData { 9 | 10 | public CandleData() { 11 | super(); 12 | } 13 | 14 | public CandleData(List dataSets) { 15 | super(dataSets); 16 | } 17 | 18 | public CandleData(ICandleDataSet... dataSets) { 19 | super(dataSets); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /MPChartLib/src/main/java/com/github/mikephil/charting/renderer/Renderer.java: -------------------------------------------------------------------------------- 1 | 2 | package com.github.mikephil.charting.renderer; 3 | 4 | import com.github.mikephil.charting.utils.ViewPortHandler; 5 | 6 | /** 7 | * Abstract baseclass of all Renderers. 8 | * 9 | * @author Philipp Jahoda 10 | */ 11 | public abstract class Renderer { 12 | 13 | /** 14 | * the component that handles the drawing area of the chart and it's offsets 15 | */ 16 | protected ViewPortHandler mViewPortHandler; 17 | 18 | public Renderer(ViewPortHandler viewPortHandler) { 19 | this.mViewPortHandler = viewPortHandler; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /MPChartLib/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-23 15 | android.library=true 16 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ac_bg_oval.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 22 | -------------------------------------------------------------------------------- /MPChartLib/src/main/java/com/github/mikephil/charting/utils/EntryXComparator.java: -------------------------------------------------------------------------------- 1 | package com.github.mikephil.charting.utils; 2 | 3 | import com.github.mikephil.charting.data.Entry; 4 | 5 | import java.util.Comparator; 6 | 7 | /** 8 | * Comparator for comparing Entry-objects by their x-value. 9 | * Created by philipp on 17/06/15. 10 | */ 11 | public class EntryXComparator implements Comparator { 12 | @Override 13 | public int compare(Entry entry1, Entry entry2) { 14 | float diff = entry1.getX() - entry2.getX(); 15 | 16 | if (diff == 0f) return 0; 17 | else { 18 | if (diff > 0f) return 1; 19 | else return -1; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /MPChartLib/src/main/java/com/github/mikephil/charting/interfaces/dataprovider/BarLineScatterCandleBubbleDataProvider.java: -------------------------------------------------------------------------------- 1 | package com.github.mikephil.charting.interfaces.dataprovider; 2 | 3 | import com.github.mikephil.charting.components.YAxis.AxisDependency; 4 | import com.github.mikephil.charting.data.BarLineScatterCandleBubbleData; 5 | import com.github.mikephil.charting.utils.Transformer; 6 | 7 | public interface BarLineScatterCandleBubbleDataProvider extends ChartInterface { 8 | 9 | Transformer getTransformer(AxisDependency axis); 10 | boolean isInverted(AxisDependency axis); 11 | 12 | float getLowestVisibleX(); 13 | float getHighestVisibleX(); 14 | 15 | BarLineScatterCandleBubbleData getData(); 16 | } 17 | -------------------------------------------------------------------------------- /MPChartLib/src/main/java/com/github/mikephil/charting/data/LineData.java: -------------------------------------------------------------------------------- 1 | 2 | package com.github.mikephil.charting.data; 3 | 4 | import com.github.mikephil.charting.interfaces.datasets.ILineDataSet; 5 | 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | 9 | /** 10 | * Data object that encapsulates all data associated with a LineChart. 11 | * 12 | * @author Philipp Jahoda 13 | */ 14 | public class LineData extends BarLineScatterCandleBubbleData { 15 | 16 | public LineData() { 17 | super(); 18 | } 19 | 20 | public LineData(ILineDataSet... dataSets) { 21 | super(dataSets); 22 | } 23 | 24 | public LineData(List dataSets) { 25 | super(dataSets); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 19 | -------------------------------------------------------------------------------- /MPChartLib/src/main/java/com/github/mikephil/charting/model/GradientColor.java: -------------------------------------------------------------------------------- 1 | package com.github.mikephil.charting.model; 2 | 3 | public class GradientColor { 4 | 5 | private int startColor; 6 | private int endColor; 7 | 8 | public GradientColor(int startColor, int endColor) { 9 | this.startColor = startColor; 10 | this.endColor = endColor; 11 | } 12 | 13 | public int getStartColor() { 14 | return startColor; 15 | } 16 | 17 | public void setStartColor(int startColor) { 18 | this.startColor = startColor; 19 | } 20 | 21 | public int getEndColor() { 22 | return endColor; 23 | } 24 | 25 | public void setEndColor(int endColor) { 26 | this.endColor = endColor; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 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 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /MPChartLib/src/main/java/com/github/mikephil/charting/interfaces/datasets/IBubbleDataSet.java: -------------------------------------------------------------------------------- 1 | package com.github.mikephil.charting.interfaces.datasets; 2 | 3 | import com.github.mikephil.charting.data.BubbleEntry; 4 | 5 | /** 6 | * Created by philipp on 21/10/15. 7 | */ 8 | public interface IBubbleDataSet extends IBarLineScatterCandleBubbleDataSet { 9 | 10 | /** 11 | * Sets the width of the circle that surrounds the bubble when highlighted, 12 | * in dp. 13 | * 14 | * @param width 15 | */ 16 | void setHighlightCircleWidth(float width); 17 | 18 | float getMaxSize(); 19 | 20 | boolean isNormalizeSizeEnabled(); 21 | 22 | /** 23 | * Returns the width of the highlight-circle that surrounds the bubble 24 | * @return 25 | */ 26 | float getHighlightCircleWidth(); 27 | } 28 | -------------------------------------------------------------------------------- /MPChartLib/src/main/java/com/github/mikephil/charting/utils/SPoolUtils.java: -------------------------------------------------------------------------------- 1 | package com.github.mikephil.charting.utils; 2 | 3 | import android.graphics.Color; 4 | 5 | /** 6 | * @author 张海洋 7 | * @Date on 2018/09/14. 8 | * @org 上海相舆科技有限公司 9 | * @describe 10 | */ 11 | 12 | 13 | public class SPoolUtils { 14 | 15 | 16 | /** 17 | * X Y 轴 默认字体的大小 18 | */ 19 | public static float mNomalTextSize = 11f; 20 | /** 21 | * X 轴字体的颜色 默认 22 | */ 23 | public static int mXTvColor = Color.parseColor("#5fd1cc"); 24 | /** 25 | * Y轴字体的颜色 默认 26 | */ 27 | public static int mYTvColor = Color.parseColor("#5fd1cc"); 28 | 29 | 30 | /** 31 | * 图例 字体的大小 和 字体颜色 32 | */ 33 | 34 | public static float mLegendTvSize=18f; 35 | public static int mLegendTvColor=Color.parseColor("#5fd1cc"); 36 | 37 | } 38 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /MPChartLib/src/main/java/com/github/mikephil/charting/data/BarLineScatterCandleBubbleData.java: -------------------------------------------------------------------------------- 1 | 2 | package com.github.mikephil.charting.data; 3 | 4 | import com.github.mikephil.charting.interfaces.datasets.IBarLineScatterCandleBubbleDataSet; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Baseclass for all Line, Bar, Scatter, Candle and Bubble data. 10 | * 11 | * @author Philipp Jahoda 12 | */ 13 | public abstract class BarLineScatterCandleBubbleData> 14 | extends ChartData { 15 | 16 | public BarLineScatterCandleBubbleData() { 17 | super(); 18 | } 19 | 20 | public BarLineScatterCandleBubbleData(T... sets) { 21 | super(sets); 22 | } 23 | 24 | public BarLineScatterCandleBubbleData(List sets) { 25 | super(sets); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /MPChartLib/src/main/java/com/github/mikephil/charting/formatter/IAxisValueFormatter.java: -------------------------------------------------------------------------------- 1 | package com.github.mikephil.charting.formatter; 2 | 3 | import com.github.mikephil.charting.components.AxisBase; 4 | 5 | /** 6 | * Created by Philipp Jahoda on 20/09/15. 7 | * Custom formatter interface that allows formatting of 8 | * axis labels before they are being drawn. 9 | */ 10 | public interface IAxisValueFormatter 11 | { 12 | 13 | /** 14 | * Called when a value from an axis is to be formatted 15 | * before being drawn. For performance reasons, avoid excessive calculations 16 | * and memory allocations inside this method. 17 | * 18 | * @param value the value to be formatted 19 | * @param axis the axis the value belongs to 20 | * @return 21 | */ 22 | String getFormattedValue(float value, AxisBase axis); 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/java/com/smartchart/cn/mpandroidchart/bean/YomthEnity.java: -------------------------------------------------------------------------------- 1 | package com.smartchart.cn.mpandroidchart.bean; 2 | 3 | /** 4 | * @author 张海洋 5 | * @Date on 2018/09/13. 6 | * @org 上海相舆科技有限公司 7 | * @describe 8 | */ 9 | 10 | 11 | public class YomthEnity { 12 | private String month; 13 | private String electricity; 14 | 15 | public YomthEnity(String month, String electricity) { 16 | this.month = month; 17 | this.electricity = electricity; 18 | } 19 | 20 | public String getMonth() { 21 | return month; 22 | } 23 | 24 | public void setMonth(String month) { 25 | this.month = month; 26 | } 27 | 28 | public String getElectricity() { 29 | return electricity; 30 | } 31 | 32 | public void setElectricity(String electricity) { 33 | this.electricity = electricity; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/res/layout/custom_marker_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /MPChartLib/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /MPChartLib/src/main/java/com/github/mikephil/charting/highlight/PieHighlighter.java: -------------------------------------------------------------------------------- 1 | package com.github.mikephil.charting.highlight; 2 | 3 | import com.github.mikephil.charting.charts.PieChart; 4 | import com.github.mikephil.charting.data.Entry; 5 | import com.github.mikephil.charting.interfaces.datasets.IPieDataSet; 6 | 7 | /** 8 | * Created by philipp on 12/06/16. 9 | */ 10 | public class PieHighlighter extends PieRadarHighlighter { 11 | 12 | public PieHighlighter(PieChart chart) { 13 | super(chart); 14 | } 15 | 16 | @Override 17 | protected Highlight getClosestHighlight(int index, float x, float y) { 18 | 19 | IPieDataSet set = mChart.getData().getDataSet(); 20 | 21 | final Entry entry = set.getEntryForIndex(index); 22 | 23 | return new Highlight(index, entry.getY(), x, y, 0, set.getAxisDependency()); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/res/layout/custom_marker_view_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /MPChartLib/src/main/java/com/github/mikephil/charting/utils/HorizontalViewPortHandler.java: -------------------------------------------------------------------------------- 1 | 2 | package com.github.mikephil.charting.utils; 3 | 4 | /** 5 | * ViewPortHandler for HorizontalBarChart. 6 | */ 7 | public class HorizontalViewPortHandler extends ViewPortHandler { 8 | 9 | 10 | // @Override 11 | // public void setMinimumScaleX(float xScale) { 12 | // setMinimumScaleY(xScale); 13 | // } 14 | // 15 | // @Override 16 | // public void setMinimumScaleY(float yScale) { 17 | // setMinimumScaleX(yScale); 18 | // } 19 | // 20 | // @Override 21 | // public void setMinMaxScaleX(float minScaleX, float maxScaleX) { 22 | // setMinMaxScaleY(minScaleX, maxScaleX); 23 | // } 24 | // 25 | // @Override 26 | // public void setMinMaxScaleY(float minScaleY, float maxScaleY) { 27 | // setMinMaxScaleX(minScaleY, maxScaleY); 28 | // } 29 | } 30 | -------------------------------------------------------------------------------- /app/src/main/assets/test.json: -------------------------------------------------------------------------------- 1 | { 2 | "errCode": 0, 3 | "errDesc": "ok", 4 | "rsp": [{ 5 | "month": "2018-09", 6 | "electricity": "100" 7 | }, { 8 | "month": "2018-08", 9 | "electricity": "83" 10 | }, { 11 | "month": "2018-07", 12 | "electricity": "49" 13 | }, { 14 | "month": "2018-06", 15 | "electricity": "22" 16 | }, { 17 | "month": "2018-05", 18 | "electricity": "83" 19 | }, { 20 | "month": "2018-4", 21 | "electricity": "0.0" 22 | }, { 23 | "month": "2017-03", 24 | "electricity": "0" 25 | }, { 26 | "month": "2018-2", 27 | "electricity": "2" 28 | }, { 29 | "month": "2018-1", 30 | "electricity": "8" 31 | }, { 32 | "month": "2017-12", 33 | "electricity": "6" 34 | }, { 35 | "month": "2017-11", 36 | "electricity": "5" 37 | }, { 38 | "month": "2017-10", 39 | "electricity": "4" 40 | }] 41 | } -------------------------------------------------------------------------------- /app/src/main/assets/test1.json: -------------------------------------------------------------------------------- 1 | { 2 | "errCode": 0, 3 | "errDesc": "ok", 4 | "rsp": [{ 5 | "month": "2018-09", 6 | "electricity": "70" 7 | }, { 8 | "month": "2018-08", 9 | "electricity": "56" 10 | }, { 11 | "month": "2018-07", 12 | "electricity": "69" 13 | }, { 14 | "month": "2018-06", 15 | "electricity": "32" 16 | }, { 17 | "month": "2018-05", 18 | "electricity": "83" 19 | }, { 20 | "month": "2018-4", 21 | "electricity": "0.0" 22 | }, { 23 | "month": "2017-03", 24 | "electricity": "0" 25 | }, { 26 | "month": "2018-2", 27 | "electricity": "2" 28 | }, { 29 | "month": "2018-1", 30 | "electricity": "8" 31 | }, { 32 | "month": "2017-12", 33 | "electricity": "6" 34 | }, { 35 | "month": "2017-11", 36 | "electricity": "89" 37 | }, { 38 | "month": "2017-10", 39 | "electricity": "45" 40 | }] 41 | } -------------------------------------------------------------------------------- /MPChartLib/src/main/java/com/github/mikephil/charting/formatter/ColorFormatter.java: -------------------------------------------------------------------------------- 1 | package com.github.mikephil.charting.formatter; 2 | 3 | import com.github.mikephil.charting.data.DataSet; 4 | import com.github.mikephil.charting.data.Entry; 5 | import com.github.mikephil.charting.interfaces.datasets.IDataSet; 6 | 7 | /** 8 | * Interface that can be used to return a customized color instead of setting 9 | * colors via the setColor(...) method of the DataSet. 10 | * 11 | * @author Philipp Jahoda 12 | */ 13 | public interface ColorFormatter { 14 | 15 | /** 16 | * Returns the color to be used for the given Entry at the given index (in the entries array) 17 | * 18 | * @param index index in the entries array 19 | * @param e the entry to color 20 | * @param set the DataSet the entry belongs to 21 | * @return 22 | */ 23 | int getColor(int index, Entry e, IDataSet set); 24 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/custom_marker_view_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /MPChartLib/src/main/java/com/github/mikephil/charting/formatter/IFillFormatter.java: -------------------------------------------------------------------------------- 1 | package com.github.mikephil.charting.formatter; 2 | 3 | import com.github.mikephil.charting.interfaces.datasets.ILineDataSet; 4 | import com.github.mikephil.charting.interfaces.dataprovider.LineDataProvider; 5 | 6 | /** 7 | * Interface for providing a custom logic to where the filling line of a LineDataSet 8 | * should end. This of course only works if setFillEnabled(...) is set to true. 9 | * 10 | * @author Philipp Jahoda 11 | */ 12 | public interface IFillFormatter 13 | { 14 | 15 | /** 16 | * Returns the vertical (y-axis) position where the filled-line of the 17 | * LineDataSet should end. 18 | * 19 | * @param dataSet the ILineDataSet that is currently drawn 20 | * @param dataProvider 21 | * @return 22 | */ 23 | float getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProvider); 24 | } 25 | -------------------------------------------------------------------------------- /MPChartLib/src/main/java/com/github/mikephil/charting/utils/StringUtils.java: -------------------------------------------------------------------------------- 1 | package com.github.mikephil.charting.utils; 2 | 3 | /** 4 | *
 5 |  *     author : JinBiao
 6 |  *     CSDN : http://my.csdn.net/DT235201314
 7 |  *     time   : 2017/04/05
 8 |  *     desc   :工具类
 9 |  *     version: 1.0
10 |  * 
11 | */ 12 | 13 | public class StringUtils { 14 | /** 15 | * 判断给定字符串是否空白串。 空白串是指由空格、制表符、回车符、换行符组成的字符串 若输入字符串为null或空字符串,返回true 16 | * 17 | * @param input 18 | * @return boolean 19 | */ 20 | public static boolean isEmpty(String input) { 21 | if (input == null || "".equals(input)) 22 | return true; 23 | 24 | for (int i = 0; i < input.length(); i++) { 25 | char c = input.charAt(i); 26 | if (c != ' ' && c != '\t' && c != '\r' && c != '\n') { 27 | return false; 28 | } 29 | } 30 | return true; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/smartchart/cn/mpandroidchart/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.smartchart.cn.mpandroidchart; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.smartchart.cn.mpandroidchart", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | 8 | 9 | #f1f1f1 10 | #ebfeff 11 | #fdffe8 12 | #F03967 13 | #12CD7C 14 | #FAF038 15 | #fafafa 16 | #5fd1cc 17 | 18 | #FF414E 19 | #FFF5E0 20 | #f5f5f5 21 | #D9D9D9 22 | #7189a9 23 | 24 | -------------------------------------------------------------------------------- /MPChartLib/src/main/java/com/github/mikephil/charting/listener/OnChartValueSelectedListener.java: -------------------------------------------------------------------------------- 1 | package com.github.mikephil.charting.listener; 2 | 3 | import com.github.mikephil.charting.data.Entry; 4 | import com.github.mikephil.charting.highlight.Highlight; 5 | 6 | /** 7 | * Listener for callbacks when selecting values inside the chart by 8 | * touch-gesture. 9 | * 10 | * @author Philipp Jahoda 11 | */ 12 | public interface OnChartValueSelectedListener { 13 | 14 | /** 15 | * Called when a value has been selected inside the chart. 16 | * 17 | * @param e The selected Entry 18 | * @param h The corresponding highlight object that contains information 19 | * about the highlighted position such as dataSetIndex, ... 20 | */ 21 | void onValueSelected(Entry e, Highlight h); 22 | 23 | /** 24 | * Called when nothing has been selected or an "un-select" has been made. 25 | */ 26 | void onNothingSelected(); 27 | } 28 | -------------------------------------------------------------------------------- /MPChartLib/src/main/java/com/github/mikephil/charting/entity/YoyListEntity.java: -------------------------------------------------------------------------------- 1 | package com.github.mikephil.charting.entity; 2 | 3 | /** 4 | *
 5 |  *     author : JinBiao
 6 |  *     CSDN : http://my.csdn.net/DT235201314
 7 |  *     time   : 2017/04/05
 8 |  *     desc   :实体类
 9 |  *     version: 1.0
10 |  * 
11 | */ 12 | 13 | public class YoyListEntity { 14 | private String year; 15 | private String month; 16 | private String amount; //销售数值 17 | 18 | public String getYear() { 19 | return year; 20 | } 21 | 22 | public void setYear(String year) { 23 | this.year = year; 24 | } 25 | 26 | public String getMonth() { 27 | return month; 28 | } 29 | 30 | public void setMonth(String month) { 31 | this.month = month; 32 | } 33 | 34 | public String getAmount() { 35 | return amount; 36 | } 37 | 38 | public void setAmount(String amount) { 39 | this.amount = amount; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /MPChartLib/src/main/java/com/github/mikephil/charting/entity/RealListEntity.java: -------------------------------------------------------------------------------- 1 | package com.github.mikephil.charting.entity; 2 | /** 3 | *
 4 |  *     author : JinBiao
 5 |  *     CSDN : http://my.csdn.net/DT235201314
 6 |  *     time   : 2017/04/05
 7 |  *     desc   :实体类
 8 |  *     version: 1.0
 9 |  * 
10 | */ 11 | 12 | public class RealListEntity { 13 | private String year; 14 | private String month; 15 | private String amount; //销售数值 16 | 17 | public String getYear() { 18 | return year; 19 | } 20 | 21 | public void setYear(String year) { 22 | this.year = year; 23 | } 24 | 25 | public String getMonth() { 26 | return month; 27 | } 28 | 29 | public void setMonth(String month) { 30 | this.month = month; 31 | } 32 | 33 | public String getAmount() { 34 | return amount; 35 | } 36 | 37 | public void setAmount(String amount) { 38 | this.amount = amount; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /MPChartLib/src/main/java/com/github/mikephil/charting/data/BubbleData.java: -------------------------------------------------------------------------------- 1 | 2 | package com.github.mikephil.charting.data; 3 | 4 | import com.github.mikephil.charting.interfaces.datasets.IBubbleDataSet; 5 | 6 | import java.util.List; 7 | 8 | public class BubbleData extends BarLineScatterCandleBubbleData { 9 | 10 | public BubbleData() { 11 | super(); 12 | } 13 | 14 | public BubbleData(IBubbleDataSet... dataSets) { 15 | super(dataSets); 16 | } 17 | 18 | public BubbleData(List dataSets) { 19 | super(dataSets); 20 | } 21 | 22 | 23 | /** 24 | * Sets the width of the circle that surrounds the bubble when highlighted 25 | * for all DataSet objects this data object contains, in dp. 26 | * 27 | * @param width 28 | */ 29 | public void setHighlightCircleWidth(float width) { 30 | for (IBubbleDataSet set : mDataSets) { 31 | set.setHighlightCircleWidth(width); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /MPChartLib/src/main/java/com/github/mikephil/charting/highlight/Range.java: -------------------------------------------------------------------------------- 1 | package com.github.mikephil.charting.highlight; 2 | 3 | /** 4 | * Created by Philipp Jahoda on 24/07/15. Class that represents the range of one value in a stacked bar entry. e.g. 5 | * stack values are -10, 5, 20 -> then ranges are (-10 - 0, 0 - 5, 5 - 25). 6 | */ 7 | public final class Range { 8 | 9 | public float from; 10 | public float to; 11 | 12 | public Range(float from, float to) { 13 | this.from = from; 14 | this.to = to; 15 | } 16 | 17 | /** 18 | * Returns true if this range contains (if the value is in between) the given value, false if not. 19 | * 20 | * @param value 21 | * @return 22 | */ 23 | public boolean contains(float value) { 24 | 25 | if (value > from && value <= to) 26 | return true; 27 | else 28 | return false; 29 | } 30 | 31 | public boolean isLarger(float value) { 32 | return value > to; 33 | } 34 | 35 | public boolean isSmaller(float value) { 36 | return value < from; 37 | } 38 | } -------------------------------------------------------------------------------- /MPChartLib/src/main/java/com/github/mikephil/charting/interfaces/datasets/IRadarDataSet.java: -------------------------------------------------------------------------------- 1 | package com.github.mikephil.charting.interfaces.datasets; 2 | 3 | import com.github.mikephil.charting.data.RadarEntry; 4 | 5 | /** 6 | * Created by Philipp Jahoda on 03/11/15. 7 | */ 8 | public interface IRadarDataSet extends ILineRadarDataSet { 9 | 10 | /// flag indicating whether highlight circle should be drawn or not 11 | boolean isDrawHighlightCircleEnabled(); 12 | 13 | /// Sets whether highlight circle should be drawn or not 14 | void setDrawHighlightCircleEnabled(boolean enabled); 15 | 16 | int getHighlightCircleFillColor(); 17 | 18 | /// The stroke color for highlight circle. 19 | /// If Utils.COLOR_NONE, the color of the dataset is taken. 20 | int getHighlightCircleStrokeColor(); 21 | 22 | int getHighlightCircleStrokeAlpha(); 23 | 24 | float getHighlightCircleInnerRadius(); 25 | 26 | float getHighlightCircleOuterRadius(); 27 | 28 | float getHighlightCircleStrokeWidth(); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /MPChartLib/src/main/java/com/github/mikephil/charting/data/ScatterData.java: -------------------------------------------------------------------------------- 1 | 2 | package com.github.mikephil.charting.data; 3 | 4 | import com.github.mikephil.charting.interfaces.datasets.IScatterDataSet; 5 | 6 | import java.util.List; 7 | 8 | public class ScatterData extends BarLineScatterCandleBubbleData { 9 | 10 | public ScatterData() { 11 | super(); 12 | } 13 | 14 | public ScatterData(List dataSets) { 15 | super(dataSets); 16 | } 17 | 18 | public ScatterData(IScatterDataSet... dataSets) { 19 | super(dataSets); 20 | } 21 | 22 | /** 23 | * Returns the maximum shape-size across all DataSets. 24 | * 25 | * @return 26 | */ 27 | public float getGreatestShapeSize() { 28 | 29 | float max = 0f; 30 | 31 | for (IScatterDataSet set : mDataSets) { 32 | float size = set.getScatterShapeSize(); 33 | 34 | if (size > max) 35 | max = size; 36 | } 37 | 38 | return max; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /MPChartLib/src/main/java/com/github/mikephil/charting/interfaces/datasets/IScatterDataSet.java: -------------------------------------------------------------------------------- 1 | package com.github.mikephil.charting.interfaces.datasets; 2 | 3 | import com.github.mikephil.charting.data.Entry; 4 | import com.github.mikephil.charting.renderer.scatter.IShapeRenderer; 5 | 6 | /** 7 | * Created by philipp on 21/10/15. 8 | */ 9 | public interface IScatterDataSet extends ILineScatterCandleRadarDataSet { 10 | 11 | /** 12 | * Returns the currently set scatter shape size 13 | * 14 | * @return 15 | */ 16 | float getScatterShapeSize(); 17 | 18 | /** 19 | * Returns radius of the hole in the shape 20 | * 21 | * @return 22 | */ 23 | float getScatterShapeHoleRadius(); 24 | 25 | /** 26 | * Returns the color for the hole in the shape 27 | * 28 | * @return 29 | */ 30 | int getScatterShapeHoleColor(); 31 | 32 | /** 33 | * Returns the IShapeRenderer responsible for rendering this DataSet. 34 | * 35 | * @return 36 | */ 37 | IShapeRenderer getShapeRenderer(); 38 | } 39 | -------------------------------------------------------------------------------- /MPChartLib/src/main/java/com/github/mikephil/charting/data/RadarEntry.java: -------------------------------------------------------------------------------- 1 | package com.github.mikephil.charting.data; 2 | 3 | import android.annotation.SuppressLint; 4 | 5 | /** 6 | * Created by philipp on 13/06/16. 7 | */ 8 | @SuppressLint("ParcelCreator") 9 | public class RadarEntry extends Entry { 10 | 11 | public RadarEntry(float value) { 12 | super(0f, value); 13 | } 14 | 15 | public RadarEntry(float value, Object data) { 16 | super(0f, value, data); 17 | } 18 | 19 | /** 20 | * This is the same as getY(). Returns the value of the RadarEntry. 21 | * 22 | * @return 23 | */ 24 | public float getValue() { 25 | return getY(); 26 | } 27 | 28 | public RadarEntry copy() { 29 | RadarEntry e = new RadarEntry(getY(), getData()); 30 | return e; 31 | } 32 | 33 | @Deprecated 34 | @Override 35 | public void setX(float x) { 36 | super.setX(x); 37 | } 38 | 39 | @Deprecated 40 | @Override 41 | public float getX() { 42 | return super.getX(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /MPChartLib/src/main/java/com/github/mikephil/charting/listener/OnDrawListener.java: -------------------------------------------------------------------------------- 1 | package com.github.mikephil.charting.listener; 2 | 3 | import com.github.mikephil.charting.data.DataSet; 4 | import com.github.mikephil.charting.data.Entry; 5 | 6 | /** 7 | * Listener for callbacks when drawing on the chart. 8 | * 9 | * @author Philipp 10 | * 11 | */ 12 | public interface OnDrawListener { 13 | 14 | /** 15 | * Called whenever an entry is added with the finger. Note this is also called for entries that are generated by the 16 | * library, when the touch gesture is too fast and skips points. 17 | * 18 | * @param entry 19 | * the last drawn entry 20 | */ 21 | void onEntryAdded(Entry entry); 22 | 23 | /** 24 | * Called whenever an entry is moved by the user after beeing highlighted 25 | * 26 | * @param entry 27 | */ 28 | void onEntryMoved(Entry entry); 29 | 30 | /** 31 | * Called when drawing finger is lifted and the draw is finished. 32 | * 33 | * @param dataSet 34 | * the last drawn DataSet 35 | */ 36 | void onDrawFinished(DataSet dataSet); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /MPChartLib/src/main/java/com/github/mikephil/charting/interfaces/datasets/ILineScatterCandleRadarDataSet.java: -------------------------------------------------------------------------------- 1 | package com.github.mikephil.charting.interfaces.datasets; 2 | 3 | import android.graphics.DashPathEffect; 4 | 5 | import com.github.mikephil.charting.data.Entry; 6 | 7 | /** 8 | * Created by Philipp Jahoda on 21/10/15. 9 | */ 10 | public interface ILineScatterCandleRadarDataSet extends IBarLineScatterCandleBubbleDataSet { 11 | 12 | /** 13 | * Returns true if vertical highlight indicator lines are enabled (drawn) 14 | * @return 15 | */ 16 | boolean isVerticalHighlightIndicatorEnabled(); 17 | 18 | /** 19 | * Returns true if vertical highlight indicator lines are enabled (drawn) 20 | * @return 21 | */ 22 | boolean isHorizontalHighlightIndicatorEnabled(); 23 | 24 | /** 25 | * Returns the line-width in which highlight lines are to be drawn. 26 | * @return 27 | */ 28 | float getHighlightLineWidth(); 29 | 30 | /** 31 | * Returns the DashPathEffect that is used for highlighting. 32 | * @return 33 | */ 34 | DashPathEffect getDashPathEffectHighlight(); 35 | } 36 | -------------------------------------------------------------------------------- /MPChartLib/src/main/java/com/github/mikephil/charting/renderer/scatter/IShapeRenderer.java: -------------------------------------------------------------------------------- 1 | package com.github.mikephil.charting.renderer.scatter; 2 | 3 | import android.graphics.Canvas; 4 | import android.graphics.Paint; 5 | 6 | import com.github.mikephil.charting.interfaces.datasets.IScatterDataSet; 7 | import com.github.mikephil.charting.utils.ViewPortHandler; 8 | 9 | /** 10 | * Created by wajdic on 15/06/2016. 11 | * Created at Time 09:07 12 | */ 13 | public interface IShapeRenderer 14 | { 15 | 16 | /** 17 | * Renders the provided ScatterDataSet with a shape. 18 | * 19 | * @param c Canvas object for drawing the shape 20 | * @param dataSet The DataSet to be drawn 21 | * @param viewPortHandler Contains information about the current state of the view 22 | * @param posX Position to draw the shape at 23 | * @param posY Position to draw the shape at 24 | * @param renderPaint Paint object used for styling and drawing 25 | */ 26 | void renderShape(Canvas c, IScatterDataSet dataSet, ViewPortHandler viewPortHandler, 27 | float posX, float posY, Paint renderPaint); 28 | } 29 | -------------------------------------------------------------------------------- /MPChartLib/src/test/java/com/github/mikephil/charting/test/ApproximatorTest.java: -------------------------------------------------------------------------------- 1 | package com.github.mikephil.charting.test; 2 | 3 | import com.github.mikephil.charting.data.Entry; 4 | import com.github.mikephil.charting.data.filter.Approximator; 5 | 6 | import org.junit.Test; 7 | 8 | import java.util.ArrayList; 9 | import java.util.List; 10 | 11 | import static junit.framework.Assert.assertEquals; 12 | 13 | /** 14 | * Created by philipp on 07/06/16. 15 | */ 16 | public class ApproximatorTest { 17 | 18 | @Test 19 | public void testApproximation() { 20 | 21 | float[] points = new float[]{ 22 | 10, 20, 23 | 20, 30, 24 | 25, 25, 25 | 30, 28, 26 | 31, 31, 27 | 33, 33, 28 | 40, 40, 29 | 44, 40, 30 | 48, 23, 31 | 50, 20, 32 | 55, 20, 33 | 60, 25}; 34 | 35 | assertEquals(24, points.length); 36 | 37 | Approximator a = new Approximator(); 38 | 39 | float[] reduced = a.reduceWithDouglasPeucker(points, 2); 40 | 41 | assertEquals(18, reduced.length); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 12 | 13 | 14 | 15 | 16 |