GithubHelp home page GithubHelp logo

learn-android-app / android-bezier-curve-chart Goto Github PK

View Code? Open in Web Editor NEW

This project forked from steven-luo/android-bezier-curve-chart

0.0 3.0 0.0 1.51 MB

An Android Library which helps you build a smooth curve line

License: Apache License 2.0

Java 100.00%

android-bezier-curve-chart's Introduction

android-bezier-curve-chart

An Android Library which helps you build a smooth curve line

English Version

Screenshot

Screenshot1

Screenshot1

how to

layout files
 <com.cn.naive.lib.view.BezierCurveChart
    android:id="@+id/bezier_curve_chart"
    android:layout_width="match_parent"
    android:layout_height="260dp"
    android:layout_margin="10dp" />
Java code
List<BezierCurveChart.Point> points=new ArrayList<BezierCurveChart.Point>();
for(int i=0;i<10;i++) {
	points.add(new Point(i, (float) (Math.random()*10)));
}
String tipText = "3 hours/day on average";
		
BezierCurveChart bezierCurveChart = 
	(BezierCurveChart) rootView.findViewById(R.id.bezier_curve_chart);
bezierCurveChart.init(points, 
	new String[] { "0:00", "6:00", "12:00", "18:00", "24:00" }, tipText);

If you don't want to show the tips on the middle of the chart, set the last parameter of bezierCurveChart.init to null.

bezierCurveChart.init(points, 
	new String[] { "0:00", "6:00", "12:00", "18:00", "24:00" }, null);

中文版

一个Android曲线绘制视图,利用贝塞尔曲线绘制平滑曲线

效果截图

Screenshot1

Screenshot1

使用说明

布局文件
 <com.cn.naive.lib.view.BezierCurveChart
    android:id="@+id/bezier_curve_chart"
    android:layout_width="match_parent"
    android:layout_height="260dp"
    android:layout_margin="10dp" />
Java代码
List<BezierCurveChart.Point> points=new ArrayList<BezierCurveChart.Point>();
for(int i=0;i<10;i++) {
	points.add(new Point(i, (float) (Math.random()*10)));
}
String tipText = "3 hours/day on average";		
BezierCurveChart bezierCurveChart = 
	(BezierCurveChart) rootView.findViewById(R.id.bezier_curve_chart);
bezierCurveChart.init(points, 
	new String[] { "0:00", "6:00", "12:00", "18:00", "24:00" }, tipText);

如果不需要中间的提示条,将bezierCurveChart.init最后一个参数设置为null即可,代码如下

bezierCurveChart.init(points, 
	new String[] { "0:00", "6:00", "12:00", "18:00", "24:00" }, null);

android-bezier-curve-chart's People

Contributors

steven-luo avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.