An Android chart and graph library

Min SDK   9
Latest Commit   2015-10-05 14:15:27
License   Apache-2.0

Github   https://github.com/blackfizz/EazeGraph

         

使用APP客户端扫描二维码运行Demo


...

blackfizz

Erfurt, Germany


         

类似的还有....
PieChartView 饼状图图形报表控件
hellocharts-android Charts/graphs library for Android compatible with API 8+, several chart types with support for scaling, scrolling and animations
XCL-Charts Android图表库(XCL-Charts is a free charting library for Android platform.),基于Android Canvas来绘制各种图表,使用简便,定制灵活。目前支持3D/非3D/背向式/横向/竖向柱形图(Bar Chart)、3D/非3D饼图(Pie Chart)、堆叠图(Stacked Bar Chart)、面积图(Area Chart)、 折线图(Line Chart)、曲线图(Spline Chart)、环形图(Dount Chart)、南丁格尔玫瑰图(Rose Chart)、仪表盘(Dial Chart)、刻度盘(Gauge Chart)、雷达图(Radar Chart)、漏斗图(Funnel Chart)、圆形图(Circle Chart)、弧线比较图、散点图(Scatter Chart)、气泡图(Bubble Chart)、范围条形图(RangeBar Chart)等图表。其它特性还包括支持图表缩放、手势移动、点击响应、动画效果、多轴显示、图表参考线、混合图表及同数据源不同图表类型切换等。
README

README.md

EazeGraph

EazeGraph is an Android library for creating beautiful and fancy charts. Its main goal was to create a lighweight library which is easy to use and highly customizeable with an "up-to-date"-look.

Currently 4 different chart types are available, which can be viewed below.


IMPORTANT:

This library is not intented for "mathematical" purposes like "achartengine" or "androidplot". It is intented to have a beautiful visual presentation of "user related"-data where only one value is provided and the rest is calculated dynamically.

So for example it's not possible to push 2D-values in the LineChart and let them plot just like in our beloved math lessons.

If you want such functionality either you use one of the libraries I named before or you wait some time until I finished a "mathematical plotting"-chart ;)

Currently BarCharts only support positive values. I will provide this functionality later.

Your Android application should use Android API Level 9 or higher in order to use this library!!!

Chart types

  • Bar Chart

  • Stacked Bar Chart

  • Pie Chart

  • Line Chart

Features

  • 4 different chart types
  • dynamic legend label generation
  • possibility to use your own legend labels
  • animations for every chart
  • touch interaction for PieChart and LineChart
  • various xml attributes for customizing the charts
  • and much more

Examples

Examples on how to correctly use these charts are either below or you can view the source of the sample app I provided.

If you want to see the library in action, just download the sample app from the PlayStore: https://play.google.com/store/apps/details?id=org.eazegraph.app

Including in your project

Add in your android app project folder in the 'build.gradle' under dependencies:

dependencies {
    compile 'com.github.blackfizz:eazegraph:1.2.2@aar'
    compile 'com.nineoldandroids:library:2.4.0'
}

Or if you want to use my new lightweight library without any interaction some new features then download this:

dependencies {
    compile 'com.github.blackfizz:eazegraph:1.2.5l@aar'
    compile 'com.nineoldandroids:library:2.4.0'
}

The library uses the nineoldandroids support library to support the animations on older devices. If you already use this library, you don't have to include it. That's it. now you are ready to use the library!

Usage

Project setup

Before you use the project please prepare all required settings in a configuration file. There is an example file called gradle.properties.example contained in the repository which you can copy and rename to gradle.properties.

Bar Chart

XML
<org.eazegraph.lib.charts.BarChart
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/barchart"
    android:layout_width="match_parent"
    android:layout_height="256dp"
    android:padding="10dp"
    app:egFixedBarWidth="true"
    app:egBarWidth="20dp"
    app:egLegendHeight="40dp"/>
Java
BarChart mBarChart = (BarChart) findViewById(R.id.barchart);

mBarChart.addBar(new BarModel(2.3f, 0xFF123456));
mBarChart.addBar(new BarModel(2.f,  0xFF343456));
mBarChart.addBar(new BarModel(3.3f, 0xFF563456));
mBarChart.addBar(new BarModel(1.1f, 0xFF873F56));
mBarChart.addBar(new BarModel(2.7f, 0xFF56B7F1));
mBarChart.addBar(new BarModel(2.f,  0xFF343456));
mBarChart.addBar(new BarModel(0.4f, 0xFF1FF4AC));
mBarChart.addBar(new BarModel(4.f,  0xFF1BA4E6));

mBarChart.startAnimation();

Stacked Bar Chart

XML
<org.eazegraph.lib.charts.StackedBarChart
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/stackedbarchart"
    android:layout_width="match_parent"
    android:layout_height="256dp"
    android:padding="10dp"
    app:egFixedBarWidth="true"
    app:egBarWidth="20dp"
    app:egLegendHeight="40dp"/>
Java
StackedBarChart mStackedBarChart = (StackedBarChart) findViewById(R.id.stackedbarchart);

StackedBarModel s1 = new StackedBarModel("12.4");

s1.addBar(new BarModel(2.3f, 0xFF63CBB0));
s1.addBar(new BarModel(2.3f, 0xFF56B7F1));
s1.addBar(new BarModel(2.3f, 0xFFCDA67F));

StackedBarModel s2 = new StackedBarModel("13.4");
s2.addBar(new BarModel(1.1f, 0xFF63CBB0));
s2.addBar(new BarModel(2.7f, 0xFF56B7F1));
s2.addBar(new BarModel(0.7f, 0xFFCDA67F));

StackedBarModel s3 = new StackedBarModel("14.4");

s3.addBar(new BarModel(2.3f, 0xFF63CBB0));
s3.addBar(new BarModel(2.f, 0xFF56B7F1));
s3.addBar(new BarModel(3.3f, 0xFFCDA67F));

StackedBarModel s4 = new StackedBarModel("15.4");
s4.addBar(new BarModel(1.f, 0xFF63CBB0));
s4.addBar(new BarModel(4.2f, 0xFF56B7F1));
s4.addBar(new BarModel(2.1f, 0xFFCDA67F));

mStackedBarChart.addBar(s1);
mStackedBarChart.addBar(s2);
mStackedBarChart.addBar(s3);
mStackedBarChart.addBar(s4);

mStackedBarChart.startAnimation();

PieChart

XML
 <org.eazegraph.lib.charts.PieChart
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/piechart"
    android:layout_width="match_parent"
    android:layout_height="300dp"
    android:padding="8dp"
    app:egLegendTextSize="18sp"
    app:egUsePieRotation="true"
    app:egValueTextSize="36sp"/>
Java
PieChart mPieChart = (PieChart) findViewById(R.id.piechart);

mPieChart.addPieSlice(new PieModel("Freetime", 15, Color.parseColor("#FE6DA8")));
mPieChart.addPieSlice(new PieModel("Sleep", 25, Color.parseColor("#56B7F1")));
mPieChart.addPieSlice(new PieModel("Work", 35, Color.parseColor("#CDA67F")));
mPieChart.addPieSlice(new PieModel("Eating", 9, Color.parseColor("#FED70E")));

mPieChart.startAnimation();

Line Chart

XML
<org.eazegraph.lib.charts.ValueLineChart
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/cubiclinechart"
    android:layout_width="match_parent"
    android:layout_height="200dp"
    app:egUseCubic="true"
    app:egUseOverlapFill="true"
    app:egCurveSmoothness="0.4"
    app:egIndicatorLineColor="#FE6DA8"
    app:egLegendHeight="40dp"
    app:egShowStandardValue="true"/>
Java
ValueLineChart mCubicValueLineChart = (ValueLineChart) findViewById(R.id.cubiclinechart);

ValueLineSeries series = new ValueLineSeries();
series.setColor(0xFF56B7F1);

series.addPoint(new ValueLinePoint("Jan", 2.4f));
series.addPoint(new ValueLinePoint("Feb", 3.4f));
series.addPoint(new ValueLinePoint("Mar", .4f));
series.addPoint(new ValueLinePoint("Apr", 1.2f));
series.addPoint(new ValueLinePoint("Mai", 2.6f));
series.addPoint(new ValueLinePoint("Jun", 1.0f));
series.addPoint(new ValueLinePoint("Jul", 3.5f));
series.addPoint(new ValueLinePoint("Aug", 2.4f));
series.addPoint(new ValueLinePoint("Sep", 2.4f));
series.addPoint(new ValueLinePoint("Oct", 3.4f));
series.addPoint(new ValueLinePoint("Nov", .4f));
series.addPoint(new ValueLinePoint("Dec", 1.3f));

mCubicValueLineChart.addSeries(series);
mCubicValueLineChart.startAnimation();

Wiki

Project Wiki

Changelog

1.2.2

  • Made some little additions to vertical barchart

1.2.1

  • Added support for vertical barchart

1.2.0

  • Fixed many bugs and added zooming for LineCharts and scrolling for BarCharts if there are many values.

I had those things on my HDD for some months and never had the time to release it or to polish it. I think this should be stable and release it for you guys. I know there are some open issues and I really want to fix those error or implement new features, but I am not able to do anything of those as I am completely busy with my university and work. In addition to that I made a lightweight variant of the library for my work which can be downloaded as the version 1.2.5l. This removes every physical interaction with the library and only provides displaying functionality. Most of the work went into the ValueLineChart as it now has a X-Grid with 4 stages. I don't know when I have some time again to implement new stuff or fix bugs, but i hope it won't be so long as my last absence. Happy using :)

1.1.14

  • added missing getter and setter for new attributes

1.1.13

  • fixed issue #24

1.1.12

  • added dynamic scaling for ValueLineChart with the attribute egUseDynamicScaling and the scaling factor can be set with egScalingFactor which should be between 0 and 1 (When only high values are given, the chart scales them down to achieve a better presentation without any loss of information)
  • added Scrolling in BarCharts
  • PieCharts animations are now running properly on Android 2.3 devices (Autocenter and scrolling)

1.1.10

  • removed the egStandardValueIndicatorStroke and egStandardValueColor attributes and created an extra StandardValue class, which contains all these information. Doing this enabled the support for multiple StandardValues
  • fixed issue #23
  • fixed bug in ValueLineChart when inserting an empty series, the previous indicator is still shown even when there is no data available.
  • fixed bug in PieChart when an InnerPadding is activated, the animated inner circle sometimes is a little smaller than the PieChart which led to colored edges.
  • tweaked the legend generation algorithm
  • added Comparable interface for BarModel, PieModel, ValueLinePoint

1.1.9

  • did a complete code restructuring. Now adding the graph, graph overlay and legend view is done by the BaseChart class and only calls methods which can be overwritten in the child graph classes. This reduced many redundancies and the layout generation of the views is handled in one location.
  • based on the restructuring, the padding attributes are now drawn and interpreted correctly and no chart has to include the padding in the calculation as it is handled in the layout generation.

1.1.8

  • fixed bug in VlaueLineChart where the egActivateIndicatorShadow was not usable
  • added the possibility to change colors for the legend
  • added a toggle which activates the drawing of the currently selected ValueLineChart point beneath the indicator (egActivateIndicatorShadow)

1.1.7

  • PieChart's inner value and ValueLineChart's indicator value now can be extended with an unit. (PieChart: egInnerValueUnit ValueLineChart: egIndicatorTextUnit)
  • (ValueLineChart) removed egIndicatorColor and made separate attributes for indicator line and text (egIndicatorLineColor and egIndicatorTextColor)
  • (ValueLineChart) the indicator now support a shadow layer (egActivateIndicatorShadow, egIndicatorShadowStrength, egIndicatorSha