Android-FancyChart
==================
FancyChart (line chart) with nice graphics
Usage
-----
Add view to your XML layout
<com.svenkapudija.fancychart.FancyChart
android:id="@+id/chart"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</com.svenkapudija.fancychart.FancyChart>
and then initialize it in your Activity
FancyChart chart = (FancyChart) findViewById(R.id.chart);
// First data set
ChartData data = new ChartData(ChartData.LINE_COLOR_BLUE);
int[] yValues = new int[]{0, 8, 9, 18, 35, 30, 33, 32, 46, 53, 50, 42};
for(int i = 8; i <= 19; i++) {
data.addPoint(i, yValues[i-8]);
data.addXValue(i, i + ":00");
}
chart.addData(data);
// Second data set
ChartData data2 = new ChartData(ChartData.LINE_COLOR_RED);
int[] yValues2 = new int[]{0, 5, 9, 23, 15, 35, 45, 50, 41, 45, 32, 24};
for(int i = 8; i <= 19; i++) {
data2.addPoint(i, yValues2[i-8]);
data2.addXValue(i, i + ":00");
}
chart.addData(data2);
![FancyChart Example](http://i.imgur.com/qv50v17.png)
`addXValue` and `addYValue` are optional. If you don't add any, FancyChart will add ~10 points on X and Y axis automatically.
onPointClickListener
----
You can add listener when specific point is clicked
chart.setOnPointClickListener(new FancyChartPointListener() {
@Override
public void onClick(Point point) {
Toast.makeText(MainActivity.this, "I clicked point " + point, Toast.LENGTH_LONG).show();
}
});
Styling
----
Use `FancyChartStyle` if needed - there are all the colors, stroke widths etc. for visual fine-tuning. For example if you don't
want translucent background below lines set it to `false`
FancyChartStyle style = chart.getChartStyle();
style.setDrawBackgroundBelowLine(false);
Developed by
------------
* Sven Kapuđija
License
-------
Copyright 2012 Sven Kapuđija
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
android 安卓 canvas 绘制折线图
5星 · 超过95%的资源 需积分: 9 58 浏览量
2015-05-30
16:17:17
上传
评论
收藏 370KB ZIP 举报
维特小时光
- 粉丝: 1
- 资源: 7
最新资源
- 5ffd9193f6aec31bbf16030a46680dc7.avi
- DA14531-蓝牙传感器连接传输数据固件
- logisim实验MIPS运算器(ALU)设计(内含4位先行进位74182、四位快速加法器、32位快速加法器)-Educoder_logisim里面连线,实现4位先行进位74182和4位快速加法器-C
- 高等数学第一章第二节数列的极限
- Python 版冒泡排序算法源代码
- tensorflow-gpu-2.7.2-cp38-cp38-manylinux2010-x86-64.whl
- tensorflow-2.7.3-cp39-cp39-manylinux2010-x86-64.whl
- tensorflow-2.7.2-cp39-cp39-manylinux2010-x86-64.whl
- Python版本快速排序源代码
- 精品源码基于JSP实现的酒店管理系统
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈