├── .gitignore ├── .idea ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── gradle.xml ├── inspectionProfiles │ ├── Project_Default.xml │ └── profiles_settings.xml ├── markdown-navigator.xml ├── markdown-navigator │ └── profiles_settings.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── README.en.md ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── bin │ │ └── david │ │ └── smartchart │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── bin │ │ │ └── david │ │ │ └── smartchart │ │ │ ├── AreaChartActivity.java │ │ │ ├── Bar3DChartActivity.java │ │ │ ├── BarChartActivity.java │ │ │ ├── BarLineChartActivity.java │ │ │ ├── CustomLineChartActivity.java │ │ │ ├── LineChartActivity.java │ │ │ ├── MainActivity.java │ │ │ ├── Pie3DChartActivity.java │ │ │ ├── PieChartActivity.java │ │ │ ├── RadarChartActivity.java │ │ │ ├── RoseChartActivity.java │ │ │ ├── RotateActivity.java │ │ │ ├── RotateChartListActivity.java │ │ │ ├── ScatterChartActivity.java │ │ │ ├── TestChartActivity.java │ │ │ ├── ZoomChartListActivity.java │ │ │ ├── adapter │ │ │ ├── ItemAdapter.java │ │ │ ├── LineAdapter.java │ │ │ ├── RotateChartListAdapter.java │ │ │ └── ZoomChartListAdapter.java │ │ │ ├── bean │ │ │ ├── ChartStyle.java │ │ │ ├── MainItem.java │ │ │ └── SelectItem.java │ │ │ ├── custom │ │ │ ├── CustomMarkView.java │ │ │ ├── MarkPoint.java │ │ │ └── StarPoint.java │ │ │ ├── helper │ │ │ └── DrawHelper.java │ │ │ ├── matrix │ │ │ └── RotateView.java │ │ │ ├── view │ │ │ ├── BaseCheckDialog.java │ │ │ ├── BaseDialog.java │ │ │ ├── BubbleMarkView.java │ │ │ └── QuickChartDialog.java │ │ │ └── weather │ │ │ ├── WeatherBean.java │ │ │ └── WeatherView.java │ └── res │ │ ├── anim │ │ ├── fade_in_center.xml │ │ ├── fade_out_center.xml │ │ ├── modal_in.xml │ │ ├── modal_out.xml │ │ ├── out_to_left.xml │ │ ├── slide_in_bottom.xml │ │ ├── slide_in_top.xml │ │ ├── slide_left_in.xml │ │ ├── slide_left_out.xml │ │ ├── slide_out_bottom.xml │ │ ├── slide_out_top.xml │ │ ├── slide_right_in.xml │ │ └── slide_right_out.xml │ │ ├── drawable │ │ ├── checkbox_btn_drawable.xml │ │ ├── dialog_btn_bg.xml │ │ ├── dialog_white_bg.xml │ │ └── dialog_window_bg.xml │ │ ├── layout │ │ ├── activity_3dbar.xml │ │ ├── activity_bar.xml │ │ ├── activity_bar_line.xml │ │ ├── activity_line.xml │ │ ├── activity_main.xml │ │ ├── activity_pie.xml │ │ ├── activity_pie3d.xml │ │ ├── activity_radar.xml │ │ ├── activity_recycler.xml │ │ ├── activity_rose.xml │ │ ├── activity_rotate.xml │ │ ├── activity_test.xml │ │ ├── item_main.xml │ │ ├── item_pop_calculator.xml │ │ ├── item_rotate_chart.xml │ │ ├── item_zoom_chart.xml │ │ └── pop_base_check.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── avator.jpg │ │ ├── ic_launcher.png │ │ ├── ic_launcher_round.png │ │ ├── icon.png │ │ ├── mark.png │ │ ├── rain.png │ │ ├── round.9.png │ │ ├── sun.png │ │ ├── timg2.jpg │ │ ├── transparent.png │ │ └── wind.png │ │ ├── mipmap-xxhdpi │ │ ├── bg.9.png │ │ ├── ic_launcher.png │ │ ├── ic_launcher_round.png │ │ ├── ic_select_check.png │ │ ├── ic_unselect_check.png │ │ ├── icon.png │ │ ├── triangle.png │ │ └── triangle1.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── attrs.xml │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── bin │ └── david │ └── smartchart │ └── ExampleUnitTest.java ├── build.gradle ├── chart ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── daivd │ │ └── chart │ │ ├── component │ │ ├── ChartTitle.java │ │ ├── EmptyView.java │ │ ├── Legend.java │ │ ├── PicGeneration.java │ │ ├── axis │ │ │ ├── BaseAxis.java │ │ │ ├── HorizontalAxis.java │ │ │ └── VerticalAxis.java │ │ └── base │ │ │ ├── IAxis.java │ │ │ ├── IChartTitle.java │ │ │ ├── IComponent.java │ │ │ ├── IEmpty.java │ │ │ ├── ILegend.java │ │ │ └── PercentComponent.java │ │ ├── core │ │ ├── Bar3DChart.java │ │ ├── BarChart.java │ │ ├── BarLineChart.java │ │ ├── LineChart.java │ │ ├── Pie3DChart.java │ │ ├── PieChart.java │ │ ├── RadarChart.java │ │ ├── RoseChart.java │ │ └── base │ │ │ ├── BaseBarLineChart.java │ │ │ ├── BaseChart.java │ │ │ └── BaseRotateChart.java │ │ ├── data │ │ ├── BarData.java │ │ ├── BarLineData.java │ │ ├── ChartData.java │ │ ├── ColumnData.java │ │ ├── LineData.java │ │ ├── PicOption.java │ │ ├── PieData.java │ │ ├── RadarData.java │ │ ├── RoseData.java │ │ ├── ScaleData.java │ │ ├── ScaleSetData.java │ │ ├── format │ │ │ └── IFormat.java │ │ └── style │ │ │ ├── FontStyle.java │ │ │ ├── IStyle.java │ │ │ ├── LineStyle.java │ │ │ └── PointStyle.java │ │ ├── exception │ │ └── ChartException.java │ │ ├── listener │ │ ├── ChartGestureObserver.java │ │ ├── Observable.java │ │ ├── OnChartChangeListener.java │ │ ├── OnClickColumnListener.java │ │ └── OnClickLegendListener.java │ │ ├── matrix │ │ ├── ITouch.java │ │ ├── MatrixHelper.java │ │ ├── PointEvaluator.java │ │ └── RotateHelper.java │ │ ├── provider │ │ ├── BaseProvider.java │ │ ├── IProvider.java │ │ ├── barLine │ │ │ ├── Bar3DProvider.java │ │ │ ├── BarLineProvider.java │ │ │ ├── BarProvider.java │ │ │ ├── BaseBarLineProvider.java │ │ │ └── LineProvider.java │ │ ├── component │ │ │ ├── cross │ │ │ │ ├── DoubleDriCross.java │ │ │ │ ├── ICross.java │ │ │ │ └── VerticalCross.java │ │ │ ├── grid │ │ │ │ └── IGrid.java │ │ │ ├── level │ │ │ │ ├── ILevel.java │ │ │ │ └── LevelLine.java │ │ │ ├── line │ │ │ │ ├── BrokenLineModel.java │ │ │ │ ├── CurveLineModel.java │ │ │ │ └── ILineModel.java │ │ │ ├── mark │ │ │ │ ├── BubbleMarkView.java │ │ │ │ └── IMark.java │ │ │ ├── path │ │ │ │ ├── IPath.java │ │ │ │ └── LinePath.java │ │ │ ├── point │ │ │ │ ├── ILegendPoint.java │ │ │ │ ├── IPoint.java │ │ │ │ ├── LegendPoint.java │ │ │ │ └── Point.java │ │ │ ├── text │ │ │ │ └── IText.java │ │ │ └── tip │ │ │ │ ├── BaseBubbleTip.java │ │ │ │ ├── ITip.java │ │ │ │ ├── MultiLineBubbleTip.java │ │ │ │ └── SingleLineBubbleTip.java │ │ ├── pie │ │ │ ├── Pie3DProvider.java │ │ │ └── PieProvider.java │ │ ├── radar │ │ │ └── RadarProvider.java │ │ └── rose │ │ │ └── RoseProvider.java │ │ └── utils │ │ ├── ColorUtils.java │ │ ├── DensityUtils.java │ │ └── DrawUtils.java │ └── res │ ├── drawable │ ├── ic_tri.xml │ └── msg.9.png │ ├── mipmap-xxhdpi │ ├── round_rect.9.png │ └── triangle.png │ └── values │ ├── colors.xml │ ├── strings.xml │ └── styles.xml ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── img ├── bar1.png ├── bar2.png ├── dashBorad.png ├── gif │ ├── chart.gif │ ├── rotate.gif │ ├── tip.gif │ ├── viewpager.gif │ └── zoom.gif ├── icon.png ├── line1.png ├── line2.png ├── line3.png ├── line4.png ├── pie.png ├── radar.png ├── rose1.png ├── rose2.png ├── smartChart.apk └── zuoping.jpg └── settings.gradle /.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/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 20 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /.idea/markdown-navigator/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 21 | 22 | 34 | 44 | 45 | 46 | 47 | 48 | 49 | 51 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 25 5 | buildToolsVersion '26.0.2' 6 | 7 | defaultConfig { 8 | applicationId "com.bin.david.smartchart" 9 | minSdkVersion 15 10 | targetSdkVersion 25 11 | versionCode 1 12 | versionName "1.0" 13 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 14 | } 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | } 22 | 23 | dependencies { 24 | compile fileTree(include: ['*.jar'], dir: 'libs') 25 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 26 | exclude group: 'com.android.support', module: 'support-annotations' 27 | }) 28 | compile 'com.android.support:appcompat-v7:25.3.1' 29 | compile 'com.android.support:recyclerview-v7:25.3.1' 30 | compile 'com.android.support.constraint:constraint-layout:1.0.2' 31 | compile 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.31' 32 | testCompile 'junit:junit:4.12' 33 | compile project(':chart') 34 | } 35 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in E:\Android\Sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/bin/david/smartchart/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smartchart; 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 | * Instrumentation 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.bin.david.smartchart", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smartchart/Bar3DChartActivity.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smartchart; 2 | 3 | import android.content.res.Resources; 4 | import android.graphics.DashPathEffect; 5 | import android.os.Bundle; 6 | import android.support.v7.app.AppCompatActivity; 7 | import android.widget.Toast; 8 | 9 | import com.daivd.chart.component.axis.BaseAxis; 10 | import com.daivd.chart.component.base.IComponent; 11 | import com.daivd.chart.core.Bar3DChart; 12 | import com.daivd.chart.data.ChartData; 13 | import com.daivd.chart.provider.component.level.LevelLine; 14 | import com.daivd.chart.data.BarData; 15 | import com.daivd.chart.data.style.FontStyle; 16 | import com.daivd.chart.data.style.PointStyle; 17 | import com.daivd.chart.listener.OnClickColumnListener; 18 | import com.daivd.chart.provider.component.mark.BubbleMarkView; 19 | import com.daivd.chart.provider.component.point.LegendPoint; 20 | import com.daivd.chart.provider.component.point.Point; 21 | 22 | import java.util.ArrayList; 23 | import java.util.List; 24 | 25 | public class Bar3DChartActivity extends AppCompatActivity { 26 | 27 | private Bar3DChart bar3DChart; 28 | @Override 29 | protected void onCreate(Bundle savedInstanceState) { 30 | super.onCreate(savedInstanceState); 31 | setContentView(R.layout.activity_3dbar); 32 | bar3DChart = (Bar3DChart) findViewById(R.id.columnChart); 33 | Resources res = getResources(); 34 | FontStyle.setDefaultTextSpSize(this,12); 35 | List chartYDataList = new ArrayList<>(); 36 | chartYDataList.add("Tokyo"); 37 | chartYDataList.add("Paris"); 38 | chartYDataList.add("Hong Kong"); 39 | chartYDataList.add("Singapore"); 40 | 41 | 42 | List ColumnDatas = new ArrayList<>(); 43 | ArrayList tempList1 = new ArrayList<>(); 44 | tempList1.add(26d); 45 | tempList1.add(35d); 46 | tempList1.add(40d); 47 | tempList1.add(10d); 48 | 49 | 50 | BarData columnData1 = new BarData("Temperature","℃",getResources().getColor(R.color.arc3),tempList1); 51 | ArrayList humidityList = new ArrayList<>(); 52 | humidityList.add(60d); 53 | humidityList.add(50d); 54 | humidityList.add(30d); 55 | humidityList.add(65d); 56 | 57 | BarData columnData2 = new BarData("Humidity","RH%",getResources().getColor(R.color.arc2),humidityList); 58 | ColumnDatas.add(columnData1); 59 | ColumnDatas.add(columnData2); 60 | ChartData chartData = new ChartData<>("3D bar chart",chartYDataList,ColumnDatas); 61 | bar3DChart.setChartData(chartData); 62 | bar3DChart.startChartAnim(1000); 63 | bar3DChart.setZoom(true); 64 | bar3DChart.setShowChartName(true); 65 | //设置标题样式 66 | FontStyle fontStyle = bar3DChart.getChartTitle().getFontStyle(); 67 | fontStyle.setTextColor(res.getColor(R.color.arc23)); 68 | fontStyle.setTextSpSize(this,15); 69 | bar3DChart.getProvider().setOpenMark(true); 70 | bar3DChart.getProvider().setOpenCross(true); 71 | LevelLine levelLine = new LevelLine(20); 72 | DashPathEffect effects = new DashPathEffect(new float[] { 1, 2, 4, 8}, 1); 73 | levelLine.getLineStyle().setWidth(this,1).setColor(res.getColor(R.color.arc23)).setEffect(effects); 74 | bar3DChart.getProvider().addLevelLine(levelLine); 75 | bar3DChart.getProvider().setMarkView(new BubbleMarkView(this)); 76 | LegendPoint legendPoint = (LegendPoint) bar3DChart.getLegend().getPoint(); 77 | PointStyle style = legendPoint.getPointStyle(); 78 | style.setShape(PointStyle.CIRCLE); 79 | BaseAxis vaxis = bar3DChart.getLeftVerticalAxis(); 80 | vaxis.setDrawGrid(true); 81 | bar3DChart.getLeftVerticalAxis().getGridStyle().setEffect(effects); 82 | vaxis.getGridStyle().setColor(R.color.arc_inteval); 83 | bar3DChart.getLegend().setDirection(IComponent.TOP); 84 | bar3DChart.setOnClickColumnListener(new OnClickColumnListener() { 85 | @Override 86 | public void onClickColumn(BarData lineData, int position) { 87 | Toast.makeText(Bar3DChartActivity.this,lineData.getChartYDataList().get(position)+lineData.getUnit(),Toast.LENGTH_SHORT).show(); 88 | } 89 | }); 90 | 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smartchart/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smartchart; 2 | 3 | import android.content.Intent; 4 | import android.support.v7.app.AppCompatActivity; 5 | import android.os.Bundle; 6 | import android.support.v7.widget.LinearLayoutManager; 7 | import android.support.v7.widget.RecyclerView; 8 | import android.view.View; 9 | 10 | import com.bin.david.smartchart.adapter.ItemAdapter; 11 | import com.bin.david.smartchart.adapter.RotateChartListAdapter; 12 | import com.bin.david.smartchart.bean.MainItem; 13 | import com.chad.library.adapter.base.BaseQuickAdapter; 14 | 15 | import java.util.ArrayList; 16 | 17 | public class MainActivity extends AppCompatActivity { 18 | private RecyclerView recyclerView; 19 | private ItemAdapter itemAdapter; 20 | @Override 21 | protected void onCreate(Bundle savedInstanceState) { 22 | super.onCreate(savedInstanceState); 23 | setContentView(R.layout.activity_main); 24 | recyclerView = (RecyclerView) findViewById(R.id.recyclerView); 25 | recyclerView.setLayoutManager(new LinearLayoutManager(this)); 26 | ArrayList items = new ArrayList<>(); 27 | items.add(new MainItem(RotateActivity.class,"Rotate Test")); 28 | items.add(new MainItem(LineChartActivity.class,"Line chart")); 29 | items.add(new MainItem(ScatterChartActivity.class,"Scatter chart")); 30 | items.add(new MainItem(AreaChartActivity.class,"Area chart")); 31 | items.add(new MainItem(BarChartActivity.class,"Bar chart")); 32 | items.add(new MainItem(Bar3DChartActivity.class,"3D bar chart")); 33 | items.add(new MainItem(PieChartActivity.class,"pie chart")); 34 | items.add(new MainItem(Pie3DChartActivity.class,"3D pie chart")); 35 | items.add(new MainItem(RadarChartActivity.class,"Radar chart")); 36 | items.add(new MainItem(RoseChartActivity.class,"Rose chart")); 37 | items.add(new MainItem(BarLineChartActivity.class,"Bar line chart")); 38 | // items.add(new MainItem(TestChartActivity.class,"Custom line chart1")); 39 | items.add(new MainItem(CustomLineChartActivity.class,"Custom line chart2")); 40 | items.add(new MainItem(ZoomChartListActivity.class,"scale chart List(Solving gesture conflict)")); 41 | items.add(new MainItem(RotateChartListActivity.class,"rotate chart List(Solving gesture conflict)")); 42 | itemAdapter = new ItemAdapter(items); 43 | recyclerView.setAdapter(itemAdapter); 44 | itemAdapter.openLoadAnimation(); 45 | itemAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() { 46 | @Override 47 | public void onItemClick(BaseQuickAdapter adapter, View view, int position) { 48 | MainItem mainItem = (MainItem) adapter.getData().get(position); 49 | Intent i = new Intent(MainActivity.this,mainItem.clazz); 50 | startActivity(i); 51 | } 52 | }); 53 | } 54 | 55 | 56 | 57 | } 58 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smartchart/Pie3DChartActivity.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smartchart; 2 | 3 | import android.content.res.Resources; 4 | import android.os.Bundle; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.widget.Toast; 7 | 8 | import com.daivd.chart.component.base.IComponent; 9 | import com.daivd.chart.core.Pie3DChart; 10 | import com.daivd.chart.data.ChartData; 11 | import com.daivd.chart.data.PieData; 12 | import com.daivd.chart.data.style.FontStyle; 13 | import com.daivd.chart.data.style.PointStyle; 14 | import com.daivd.chart.listener.OnClickColumnListener; 15 | import com.daivd.chart.provider.component.mark.BubbleMarkView; 16 | import com.daivd.chart.provider.component.point.LegendPoint; 17 | import com.daivd.chart.provider.component.point.Point; 18 | 19 | import java.util.ArrayList; 20 | import java.util.List; 21 | 22 | public class Pie3DChartActivity extends AppCompatActivity { 23 | 24 | private Pie3DChart pie3DChart; 25 | @Override 26 | protected void onCreate(Bundle savedInstanceState) { 27 | super.onCreate(savedInstanceState); 28 | setContentView(R.layout.activity_pie3d); 29 | pie3DChart = (Pie3DChart) findViewById(R.id.pieChart); 30 | Resources res = getResources(); 31 | FontStyle.setDefaultTextSpSize(this,12); 32 | List chartYDataList = new ArrayList<>(); 33 | chartYDataList.add("Tokyo"); 34 | chartYDataList.add("Paris"); 35 | chartYDataList.add("Hong Kong"); 36 | chartYDataList.add("Singapore"); 37 | 38 | 39 | List pieDatas = new ArrayList<>(); 40 | 41 | 42 | PieData columnData1 = new PieData("Tokyo","℃",getResources().getColor(R.color.arc1),20d); 43 | PieData columnData2 = new PieData("Paris","℃",getResources().getColor(R.color.arc2),15d); 44 | PieData columnData3 = new PieData("Hong Kong","℃",getResources().getColor(R.color.arc3),25d); 45 | PieData columnData4 = new PieData("Singapore","℃",getResources().getColor(R.color.arc21),5d); 46 | pieDatas.add(columnData1); 47 | pieDatas.add(columnData2); 48 | pieDatas.add(columnData3); 49 | pieDatas.add(columnData4); 50 | ChartData chartData = new ChartData<>("3D pie chart",chartYDataList,pieDatas); 51 | pie3DChart.setShowChartName(true); 52 | //设置标题样式 53 | FontStyle fontStyle = pie3DChart.getChartTitle().getFontStyle(); 54 | fontStyle.setTextColor(res.getColor(R.color.arc3)); 55 | fontStyle.setTextSpSize(this,15); 56 | pie3DChart.getProvider().setOpenMark(true); 57 | pie3DChart.getProvider().setMarkView(new BubbleMarkView(this)); 58 | LegendPoint legendPoint = (LegendPoint) pie3DChart.getLegend().getPoint(); 59 | PointStyle style = legendPoint.getPointStyle(); 60 | style.setShape(PointStyle.CIRCLE); 61 | pie3DChart.getLegend().setDirection(IComponent.TOP); 62 | pie3DChart.setRotate(true); 63 | pie3DChart.setChartData(chartData); 64 | pie3DChart.startChartAnim(1000); 65 | pie3DChart.setOnClickColumnListener(new OnClickColumnListener() { 66 | @Override 67 | public void onClickColumn(PieData lineData, int position) { 68 | Toast.makeText(Pie3DChartActivity.this,lineData.getChartYDataList()+lineData.getUnit(),Toast.LENGTH_SHORT).show(); 69 | } 70 | }); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smartchart/PieChartActivity.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smartchart; 2 | 3 | import android.content.res.Resources; 4 | import android.os.Bundle; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.widget.Toast; 7 | 8 | import com.daivd.chart.component.base.IComponent; 9 | import com.daivd.chart.core.PieChart; 10 | import com.daivd.chart.data.ChartData; 11 | import com.daivd.chart.data.PieData; 12 | import com.daivd.chart.data.style.FontStyle; 13 | import com.daivd.chart.data.style.PointStyle; 14 | import com.daivd.chart.listener.OnClickColumnListener; 15 | import com.daivd.chart.provider.component.mark.BubbleMarkView; 16 | import com.daivd.chart.provider.component.point.LegendPoint; 17 | import com.daivd.chart.provider.component.point.Point; 18 | 19 | import java.util.ArrayList; 20 | import java.util.List; 21 | 22 | public class PieChartActivity extends AppCompatActivity { 23 | 24 | private PieChart pieChart; 25 | @Override 26 | protected void onCreate(Bundle savedInstanceState) { 27 | super.onCreate(savedInstanceState); 28 | setContentView(R.layout.activity_pie); 29 | pieChart = (PieChart) findViewById(R.id.pieChart); 30 | Resources res = getResources(); 31 | FontStyle.setDefaultTextSpSize(this,12); 32 | List chartYDataList = new ArrayList<>(); 33 | chartYDataList.add("Tokyo"); 34 | chartYDataList.add("Paris"); 35 | chartYDataList.add("Hong Kong"); 36 | chartYDataList.add("Singapore"); 37 | 38 | 39 | List pieDatas = new ArrayList<>(); 40 | 41 | 42 | PieData columnData1 = new PieData("Tokyo","℃",getResources().getColor(R.color.arc1),20d); 43 | PieData columnData2 = new PieData("Paris","℃",getResources().getColor(R.color.arc2),15d); 44 | PieData columnData3 = new PieData("Hong Kong","℃",getResources().getColor(R.color.arc3),25d); 45 | PieData columnData4 = new PieData("Singapore","℃",getResources().getColor(R.color.arc21),5d); 46 | pieDatas.add(columnData1); 47 | pieDatas.add(columnData2); 48 | pieDatas.add(columnData3); 49 | pieDatas.add(columnData4); 50 | ChartData chartData = new ChartData<>("pie chart",chartYDataList,pieDatas); 51 | pieChart.setShowChartName(true); 52 | //设置标题样式 53 | FontStyle fontStyle = pieChart.getChartTitle().getFontStyle(); 54 | fontStyle.setTextColor(res.getColor(R.color.arc3)); 55 | fontStyle.setTextSpSize(this,15); 56 | pieChart.getProvider().setOpenMark(true); 57 | pieChart.getProvider().setMarkView(new BubbleMarkView(this)); 58 | LegendPoint legendPoint = (LegendPoint)pieChart.getLegend().getPoint(); 59 | PointStyle style = legendPoint.getPointStyle(); 60 | style.setShape(PointStyle.CIRCLE); 61 | pieChart.getLegend().setDirection(IComponent.TOP); 62 | pieChart.setRotate(true); 63 | pieChart.setChartData(chartData); 64 | pieChart.startChartAnim(1000); 65 | pieChart.setOnClickColumnListener(new OnClickColumnListener() { 66 | @Override 67 | public void onClickColumn(PieData lineData, int position) { 68 | Toast.makeText(PieChartActivity.this,lineData.getChartYDataList()+lineData.getUnit(),Toast.LENGTH_SHORT).show(); 69 | } 70 | }); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smartchart/RadarChartActivity.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smartchart; 2 | 3 | import android.content.res.Resources; 4 | import android.os.Bundle; 5 | import android.support.v7.app.AppCompatActivity; 6 | 7 | import com.daivd.chart.component.base.IComponent; 8 | import com.daivd.chart.core.RadarChart; 9 | import com.daivd.chart.data.ChartData; 10 | import com.daivd.chart.data.RadarData; 11 | import com.daivd.chart.data.style.FontStyle; 12 | import com.daivd.chart.data.style.PointStyle; 13 | import com.daivd.chart.provider.component.mark.BubbleMarkView; 14 | import com.daivd.chart.provider.component.point.LegendPoint; 15 | import com.daivd.chart.provider.component.point.Point; 16 | 17 | import java.util.ArrayList; 18 | import java.util.List; 19 | 20 | public class RadarChartActivity extends AppCompatActivity { 21 | 22 | private RadarChart radarChart; 23 | @Override 24 | protected void onCreate(Bundle savedInstanceState) { 25 | super.onCreate(savedInstanceState); 26 | setContentView(R.layout.activity_radar); 27 | 28 | radarChart = (RadarChart) findViewById(R.id.radarChart); 29 | Resources res = getResources(); 30 | FontStyle.setDefaultTextSpSize(this,12); 31 | List chartYDataList = new ArrayList<>(); 32 | chartYDataList.add("Tokyo"); 33 | chartYDataList.add("Paris"); 34 | chartYDataList.add("Hong Kong"); 35 | chartYDataList.add("Singapore"); 36 | chartYDataList.add("Sydney"); 37 | chartYDataList.add("Milano"); 38 | List ColumnDatas = new ArrayList<>(); 39 | ArrayList tempList1 = new ArrayList<>(); 40 | tempList1.add(26d); 41 | tempList1.add(35d); 42 | tempList1.add(40d); 43 | tempList1.add(10d); 44 | tempList1.add(26d); 45 | tempList1.add(35d); 46 | RadarData columnData1 = new RadarData("Temperature","℃",getResources().getColor(R.color.arc3),tempList1); 47 | ArrayList humidityList = new ArrayList<>(); 48 | humidityList.add(60d); 49 | humidityList.add(50d); 50 | humidityList.add(30d); 51 | humidityList.add(65d); 52 | humidityList.add(30d); 53 | humidityList.add(65d); 54 | RadarData columnData2 = new RadarData("Humidity","RH%",getResources().getColor(R.color.arc2),humidityList); 55 | ColumnDatas.add(columnData1); 56 | ColumnDatas.add(columnData2); 57 | ChartData chartData2 = new ChartData<>("Radar chart",chartYDataList,ColumnDatas); 58 | 59 | //开启MarkView 60 | radarChart.getProvider().setOpenMark(true); 61 | //设置MarkView 62 | radarChart.getProvider().setMarkView(new BubbleMarkView(this)); 63 | radarChart.setRotate(true); 64 | 65 | //设置显示标题 66 | radarChart.setShowChartName(true); 67 | //设置标题方向 68 | radarChart.getChartTitle().setDirection(IComponent.TOP); 69 | //设置标题比例 70 | radarChart.getChartTitle().setPercent(0.1f); 71 | //设置标题样式 72 | radarChart.getChartTitle().getFontStyle().setTextColor(res.getColor(R.color.arc23)); 73 | radarChart.getLegend().setDirection(IComponent.BOTTOM); 74 | LegendPoint point = (LegendPoint)radarChart.getLegend().getPoint(); 75 | point.getPointStyle().setShape(PointStyle.SQUARE); 76 | radarChart.getLegend().setPercent(0.2f); 77 | radarChart.setChartData(chartData2); 78 | radarChart.startChartAnim(1000); 79 | 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smartchart/RoseChartActivity.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smartchart; 2 | 3 | import android.content.res.Resources; 4 | import android.os.Bundle; 5 | import android.support.v7.app.AppCompatActivity; 6 | 7 | import com.daivd.chart.component.base.IComponent; 8 | import com.daivd.chart.core.RoseChart; 9 | import com.daivd.chart.data.ChartData; 10 | import com.daivd.chart.data.format.IFormat; 11 | import com.daivd.chart.data.RoseData; 12 | import com.daivd.chart.data.style.FontStyle; 13 | import com.daivd.chart.data.style.PointStyle; 14 | import com.daivd.chart.provider.component.mark.BubbleMarkView; 15 | import com.daivd.chart.provider.component.point.LegendPoint; 16 | import com.daivd.chart.provider.component.point.Point; 17 | 18 | import java.util.ArrayList; 19 | import java.util.List; 20 | import java.util.Random; 21 | 22 | public class RoseChartActivity extends AppCompatActivity { 23 | 24 | private RoseChart roseChart; 25 | @Override 26 | protected void onCreate(Bundle savedInstanceState) { 27 | super.onCreate(savedInstanceState); 28 | setContentView(R.layout.activity_rose); 29 | 30 | roseChart = (RoseChart) findViewById(R.id.radarChart); 31 | Resources res = getResources(); 32 | FontStyle.setDefaultTextSpSize(this,12); 33 | List chartYDataList = new ArrayList<>(); 34 | chartYDataList.add("北"); 35 | chartYDataList.add("北北东"); 36 | chartYDataList.add("东北"); 37 | chartYDataList.add("东北东"); 38 | chartYDataList.add("东"); 39 | chartYDataList.add("东南东"); 40 | chartYDataList.add("东南"); 41 | chartYDataList.add("南南东"); 42 | chartYDataList.add("南"); 43 | chartYDataList.add("南南西"); 44 | chartYDataList.add("西南"); 45 | chartYDataList.add("西南西"); 46 | chartYDataList.add("西"); 47 | chartYDataList.add("西北西"); 48 | chartYDataList.add("西北"); 49 | chartYDataList.add("北北西"); 50 | int[] colors = new int[]{res.getColor(R.color.arc1),res.getColor(R.color.arc2),res.getColor(R.color.arc3),res.getColor(R.color.arc21) 51 | ,res.getColor(R.color.cal_sign_color),res.getColor(R.color.cal_safe_color)}; 52 | List lineDatas = new ArrayList<>(); 53 | for(int j = 0; j<6; j++) { 54 | ArrayList dataList = new ArrayList<>(); 55 | Random random = new Random(); 56 | for (int i = 0; i < 16; i++) { 57 | double num = random.nextInt(20); 58 | dataList.add(num); 59 | } 60 | RoseData columnData1 = new RoseData(j*2+"-"+(j+1)*2+"m/s", "%", colors[j], dataList); 61 | lineDatas.add(columnData1); 62 | } 63 | ChartData chartData2 = new ChartData<>("rose chart",chartYDataList,lineDatas); 64 | 65 | //开启MarkView 66 | roseChart.getProvider().setOpenMark(true); 67 | //设置MarkView 68 | roseChart.getProvider().setMarkView(new BubbleMarkView(this)); 69 | roseChart.setRotate(true); 70 | roseChart.getProvider().setShowScale(true); 71 | //设置显示标题 72 | roseChart.setShowChartName(true); 73 | //设置标题方向 74 | roseChart.getChartTitle().setDirection(IComponent.LEFT); 75 | //设置标题比例 76 | roseChart.getChartTitle().setPercent(0.2f); 77 | //设置标题样式 78 | FontStyle fontStyle = roseChart.getChartTitle().getFontStyle(); 79 | fontStyle.setTextColor(res.getColor(R.color.arc23)); 80 | fontStyle.setTextSpSize(this,16); 81 | roseChart.getLegend().setDirection(IComponent.BOTTOM); 82 | LegendPoint legendPoint = (LegendPoint)roseChart.getLegend().getPoint(); 83 | PointStyle style = legendPoint.getPointStyle(); 84 | style.setShape(PointStyle.SQUARE); 85 | roseChart.getLegend().setPercent(0.2f); 86 | roseChart.getProvider().setScaleFormat(new IFormat() { 87 | @Override 88 | public String format(Double d) { 89 | return d+"%"; 90 | } 91 | }); 92 | roseChart.setChartData(chartData2); 93 | roseChart.setFirstAnim(false); 94 | roseChart.startChartAnim(1000); 95 | 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smartchart/RotateActivity.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smartchart; 2 | 3 | import android.animation.Animator; 4 | import android.animation.AnimatorListenerAdapter; 5 | import android.animation.AnimatorSet; 6 | import android.animation.ObjectAnimator; 7 | import android.os.Bundle; 8 | import android.support.annotation.Nullable; 9 | import android.support.v7.app.AppCompatActivity; 10 | import android.view.View; 11 | import android.view.animation.AnimationSet; 12 | 13 | import com.bin.david.smartchart.matrix.RotateView; 14 | 15 | /** 16 | * Created by huang on 2017/10/24. 17 | */ 18 | 19 | public class RotateActivity extends AppCompatActivity { 20 | 21 | private RotateView rotateView; 22 | @Override 23 | protected void onCreate(@Nullable Bundle savedInstanceState) { 24 | super.onCreate(savedInstanceState); 25 | setContentView(R.layout.activity_rotate); 26 | rotateView = (RotateView) findViewById(R.id.rotateView); 27 | 28 | } 29 | 30 | public void onClick(View view){ 31 | ObjectAnimator animator1 = ObjectAnimator.ofInt(rotateView,"rotateX",0,60,0); 32 | animator1.setDuration(500); 33 | ObjectAnimator animator2 = ObjectAnimator.ofInt(rotateView,"rotateY",0,30); 34 | animator2.setDuration(200); 35 | ObjectAnimator animator3 = ObjectAnimator.ofInt(rotateView,"rotateAngle",0,360); 36 | animator3.setDuration(2000); 37 | ObjectAnimator animator4 = ObjectAnimator.ofInt(rotateView,"rotateY",30,0); 38 | animator4.setDuration(200); 39 | AnimatorSet set = new AnimatorSet(); 40 | set.addListener(new AnimatorListenerAdapter() { 41 | @Override 42 | public void onAnimationCancel(Animator animation) { 43 | super.onAnimationCancel(animation); 44 | rotateView.setRotateY(0); 45 | rotateView.setRotateX(0); 46 | rotateView.setRotateAngle(0); 47 | } 48 | 49 | @Override 50 | public void onAnimationEnd(Animator animation) { 51 | super.onAnimationEnd(animation); 52 | rotateView.setRotateY(0); 53 | rotateView.setRotateX(0); 54 | rotateView.setRotateAngle(0); 55 | } 56 | }); 57 | set.playSequentially(animator1,animator2,animator3,animator4); 58 | set.start(); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smartchart/RotateChartListActivity.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smartchart; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.support.v7.widget.LinearLayoutManager; 7 | import android.support.v7.widget.RecyclerView; 8 | 9 | import com.bin.david.smartchart.adapter.RotateChartListAdapter; 10 | import com.bin.david.smartchart.adapter.ZoomChartListAdapter; 11 | 12 | import java.util.ArrayList; 13 | 14 | /** 15 | * Created by huang on 2017/10/18. 16 | */ 17 | 18 | public class RotateChartListActivity extends AppCompatActivity { 19 | private RecyclerView recyclerView; 20 | private RotateChartListAdapter itemAdapter; 21 | @Override 22 | protected void onCreate(@Nullable Bundle savedInstanceState) { 23 | super.onCreate(savedInstanceState); 24 | setContentView(R.layout.activity_recycler); 25 | recyclerView = (RecyclerView) findViewById(R.id.recyclerView); 26 | recyclerView.setLayoutManager(new LinearLayoutManager(this)); 27 | ArrayList items = new ArrayList<>(); 28 | for(int i = 0;i <100;i++){ 29 | items.add(i+""); 30 | } 31 | itemAdapter = new RotateChartListAdapter(items); 32 | recyclerView.setAdapter(itemAdapter); 33 | itemAdapter.openLoadAnimation(); 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smartchart/TestChartActivity.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smartchart; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.AppCompatActivity; 5 | 6 | import com.bin.david.smartchart.helper.DrawHelper; 7 | import com.daivd.chart.core.LineChart; 8 | 9 | 10 | public class TestChartActivity extends AppCompatActivity { 11 | 12 | 13 | LineChart lineChart2; 14 | LineChart lineChart; 15 | LineChart lineChart3; 16 | LineChart lineChart4; 17 | LineChart lineChart5; 18 | LineChart lineChart6; 19 | 20 | 21 | @Override 22 | protected void onCreate(Bundle savedInstanceState) { 23 | super.onCreate(savedInstanceState); 24 | setContentView(R.layout.activity_test); 25 | lineChart = (LineChart) findViewById(R.id.lineChart); 26 | lineChart2 = (LineChart) findViewById(R.id.lineChart2); 27 | lineChart3= (LineChart) findViewById(R.id.lineChart3); 28 | lineChart4 = (LineChart) findViewById(R.id.lineChart4); 29 | lineChart5 = (LineChart) findViewById(R.id.lineChart5); 30 | lineChart6 = (LineChart) findViewById(R.id.lineChart6); 31 | DrawHelper.drawWeatherChart(this, lineChart); 32 | DrawHelper.drawFrozenSoilChart(this, lineChart2); 33 | DrawHelper.drawGroundTempChart(this, lineChart3); 34 | DrawHelper.drawFactorChart(this, lineChart4); 35 | DrawHelper.drawSoilChart(this, lineChart5); 36 | DrawHelper.drawHomeWeatherChart(this,lineChart6); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smartchart/ZoomChartListActivity.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smartchart; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.support.v7.widget.LinearLayoutManager; 7 | import android.support.v7.widget.RecyclerView; 8 | 9 | import com.bin.david.smartchart.adapter.ZoomChartListAdapter; 10 | 11 | import java.util.ArrayList; 12 | 13 | /** 14 | * Created by huang on 2017/10/18. 15 | */ 16 | 17 | public class ZoomChartListActivity extends AppCompatActivity { 18 | private RecyclerView recyclerView; 19 | private ZoomChartListAdapter itemAdapter; 20 | @Override 21 | protected void onCreate(@Nullable Bundle savedInstanceState) { 22 | super.onCreate(savedInstanceState); 23 | setContentView(R.layout.activity_recycler); 24 | recyclerView = (RecyclerView) findViewById(R.id.recyclerView); 25 | recyclerView.setLayoutManager(new LinearLayoutManager(this)); 26 | ArrayList items = new ArrayList<>(); 27 | for(int i = 0;i <100;i++){ 28 | items.add(i+""); 29 | } 30 | itemAdapter = new ZoomChartListAdapter(items); 31 | recyclerView.setAdapter(itemAdapter); 32 | itemAdapter.openLoadAnimation(); 33 | 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smartchart/adapter/ItemAdapter.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smartchart.adapter; 2 | 3 | import android.support.annotation.LayoutRes; 4 | import android.support.annotation.Nullable; 5 | 6 | import com.bin.david.smartchart.R; 7 | import com.bin.david.smartchart.bean.MainItem; 8 | import com.chad.library.adapter.base.BaseQuickAdapter; 9 | import com.chad.library.adapter.base.BaseViewHolder; 10 | 11 | import java.util.List; 12 | 13 | /** 14 | * Created by huang on 2017/10/13. 15 | */ 16 | 17 | public class ItemAdapter extends BaseQuickAdapter { 18 | 19 | 20 | public ItemAdapter( @Nullable List data) { 21 | super(R.layout.item_main, data); 22 | } 23 | 24 | @Override 25 | protected void convert(BaseViewHolder helper, MainItem item) { 26 | helper.setText(R.id.tv_chart_name,item.chartName); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smartchart/adapter/LineAdapter.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smartchart.adapter; 2 | 3 | import android.support.annotation.Nullable; 4 | 5 | import com.bin.david.smartchart.R; 6 | import com.bin.david.smartchart.bean.ChartStyle; 7 | import com.bin.david.smartchart.bean.MainItem; 8 | import com.bin.david.smartchart.bean.SelectItem; 9 | import com.chad.library.adapter.base.BaseQuickAdapter; 10 | import com.chad.library.adapter.base.BaseViewHolder; 11 | 12 | import java.util.List; 13 | 14 | /** 15 | * Created by huang on 2017/10/13. 16 | */ 17 | 18 | public class LineAdapter extends BaseQuickAdapter { 19 | 20 | 21 | public LineAdapter(@Nullable List data) { 22 | super(R.layout.item_main, data); 23 | } 24 | 25 | @Override 26 | protected void convert(BaseViewHolder helper, ChartStyle item) { 27 | helper.setText(R.id.tv_chart_name,item.value); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smartchart/adapter/RotateChartListAdapter.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smartchart.adapter; 2 | 3 | import android.content.res.Resources; 4 | import android.support.annotation.Nullable; 5 | 6 | import com.bin.david.smartchart.R; 7 | import com.chad.library.adapter.base.BaseQuickAdapter; 8 | import com.chad.library.adapter.base.BaseViewHolder; 9 | import com.daivd.chart.component.base.IComponent; 10 | import com.daivd.chart.core.PieChart; 11 | import com.daivd.chart.data.ChartData; 12 | import com.daivd.chart.data.PieData; 13 | import com.daivd.chart.data.style.FontStyle; 14 | import com.daivd.chart.data.style.PointStyle; 15 | import com.daivd.chart.provider.component.mark.BubbleMarkView; 16 | import com.daivd.chart.provider.component.point.LegendPoint; 17 | import com.daivd.chart.provider.component.point.Point; 18 | 19 | import java.util.ArrayList; 20 | import java.util.List; 21 | 22 | /** 23 | * Created by huang on 2017/10/13. 24 | */ 25 | 26 | public class RotateChartListAdapter extends BaseQuickAdapter { 27 | 28 | 29 | 30 | public RotateChartListAdapter(@Nullable List data) { 31 | super(R.layout.item_rotate_chart, data); 32 | } 33 | 34 | @Override 35 | protected void convert(BaseViewHolder helper, String item) { 36 | PieChart pieChart = helper.getView(R.id.pieChart); 37 | Resources res = mContext.getResources(); 38 | FontStyle.setDefaultTextSpSize(mContext,12); 39 | List chartYDataList = new ArrayList<>(); 40 | chartYDataList.add("Tokyo"); 41 | chartYDataList.add("Paris"); 42 | chartYDataList.add("Hong Kong"); 43 | chartYDataList.add("Singapore"); 44 | 45 | 46 | List pieDatas = new ArrayList<>(); 47 | 48 | 49 | PieData columnData1 = new PieData("Tokyo","℃",res.getColor(R.color.arc1),20d); 50 | PieData columnData2 = new PieData("Paris","℃",res.getColor(R.color.arc2),15d); 51 | PieData columnData3 = new PieData("Hong Kong","℃",res.getColor(R.color.arc3),25d); 52 | PieData columnData4 = new PieData("Singapore","℃",res.getColor(R.color.arc21),5d); 53 | pieDatas.add(columnData1); 54 | pieDatas.add(columnData2); 55 | pieDatas.add(columnData3); 56 | pieDatas.add(columnData4); 57 | ChartData chartData = new ChartData<>("pie chart",chartYDataList,pieDatas); 58 | pieChart.setShowChartName(true); 59 | //设置标题样式 60 | FontStyle fontStyle = pieChart.getChartTitle().getFontStyle(); 61 | fontStyle.setTextColor(res.getColor(R.color.arc3)); 62 | fontStyle.setTextSpSize(mContext,15); 63 | pieChart.getProvider().setOpenMark(true); 64 | pieChart.getProvider().setMarkView(new BubbleMarkView(mContext)); 65 | LegendPoint legendPoint = (LegendPoint) pieChart.getLegend().getPoint(); 66 | PointStyle style = legendPoint.getPointStyle(); 67 | style.setShape(PointStyle.CIRCLE); 68 | pieChart.getLegend().setDirection(IComponent.TOP); 69 | pieChart.setRotate(true); 70 | pieChart.setChartData(chartData); 71 | pieChart.startChartAnim(1000); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smartchart/bean/ChartStyle.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smartchart.bean; 2 | 3 | /** 4 | * Created by huang on 2017/10/13. 5 | */ 6 | 7 | public enum ChartStyle { 8 | 9 | LINE_TYPE("Line type"), 10 | LINE_STYLE("Line style"), 11 | LEGEND_POSITION("Legend position"), 12 | LEGEND_TYPE("Legend type"), 13 | LEGEND_CLICK("Legend click"), 14 | LINE_SHOWPOINT("Show Point"), 15 | LINE_POINT_STYLE("Point style"), 16 | LINE_TEXT("Show point value"), 17 | ZOOM("Zoom"), 18 | SHOW_TITLE("Show title"), 19 | TITLE_POSITON("Show title position"), 20 | CROSS("Open cross"), 21 | MARK_VIEW("Show mark view"), 22 | H_GRID("Show horizontal grid"), 23 | SHOW_LINE("Show line"), 24 | SHOW_AREA("Show area"), 25 | V_GRID("Show vertical grid"), 26 | ROATE_ANGLE("Horizontal axis value angle"); 27 | 28 | 29 | 30 | public String value; 31 | 32 | ChartStyle(String value){ 33 | this.value = value; 34 | } 35 | 36 | 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smartchart/bean/MainItem.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smartchart.bean; 2 | 3 | /** 4 | * Created by huang on 2017/10/13. 5 | */ 6 | 7 | public class MainItem { 8 | 9 | public Class clazz; 10 | public String chartName; 11 | 12 | public MainItem(Class clazz, String chartName) { 13 | this.clazz = clazz; 14 | this.chartName = chartName; 15 | } 16 | 17 | public Class getClazz() { 18 | return clazz; 19 | } 20 | 21 | public void setClazz(Class clazz) { 22 | this.clazz = clazz; 23 | } 24 | 25 | public String getChartName() { 26 | return chartName; 27 | } 28 | 29 | public void setChartName(String chartName) { 30 | this.chartName = chartName; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smartchart/bean/SelectItem.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smartchart.bean; 2 | 3 | /** 4 | * Created by huang on 2017/10/13. 5 | */ 6 | 7 | public class SelectItem { 8 | private ChartStyle style; 9 | private int position; 10 | 11 | public SelectItem(ChartStyle style) { 12 | this.style = style; 13 | } 14 | 15 | public ChartStyle getStyle() { 16 | return style; 17 | } 18 | 19 | public void setStyle(ChartStyle style) { 20 | this.style = style; 21 | } 22 | 23 | public int getPosition() { 24 | return position; 25 | } 26 | 27 | public void setPosition(int position) { 28 | this.position = position; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smartchart/custom/CustomMarkView.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smartchart.custom; 2 | 3 | 4 | import android.content.Context; 5 | import android.graphics.Canvas; 6 | import android.graphics.Color; 7 | import android.graphics.Paint; 8 | import android.graphics.Rect; 9 | 10 | import com.bin.david.smartchart.R; 11 | import com.daivd.chart.data.BarData; 12 | import com.daivd.chart.provider.component.mark.IMark; 13 | import com.daivd.chart.provider.component.tip.SingleLineBubbleTip; 14 | import com.daivd.chart.utils.DensityUtils; 15 | 16 | /** 17 | * Created by huang on 2017/9/28. 18 | */ 19 | 20 | public class CustomMarkView implements IMark { 21 | 22 | private SingleLineBubbleTip bubbleTip; 23 | private Paint paint; 24 | 25 | public CustomMarkView(Context context) { 26 | paint = new Paint(); 27 | paint.setAntiAlias(true); 28 | paint.setTextSize(DensityUtils.sp2px(context,13)); 29 | paint.setStyle(Paint.Style.FILL); 30 | paint.setColor(Color.WHITE); 31 | bubbleTip = new SingleLineBubbleTip(context, R.mipmap.bg,R.mipmap.triangle1,paint){ 32 | 33 | @Override 34 | public boolean isShowTip(String s,int position) { 35 | return true; 36 | } 37 | 38 | @Override 39 | public String format(String s, int position) { 40 | return s; 41 | } 42 | }; 43 | bubbleTip.setColorFilter(Color.parseColor("#F4A460")); 44 | bubbleTip.setAlpha(0.8f); 45 | } 46 | 47 | 48 | 49 | public Paint getPaint() { 50 | return paint; 51 | } 52 | 53 | @Override 54 | public void drawMark(Canvas canvas, float x, float y, Rect rect, String content, BarData data, int position) { 55 | 56 | String text = content + data.getChartYDataList().get(position) + data.getUnit(); 57 | bubbleTip.drawTip(canvas, x, y, rect, text,position); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smartchart/custom/MarkPoint.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smartchart.custom; 2 | 3 | import android.content.Context; 4 | import android.graphics.Bitmap; 5 | import android.graphics.BitmapFactory; 6 | import android.graphics.Canvas; 7 | import android.graphics.Paint; 8 | import android.graphics.PorterDuff; 9 | import android.graphics.PorterDuffXfermode; 10 | import android.graphics.Rect; 11 | 12 | import com.bin.david.smartchart.R; 13 | import com.daivd.chart.provider.component.point.IPoint; 14 | 15 | /** 16 | * Created by huang on 2017/10/26. 17 | */ 18 | 19 | public class MarkPoint implements IPoint { 20 | private Bitmap markBitmap; 21 | private Bitmap avatorBitmap; 22 | private Rect bitmapRect; 23 | private Rect avatorBitmapRect; 24 | private Rect rect; 25 | private int height; 26 | private int width; 27 | private PorterDuffXfermode xFermode; 28 | 29 | public MarkPoint(Context context,int height){ 30 | markBitmap = BitmapFactory.decodeResource(context.getResources(), R.mipmap.mark); 31 | BitmapFactory.Options options = new BitmapFactory.Options(); 32 | options.inSampleSize = 4; 33 | avatorBitmap = BitmapFactory.decodeResource(context.getResources(), R.mipmap.avator,options); 34 | bitmapRect = new Rect(0,0,markBitmap.getWidth(),markBitmap.getHeight()); 35 | avatorBitmapRect = new Rect(0,0,avatorBitmap.getWidth(),avatorBitmap.getHeight()); 36 | this.height = height; 37 | rect = new Rect(); 38 | this.width = markBitmap.getWidth()*this.height/markBitmap.getHeight(); 39 | xFermode = new PorterDuffXfermode(PorterDuff.Mode.SRC_IN); 40 | 41 | } 42 | 43 | 44 | 45 | 46 | @Override 47 | public void drawPoint(Canvas canvas, float x, float y, int position, boolean isShowDefaultColor, Paint paint) { 48 | rect.top = (int) (y - height); 49 | rect.bottom = (int) y; 50 | rect.right = (int) (x + width/2); 51 | rect.left = (int)(x - width/2); 52 | canvas.drawBitmap(markBitmap,bitmapRect,rect,paint); 53 | int layerId = canvas.saveLayer(rect.left,rect.top,rect.right,rect.bottom , null, Canvas.ALL_SAVE_FLAG); 54 | rect.bottom = rect.top+rect.width(); 55 | paint.setStyle(Paint.Style.FILL); 56 | canvas.drawCircle(rect.centerX(),rect.centerY(),rect.width()/2,paint); 57 | paint.setXfermode(xFermode); 58 | canvas.drawBitmap(avatorBitmap, avatorBitmapRect,rect,paint); 59 | paint.setXfermode(null); 60 | canvas.restoreToCount(layerId);//将自己创建的画布Layer绘制到画布默认的Layer 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smartchart/custom/StarPoint.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smartchart.custom; 2 | 3 | import android.graphics.Canvas; 4 | import android.graphics.Color; 5 | import android.graphics.Paint; 6 | import android.graphics.Path; 7 | 8 | import com.daivd.chart.provider.component.point.IPoint; 9 | 10 | /** 11 | * Created by huang on 2017/10/26. 12 | */ 13 | 14 | public class StarPoint implements IPoint { 15 | private Path mPath; 16 | private int radius; 17 | private int color; 18 | 19 | public StarPoint(int radius,int color){ 20 | this.radius = radius; 21 | this.color = color; 22 | this.mPath =new Path(); 23 | } 24 | 25 | 26 | 27 | 28 | /** 29 | * 五角星Path 30 | * @return 31 | */ 32 | public static float[] fivePoints(float xA, float yA, int rFive) { 33 | float xB = 0; 34 | float xC = 0; 35 | float xD = 0; 36 | float xE = 0; 37 | float yB = 0; 38 | float yC = 0; 39 | float yD = 0; 40 | float yE = 0; 41 | xD = (float) (xA - rFive * Math.sin(Math.toRadians(18))); 42 | xC = (float) (xA + rFive * Math.sin(Math.toRadians(18))); 43 | yD = yC = (float) (yA + Math.cos(Math.toRadians(18)) * rFive); 44 | yB = yE = (float) (yA + Math.sqrt(Math.pow((xC - xD), 2) - Math.pow((rFive / 2), 2))); 45 | xB = xA + (rFive / 2); 46 | xE = xA - (rFive / 2); 47 | float[] floats = new float[]{xA, yA, xD, yD,xB, yB, xE, yE, xC, yC}; 48 | return floats; 49 | } 50 | 51 | @Override 52 | public void drawPoint(Canvas canvas, float x, float y, int position, boolean isShowDefaultColor, Paint paint) { 53 | paint.setStyle(Paint.Style.FILL); 54 | paint.setColor(color); 55 | mPath.reset(); 56 | float[] floats = fivePoints(x,y-radius/2,radius); 57 | for (int i = 0; i < floats.length - 1; i++) { 58 | if(i == 0){ 59 | mPath.moveTo(floats[i], floats[i += 1]); 60 | }else { 61 | mPath.lineTo(floats[i], floats[i += 1]); 62 | } 63 | } 64 | mPath.close(); 65 | canvas.drawPath(mPath,paint); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smartchart/matrix/RotateView.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smartchart.matrix; 2 | 3 | import android.content.Context; 4 | import android.graphics.Bitmap; 5 | import android.graphics.BitmapFactory; 6 | import android.graphics.Camera; 7 | import android.graphics.Canvas; 8 | import android.graphics.Paint; 9 | import android.graphics.Rect; 10 | import android.support.annotation.Keep; 11 | import android.support.annotation.Nullable; 12 | import android.util.AttributeSet; 13 | import android.util.DisplayMetrics; 14 | import android.view.View; 15 | 16 | import com.bin.david.smartchart.R; 17 | 18 | /** 19 | * Created by huang on 2017/10/24. 20 | */ 21 | 22 | public class RotateView extends View { 23 | 24 | private Bitmap bitmap; 25 | private Paint paint; 26 | private Rect bitmapRect; 27 | private Rect rect; 28 | private Camera camera; 29 | private int rotateAngle; 30 | private int rotateX; 31 | private int rotateY; 32 | 33 | public RotateView(Context context) { 34 | this(context,null); 35 | } 36 | 37 | public RotateView(Context context, @Nullable AttributeSet attrs) { 38 | this(context, attrs,0); 39 | } 40 | 41 | public RotateView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { 42 | super(context, attrs, defStyleAttr); 43 | init(); 44 | 45 | 46 | } 47 | 48 | private void init() { 49 | paint = new Paint(); 50 | paint.setAntiAlias(true); 51 | bitmap = BitmapFactory.decodeResource(getResources(), R.mipmap.timg2); 52 | bitmapRect = new Rect(0,0,bitmap.getWidth(),bitmap.getHeight()); 53 | rect = new Rect(); 54 | camera = new Camera(); 55 | DisplayMetrics displayMetrics = getResources().getDisplayMetrics(); 56 | float newZ = -displayMetrics.density * 6; 57 | camera.setLocation(0,0,newZ); 58 | } 59 | 60 | @Override 61 | protected void onSizeChanged(int w, int h, int oldw, int oldh) { 62 | super.onSizeChanged(w, h, oldw, oldh); 63 | rect.top = h/4; 64 | rect.left = w/4; 65 | rect.right = w -rect.left; 66 | rect.bottom = h-rect.top; 67 | 68 | } 69 | 70 | @Override 71 | protected void onDraw(Canvas canvas) { 72 | super.onDraw(canvas); 73 | canvas.save(); 74 | camera.save(); 75 | canvas.translate(rect.centerX(),rect.centerY()); 76 | canvas.rotate(-rotateAngle); 77 | camera.rotateX(-rotateY); 78 | camera.applyToCanvas(canvas); 79 | canvas.rotate(rotateAngle); 80 | canvas.translate(-rect.centerX(),-rect.centerY()); 81 | 82 | canvas.save(); 83 | canvas.translate(rect.centerX(),rect.centerY()); 84 | camera.rotateX(-rotateX); 85 | camera.applyToCanvas(canvas); 86 | canvas.translate(-rect.centerX(),-rect.centerY()); 87 | canvas.clipRect(rect.left,rect.top,rect.right,rect.bottom-rect.height()/2); 88 | canvas.drawBitmap(bitmap,bitmapRect,rect,paint); 89 | canvas.restore(); 90 | 91 | canvas.save(); 92 | canvas.clipRect(rect.left,rect.bottom-rect.height()/2,rect.right,rect.bottom); 93 | canvas.drawBitmap(bitmap,bitmapRect,rect,paint); 94 | canvas.restore(); 95 | 96 | camera.restore(); 97 | canvas.restore(); 98 | 99 | 100 | } 101 | 102 | public int getRotateX() { 103 | return rotateX; 104 | } 105 | @Keep 106 | public void setRotateX(int rotateX) { 107 | this.rotateX = rotateX; 108 | invalidate(); 109 | } 110 | 111 | public int getRotateAngle() { 112 | return rotateAngle; 113 | } 114 | @Keep 115 | public void setRotateAngle(int rotateAngle) { 116 | this.rotateAngle = rotateAngle; 117 | invalidate(); 118 | } 119 | 120 | public int getRotateY() { 121 | return rotateY; 122 | } 123 | @Keep 124 | public void setRotateY(int rotateY) { 125 | this.rotateY = rotateY; 126 | invalidate(); 127 | } 128 | 129 | 130 | } 131 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smartchart/view/BubbleMarkView.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smartchart.view; 2 | 3 | 4 | import android.content.Context; 5 | import android.graphics.Canvas; 6 | import android.graphics.Paint; 7 | import android.graphics.Rect; 8 | 9 | import com.bin.david.smartchart.R; 10 | import com.daivd.chart.data.BarData; 11 | import com.daivd.chart.provider.component.mark.IMark; 12 | import com.daivd.chart.provider.component.tip.SingleLineBubbleTip; 13 | import com.daivd.chart.utils.DensityUtils; 14 | 15 | /** 16 | * Created by huang on 2017/9/28. 17 | */ 18 | 19 | public class BubbleMarkView implements IMark { 20 | 21 | private SingleLineBubbleTip bubbleTip; 22 | private Paint paint; 23 | 24 | public BubbleMarkView(Context context, int color) { 25 | paint = new Paint(); 26 | paint.setAntiAlias(true); 27 | paint.setTextSize(DensityUtils.sp2px(context,13)); 28 | paint.setStyle(Paint.Style.FILL); 29 | paint.setColor(color); 30 | bubbleTip = new SingleLineBubbleTip(context, R.mipmap.round,R.mipmap.transparent,paint){ 31 | 32 | @Override 33 | public boolean isShowTip(String s,int position) { 34 | return true; 35 | } 36 | 37 | @Override 38 | public String format(String s, int position) { 39 | return s; 40 | } 41 | }; 42 | bubbleTip.setHorizontalPadding(DensityUtils.dp2px(context,10)); 43 | } 44 | 45 | 46 | 47 | public Paint getPaint() { 48 | return paint; 49 | } 50 | 51 | @Override 52 | public void drawMark(Canvas canvas, float x, float y, Rect rect, String content, BarData data, int position) { 53 | 54 | String text =data.getChartYDataList().get(position) + data.getUnit(); 55 | bubbleTip.drawTip(canvas, x, y, rect, text,position); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smartchart/view/QuickChartDialog.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smartchart.view; 2 | 3 | import android.app.Activity; 4 | 5 | import com.bin.david.smartchart.LineChartActivity; 6 | import com.bin.david.smartchart.bean.ChartStyle; 7 | import com.daivd.chart.core.LineChart; 8 | 9 | import java.util.ArrayList; 10 | import java.util.Arrays; 11 | import java.util.HashMap; 12 | import java.util.List; 13 | import java.util.Map; 14 | 15 | /** 16 | * Created by huang on 2017/10/13. 17 | */ 18 | 19 | public class QuickChartDialog { 20 | private Map> map; 21 | 22 | public QuickChartDialog(){ 23 | map = new HashMap<>(); 24 | } 25 | 26 | public void showDialog(Activity activity,ChartStyle chartStyle,String[] dataList,OnCheckChangeAdapter adapter){ 27 | BaseCheckDialog dialog; 28 | if(map.containsKey(chartStyle)){ 29 | dialog = map.get(chartStyle); 30 | }else { 31 | dialog = new BaseCheckDialog<>(chartStyle.value,adapter); 32 | } 33 | map.put(chartStyle,dialog); 34 | dialog.show(activity,false, Arrays.asList(dataList)); 35 | } 36 | 37 | public abstract static class OnCheckChangeAdapter implements BaseCheckDialog.OnCheckChangeListener { 38 | @Override 39 | public String getItemText(String s) { 40 | return s; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smartchart/weather/WeatherBean.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smartchart.weather; 2 | 3 | /** 4 | * Created by huang on 2017/11/30. 5 | */ 6 | 7 | public class WeatherBean { 8 | 9 | private String date; 10 | private String week; 11 | private String fristWeather; 12 | private String lastWeather; 13 | private String wind; 14 | private String hightTemp; 15 | private String lowTemp; 16 | 17 | public String getDate() { 18 | return date; 19 | } 20 | 21 | public void setDate(String date) { 22 | this.date = date; 23 | } 24 | 25 | public String getWeek() { 26 | return week; 27 | } 28 | 29 | public void setWeek(String week) { 30 | this.week = week; 31 | } 32 | 33 | public String getFristWeather() { 34 | return fristWeather; 35 | } 36 | 37 | public void setFristWeather(String fristWeather) { 38 | this.fristWeather = fristWeather; 39 | } 40 | 41 | public String getLastWeather() { 42 | return lastWeather; 43 | } 44 | 45 | public void setLastWeather(String lastWeather) { 46 | this.lastWeather = lastWeather; 47 | } 48 | 49 | public String getWind() { 50 | return wind; 51 | } 52 | 53 | public void setWind(String wind) { 54 | this.wind = wind; 55 | } 56 | 57 | public String getHightTemp() { 58 | return hightTemp; 59 | } 60 | 61 | public void setHightTemp(String hightTemp) { 62 | this.hightTemp = hightTemp; 63 | } 64 | 65 | public String getLowTemp() { 66 | return lowTemp; 67 | } 68 | 69 | public void setLowTemp(String lowTemp) { 70 | this.lowTemp = lowTemp; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smartchart/weather/WeatherView.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smartchart.weather; 2 | 3 | import android.content.Context; 4 | import android.content.res.TypedArray; 5 | import android.graphics.Canvas; 6 | 7 | import android.support.annotation.Nullable; 8 | import android.util.AttributeSet; 9 | import android.widget.LinearLayout; 10 | 11 | import com.bin.david.smartchart.R; 12 | import com.daivd.chart.utils.DensityUtils; 13 | 14 | 15 | /** 16 | * Created by huang on 2017/11/30. 17 | */ 18 | 19 | public class WeatherView extends LinearLayout { 20 | 21 | private int columnWidth; 22 | private int columnSize; 23 | private int width; 24 | private int height; 25 | 26 | 27 | public WeatherView(Context context, @Nullable AttributeSet attrs) { 28 | super(context, attrs); 29 | init(context,attrs); 30 | } 31 | 32 | public WeatherView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { 33 | super(context, attrs, defStyleAttr); 34 | init(context,attrs); 35 | } 36 | 37 | 38 | 39 | private void init(Context context, @Nullable AttributeSet attrs){ 40 | 41 | TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.weatherView); 42 | columnWidth = (int) a.getDimension(R.styleable.weatherView_weatherColumnWidth, 43 | DensityUtils.dp2px(context,50)); 44 | columnSize = a.getInt(R.styleable.weatherView_weatherColumnCount, 7); 45 | a.recycle(); 46 | } 47 | 48 | @Override 49 | protected void onSizeChanged(int w, int h, int oldw, int oldh) { 50 | super.onSizeChanged(w, h, oldw, oldh); 51 | width = w; 52 | height = h; 53 | } 54 | 55 | @Override 56 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 57 | int width= MeasureSpec.getSize(widthMeasureSpec); 58 | int height = columnWidth *columnSize; 59 | setMeasuredDimension(width, height); 60 | } 61 | 62 | @Override 63 | protected void onDraw(Canvas canvas) { 64 | super.onDraw(canvas); 65 | 66 | 67 | } 68 | 69 | 70 | 71 | 72 | } 73 | -------------------------------------------------------------------------------- /app/src/main/res/anim/fade_in_center.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 14 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/anim/fade_out_center.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 14 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/anim/modal_in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 10 | 11 | 19 | 20 | 29 | 30 | 39 | -------------------------------------------------------------------------------- /app/src/main/res/anim/modal_out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 14 | 18 | -------------------------------------------------------------------------------- /app/src/main/res/anim/out_to_left.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/anim/slide_in_bottom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/anim/slide_in_top.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/anim/slide_left_in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/anim/slide_left_out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/anim/slide_out_bottom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/anim/slide_out_top.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/anim/slide_right_in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/anim/slide_right_out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/checkbox_btn_drawable.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 9 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/dialog_btn_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/dialog_white_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/dialog_window_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_3dbar.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_bar.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_bar_line.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 16 | 17 |