Android Bézier Curve Library

Source: Internet
Author: User

Recently done a small project need to draw some line chart, Achartengine actually contains a lot of figures, although it is open source, but after all, but not their own writing, and the project is a little bit large, some things change up or take some time, so finally intend to write a, Refer to the reading time curve effect of reading more, look first:

Here's the effect of the strip without the middle "average 3 hours/day"

Already open source, code on GitHub, address is Https://github.com/Steven-Luo/android-bezier-curve-chart

The usage is simple.

Layout files are:

1 < Com.cn.naive.lib.view.BezierCurveChart 2     Android:id = "@+id/bezier_curve_chart" 3     android:layout_width= "Match_parent"4    android:layout_height = "260DP" 5     android:layout_margin= "10DP"/>
Java code
1List<beziercurvechart.point> points=NewArraylist<beziercurvechart.point>();2  for(inti=0;i<10;i++) {3Points.Add (NewPoint (I, (float) (Math.random () *10)));4 }5String TipText = "3 hours/day on average";6 7Beziercurvechart Beziercurvechart =8 (Beziercurvechart) Rootview.findviewbyid (R.id.bezier_curve_chart);9 Beziercurvechart.init (points,Ten     NewString[] {"0:00", "6:00pm", "12:00pm", "18:00", "24:00"}, TipText);

The above data points are simulated using random numbers, the most critical is the Beziercurvechart init method, the first parameter is the data point, the second is the bottom of the label, the last parameter is the middle of the cue bar, if not required, the last parameter is set to NULL.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.