泡在网上的日子 发表于 2014-11-07 12:28 第 33156 次阅读 chart

编辑推荐:稀土掘金,这是一个高质量的技术干货分享社区,web前端、Android、iOS、设计资源和产品,满足你的学习欲望。

之前我们介绍了一个非常优秀开源图表库 MPAndroidChart  ,但是我们今天介绍的将是一个更为优秀的图表库,比MPAndroidChart性能更好,功能更完善,UI风格更美观,坐标轴更精细。

他就是github上出现的新项目HelloCharts

HelloCharts支持以下chart类型

  • Line chart(cubic lines, filled lines, scattered points)

  • Column chart(grouped, stacked, negative values)

  • Pie chart

  • Bubble chart

  • Combo chart(columns/lines)

  • Preview charts(for column chart and line chart)

此外还具有以下特点

  • 支持缩放、滑动以及平移。Zoom(pinch to zoom, double tap zoom), scroll and fling

  • 支持自定义坐标轴(比如坐标轴位置:上下左右内部),支持自动生成坐标轴。Custom and auto-generated axes(top, bottom, left, right, inside)

  • 动画(Animations)

  • 支持预览,即在chart下面会有一个坐标密度更细的附属chart,当选中附属chart的某一区域,附属chart上面的chart会显示选中区域的更详细情况。

下面是一些效果截图

我能用妙趣横生来形容吗、、

编译以及使用方法

每一种chart都可以在xml中定义:

1
2
3
4
<lecho.lib.hellocharts.view.LineChartView
    android:id="@+id/chart"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

当然也可以在java代码中直接创建:

1
2
LineChartView chart = new LineChartView(context);
layout.addView(chart);

可以通过一些公共方法设置其行为属性,下面是一些例子:

1
2
3
Chart.setInteractive(boolean isInteractive);
Chart.setZoomType(ZoomType zoomType);
Chart.setContainerScrollEnabled(boolean isEnabled, ContainerScrollType type);

或者是用数据模型定义一些显示的方式:

1
2
3
ChartData.setAxisXBottom(Axis axisX);
ColumnChartData.setStacked(boolean isStacked);
Line.setStrokeWidth(int strokeWidthDp);

每一种chart都有自己的数据模型以及设置数据的方法,下面以LineChart为例:

1
2
3
4
5
6
7
8
9
10
11
12
13
List<PointValue> values = new ArrayList<PointValue>();
values.add(new PointValue(0, 2));
values.add(new PointValue(1, 4));
values.add(new PointValue(2, 3));
values.add(new PointValue(3, 4));
//In most cased you can call data model methods in builder-pattern-like manner.
Line line = new Line(values).setColor(Color.Blue).setCubic(true);
List<Line> lines = new ArrayList<Line>();
lines.add(line);
LineChartData data = new LineChartData();
data.setLines(lines);
LineChartView chart = new LineChartView(context);
chart.setLineChartData(data);

代码下载地址

http://jcodecraeer.com/a/opensource/2014/1107/1931.html

hellocharts-android开源图表库(效果非常好)的更多相关文章

  1. 我的Android进阶之旅------>【强力推荐】Android开源图表库XCL-Charts版本发布及展示页

    因为要做图表相关的应用,后来百度发现了一个很好的Android开源图表库(XCL-Charts is a free charting library for Android platform.) 下面 ...

  2. Android开源图表库XCL-Charts版本号公布及展示页

    XCL-Charts V2.1 Android开源图表库(XCL-Charts is a free charting library for Android platform.) XCL-Charts ...

  3. Android开源图表库介绍

    XCL-Charts XCL-Charts V1.8     Android开源图表库(XCL-Charts is a free charting library for Android platfo ...

  4. android 开源图表库MPChart最简单使用方法示例教程Demo--折线图 柱状图

    转载请注明本文出处:http://blog.csdn.net/wingichoy/article/details/50428246 MPChart是android上一款强大的图表开源库,他可以轻松的绘 ...

  5. android开源图表库MPAndroidChart(曲线图、直方图、饼状图)

    github地址:https://github.com/PhilJay/MPAndroidChart 添加依赖: Add the following to your project level bui ...

  6. Android开源图表图形库K线图

    Android开源图表图形库K线图 web端k线图一般使用TradingView,android原生的一般是在MPAndroidChart 基础上做开发的,目前看到一个比较好的K线开源组件是KChar ...

  7. Android使用图表库简单教程

    经常要用到统计数据这个功能,要直观的显示出来,最好还是用图表.自己弄也麻烦,所以用了Github上的一个非常著名的开源图标库:MpChart. 使用前去网上找它俩的jar包,然后导入就行.资源比较好找 ...

  8. android 优秀图表库之MPAndroidChart

    MPAndroidChart 1.在项目当中很多时候要对数据进行分析就要用到图表,在gitHub上有很多优秀的图表开源库,这里就简单介绍一下MPAndroidChart. 他可以实现图表的拖动,3D, ...

  9. Android开源工具库

    一.依赖注入DI 通过依赖注入降低View.服务.资源简化初始化,事件绑定等反复繁琐工作 1. AndroidAnnotations(Code Diet) android高速开发框架 项目地址:htt ...

随机推荐

  1. Rar related CMD

    recursively add folder Document to archive: (with all the files) rar a *.rar Document recursively ad ...

  2. 函数求值一<找规律>

    函数求值 题意: 定义函数g(n)为n最大的奇数因子.求f(n)=g(1)+g(2)+g(3)+-+g(n).1<=n<=10^8; 思路: 首先明白暴力没法过.问题是如何求解,二分.知道 ...

  3. lucene-SpanNotQuery和SpanOrQuery交迭与全局跨度

    1.在匹配结果中排除相互交迭的跨度 SpanNotQuery构造函数的第一个参数表示要包含的跨度对象,第二个参数表示要排除的跨度对象. 1) SpanNearQuery quick_fox=new S ...

  4. 【转】HBase技术介绍 转载自 http://www.searchtb.com/2011/01/understanding-hbase.html

    HBase简介 HBase – Hadoop Database,是一个高可靠性.高性能.面向列.可伸缩的分布式存储系统,利用HBase技术可在廉价PC Server上搭建起大规模结构化存储集群. HB ...

  5. QT修改默认的滚动条样式

    这几天写一个类似于悬浮窗的小程序,可是qt自带的滚动条实在难看,经过多番查找终于找到一个类似于qq聊天窗口的滚动条,废话不说上代码.希望能帮到大家 1.写入到文件中,新建个xx.qss,然后复制一下内 ...

  6. vue数据源转json问题

    开发过程中使用到了vue框架进行前端批量数据的处理,将批量数据转换为json格式进行ajax传参时需要注意将vue数据源得到的json结果进行如下处理,webservice接收json数据时无法有效的 ...

  7. L4,an exciting trip

    expressions: a great number of 许多 in the centre of 在…的中部 sentences: I have just had breakfast. I hav ...

  8. C++头文件#include<bits/stdc++.h>

    一句话的事,直截了当——#include<bits/stdc++.h>包含C++的所有头文件 参考网站(点击):http://www.tuicool.com/articles/m6neUj ...

  9. bundle export fail

    C:\eclipse\eclipse.exe -vmargs -Dfile.encoding=utf8

  10. java几种常用设计模式简单示例

    1.单例设计模式 所谓单例设计模式简单说就是无论程序如何运行,采用单例设计模式的类(Singleton类)永远只会有一个实例化对象产生.具体实现步骤如下: (1) 将采用单例设计模式的类的构造方法私有 ...