support horizontal rolling and set width ratio. to provide more cases
! [animation] (/img/zuoping.jpg)
! [animation] (/img/gif/tip.gif)
! [animation] (/img/gif/tip.gif)
! [gesture conflict] (/img/gif/viewpager.gif) 2. #### text rotation axis ! [spin] (/img/gif/rotate_axis_value.gif)
- SmartChart is an Android chart framework that supports linear diagrams (broken lines, curves, scatter points) bar charts, area charts, pie charts, and 3D columnar diagrams to support a variety of configurations.
- apk download url
- note: the dashboard is intended to be finished, but it has been used in an example, and the wheel is not repeated. https://github.com/huangyanbin/CalendarView there is a need for reference.
- Support shaft direction, biaxial, graphic, horizontal line, cross shaft, MarkView custom, blank, the title, grid, such as support rich style, including the font style, font size, color, graphic style (square, rectangle, round), line (size, color, DashPathEffect), increase the movement and zoom function diagram and animation.
-
- Support rotation Angle of horizontal axis;
-
- Resolve diagrams in lists and view pager gestures;
-
- Vertical axis support setting StartZero and maximum, minimum;
-
- Increased wind rose chart;
-
- Fixed the Legend location display problem;
-
- Increase the format of the scale.
-
- Repair axis and grid display incomplete problem;
-
- Increase the rotation gesture of radar map;
-
- Fix the title display problem;
-
- Repair curve and broken line dynamic switch collapse problem.
-
- New scatter plots, area charts, pie charts, 3D column graphs;
-
- To support the rotation and selection of the pie chart;
-
- Fixed 0.7 bug before repair;
-
- Refactor the code to support more chart types.
-
- New scatter plots, area charts, pie charts, 3D column graphs;
-
- To support the rotation and selection of the pie chart;
-
- Support linear graph (line, curve, scatter) bar chart,
-
- Support chart axis, legend, graphical, horizontal, cross-axis, MarkView customization, blank, title, grid, etc
-
- Support rich styles, including font style (font size, color), graphic style (square, rectangle, circle), line (size, color, DashPathEffect)
-
- Add chart movement and zoom function and animation.
-
- Refactor the code to support more chart types.
- Step 1. Add the JitPack repository to your build file
allprojects {
repositories {
...
maven { url 'https://www.jitpack.io' }
}
}
*Step 2. Add the dependency
dependencies {
compile 'com.github.huangyanbin:SmartChart:1.4'
}
```xml
<!--柱状图-->
<com.daivd.chart.core.ColumnChart
android:id="@+id/columnChart"
android:layout_width="match_parent"
android:background="#f4f4f4"
android:layout_height="320dp"/>
<!--线型图-->
<com.daivd.chart.core.LineChart
android:id="@+id/lineChart"
android:layout_width="match_parent"
android:background="#f4f4f4"
android:layout_height="320dp"
android:layout_marginBottom="5dp"/>
```
lineChartView.setLineModel(LineChartView.CURVE_MODEL);
```java
BaseAxis verticalAxis = lineChartView.getLeftVerticalAxis();
BaseAxis horizontalAxis= lineChartView.getHorizontalAxis();
//set verticalAxis
verticalAxis.setAxisDirection(AxisDirection.LEFT);
//set vertical grid
verticalAxis.setDrawGrid(true);
//set horizontal direction
horizontalAxis.setAxisDirection(AxisDirection.BOTTOM);
horizontalAxis.setDrawGrid(true);
//set line style
verticalAxis.getLineStyle().setWidth(this,1);
```
```java
chartView.setZoom(true);
```
```java
//open cross
lineChartView.getProvider().setOpenCross(true);
//open mark view
lineChartView.getProvider().setOpenMark(true);
//set mark view
lineChartView.getProvider().setMarkView(new MsgMarkView(this));
//set show point
lineChartView.getProvider().setShowPoint(true);
//set point style
lineChartView.getProvider().getPointStyle().setShape(PointStyle.CIRCLE);
```
```java
//set legend diection
lineChartView.getLegend().setLegendDirection(ILegend.BOTTOM); //设置图示样式
lineChartView.getLegend().getLegendStyle().setShape(PointStyle.RECT);
//set legend percent
lineChartView.getLegend().setLegendPercent(0.2f);
```
```java
//set chart title
lineChartView.setShowChartName(true);
//set title direction
lineChartView.getChartTitle().setTitleDirection(IChartTitle.BOTTOM);
//set title percent
lineChartView.getChartTitle().setTitlePercent(0.2f);
//set title style
lineChartView.getChartTitle().getTextStyle().setTextColor(res.getColor(R.color.arc21));
```
```java
//Y data
List<String> chartYDataList = new ArrayList<>();
chartYDataList.add("华北");
chartYDataList.add("华中");
chartYDataList.add("华东");
chartYDataList.add("华西");
// X data
List<ColumnData> ColumnDatas = new ArrayList<>();
ArrayList<Double> tempList1 = new ArrayList<>();
tempList1.add(26d);
tempList1.add(35d);
tempList1.add(40d);
tempList1.add(10d);
ColumnData columnData1 = new ColumnData("温度","℃",AxisDirection.RIGHT,getResources().getColor(R.color.arc3),tempList1);
ArrayList<Double> humidityList = new ArrayList<>();
humidityList.add(60d);
humidityList.add(50d);
humidityList.add(30d);
humidityList.add(65d);
ColumnData columnData2 = new ColumnData("湿度","RH%",getResources().getColor(R.color.arc2),humidityList);
ColumnDatas.add(columnData1);
ColumnDatas.add(columnData2);
ChartData chartData = new ChartData("线型图",chartYDataList,ColumnDatas);
// set data
lineChartView.setChartData(chartData);
```
```java
//You can also set up the Interpolator using the default animation
//startChartAnim(int duration, Interpolator interpolator)
lineChartView.startChartAnim(1000);
```
-
- Fix the view pager and list sliding to cause gesture conflict;
-
- Continuous optimization of chart display effects;
-
- Support lines and histogram composition diagrams.
- the project includes a number of configuration items, which are not listed here, including setting up Padding. Almost all of the chart attributes can be configured, but since this framework has only been developed for three days, there is still a lot to be done. Thank you again for spending time reading.