Line chart of HelloCharts open source chart Library (1), hellocharts Open Source
We have introduced the open-source chart library MPAndroidChart. For details, refer:
Http://blog.csdn.net/shineflowers/article/details/44704723
We will introduce a better chart library today, which provides better performance, better functions, more beautiful UI style, and more precise coordinate axes than MPAndroidChart.
Supports scaling, sliding, and translation. Zoom (pinch to zoom, double tap zoom), scroll and fling
Supports custom coordinate axes (for example, the coordinate axes are located in the upper, lower, and left sides) and Automatic Generation of coordinate axes. Custom and auto-generated axes (top, bottom, left, right, inside)
Animation (Animations)
Preview is supported, that is, there is a sub-chart with finer coordinate density under the chart, and a region of the sub-chart is selected. The chart above the sub-chart will show more details of the selected area.
GitHub address:
Https://github.com/lecho/hellocharts-android
The line chart is as follows:
1. download the latest hellocharts-library-1.5.3.jar package from the address above and copy it to the libs of the project
2. Define an xml file
3. Some logics for displaying a line chart are as follows:
For (int I = 0; I <10; I ++) {mPointValues. add (new PointValue (I, new Random (). nextInt (10); mAxisValues. add (new AxisValue (I ). setLabel (I); // set the corresponding label for each corresponding I (displayed on the X axis)} Line line = new Line (mPointValues ). setColor (BLUE ). setCubic (false); List <Line> lines = new ArrayList <Line> (); lines. add (line); LineChartData data = new LineChartData (); data. setLines (lines); // Axis axisX = new Axis (); // the X Axis axisX. setHasTiltedLabels (true); axisX. setTextColor (BLUE); axisX. setName ("collection time"); axisX. setMaxLabelChars (10); axisX. setValues (mAxisValues); data. setAxisXBottom (axisX); Axis axisY = new Axis (); // y Axis axisY. setMaxLabelChars (7); // The default value is 3. You can only view data of the last three digits. setAxisYLeft (axisY); // sets the behavior attribute. It supports scaling, sliding, and translating mLineChartView. setInteractive (true); mLineChartView. setZoomType (ZoomType. HORIZONTAL); mLineChartView. setContainerScrollEnabled (true, ContainerScrollType. HORIZONTAL); mLineChartView. setLineChartData (data); mLineChartView. setVisibility (View. VISIBLE );