首页 技术 正文
技术 2022年11月19日
0 收藏 938 点赞 3,563 浏览 1964 个字

泡在网上的日子 发表于 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会显示选中区域的更详细情况。

下面是一些效果截图

hellocharts-android开源图表库(效果非常好)

hellocharts-android开源图表库(效果非常好)

hellocharts-android开源图表库(效果非常好)

hellocharts-android开源图表库(效果非常好)

hellocharts-android开源图表库(效果非常好)

hellocharts-android开源图表库(效果非常好)

hellocharts-android开源图表库(效果非常好)

hellocharts-android开源图表库(效果非常好)

hellocharts-android开源图表库(效果非常好)

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

编译以及使用方法

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

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

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

12 LineChartView chart = new LineChartView(context);layout.addView(chart);

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

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

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

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

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

12345678910111213 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

收藏 赞(17) 踩(2)

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:8,993
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,507
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,350
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,135
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,768
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,845