注册

炫酷动画统计图表库:CurveGraphView

CurveGraphView 是一个带有炫酷动画统计图表库,除了性能出色并具有许多样式选项之外,该库还支持单个平面内的多个线图。

多个折线图对于比较不同股票,共同基金,加密货币等的价格非常有用。

10.1 如何使用?

1、在build.gradle 中添加如下依赖:

dependencies {
implementation 'com.github.swapnil1104:CurveGraphView:{current_lib_ver}'
}

2、在xml文件中添加布局:

 

然后在代码中添加各种配置项

curveGraphView = findViewById(R.id.cgv);

curveGraphView.configure(
new CurveGraphConfig.Builder(this)
.setAxisColor(R.color.Blue) // Set X and Y axis line color stroke.
.setIntervalDisplayCount(7) // Set number of values to be displayed in X ax
.setGuidelineCount(2) // Set number of background guidelines to be shown.
.setGuidelineColor(R.color.GreenYellow) // Set color of the visible guidelines.
.setNoDataMsg(" No Data ") // Message when no data is provided to the view.
.setxAxisScaleTextColor(R.color.Black) // Set X axis scale text color.
.setyAxisScaleTextColor(R.color.Black) // Set Y axis scale text color
.build()
););

3、 提供数据集

PointMap pointMap = new PointMap();
pointMap.addPoint(0, 100);
pointMap.addPoint(1, 500);
pointMap.addPoint(5, 800);
pointMap.addPoint(4, 600);
10.2 效果图
效果1效果2

更多详细使用方式请看Github: https://github.com/swapnil1104/CurveGraphView

下载地址:CurveGraphView-master.zip

0 个评论

要回复文章请先登录注册