Android 中如何实现如图所示的图表?
PHPz
PHPz 2017-04-17 12:58:48
0
4
1050

Android 中有好的图表库吗?还是用 HTML5 来画比较好?

PHPz
PHPz

学习是最好的投资!

reply all(4)
左手右手慢动作

There are many. If the question owner only needs what is in the question, it is very simple to write it yourself. Just customize a View to draw the values ​​​​in the array/list on the screen in sequence.
If you have other needs, check out this open source project compiled by Trinea:

14. GraphView

  1. MPAndroidChart
    Powerful chart drawing tools, supporting line charts, area charts, scatter charts, time charts, column charts, bar charts, pie charts, bubble charts, donut charts, range (high to low) bar charts, network charts, and Combination of various graphs; supports drag and drop of graphs; supports Android 2.2 and above, supports horizontal and vertical axis scaling, multi-finger zooming, animation, highlighting, saving to sdcard, and reading charts from files
    Project address: https://github.com/PhilJay/MPAndroidChart
    Demo address: https://play.google.com/store/apps/details?id=com.xxmassdeveloper.mpchartexample
    Demo project: https://github.com/PhilJay/MPAndroidChart/tree/master/MPChartExample
    Rendering:





    Online demonstration: https://www.youtube.com/watch?v=ufaK_Hd6BpI

  2. achartengine
    Powerful chart drawing tools, supporting line charts, area charts, scatter charts, time charts, column charts, bar charts, pie charts, bubble charts, donut charts, range (high to low) bar charts, dial charts/tables , cubic line chart and combination of various charts
    Project address: https://code.google.com/p/achartengine/
    Rendering:
    http://www.achartengine.org/dimages/sales_line_and_area_chart.png
    http://www.achartengine.org/dimages/temperature_range_chart.png
    http://www.achartengine.org/dimages/combined_chart.png
    http://www.achartengine.org/dimages/budget_chart.png
    Official website: http://www.achartengine.org/
    APP examples: WordPress Android, Google Analytics

  3. GraphView
    View for drawing charts and graphs, which can be used to display curved graphs, bar graphs, and wave graphs on Android
    Project address: https://github.com/jjoe64/GraphView
    Demo project: https://github.com/jjoe64/GraphView-Demos
    APP examples: WordPress Android, Google Analytics

  4. HoloGraphLibrary
    Draw status diagrams, bar charts, and pie charts
    Project address: https://bitbucket.org/danielnadeau/holographlibrary/src
    Document introduction: https://bitbucket.org/danielnadeau/holographlibrary/wiki/Home

  5. XCL-Charts
    XCL-Charts draws various charts based on the native Canvas. When designing, we try our best to provide users with sufficient customization capabilities while ensuring development efficiency. It is therefore easy to use and has quite flexible customization capabilities. Currently supports 3D/non-3D column chart (Bar Chart), 3D/non-3D pie chart (Pie Chart), stacked bar chart (Stacked Bar Chart), area chart (Area Chart), line chart (Line Chart), Spline Chart, Donut Chart, Nightingale Rose Chart, Dial Chart, Gauge Chart, Radar Chart, Circle Chart ( Circle Chart) and other charts. Other features include support for chart scaling, gesture movement, animation display effects, high-density column display, customized chart demarcation lines, mixed display of multiple charts, and switching between different types of charts from the same data source.
    Project address: https://github.com/xcltapestry/XCL-Charts
    Demo address: https://github.com/xcltapestry/XCL-Charts/blob/master/XCL-Charts-demo/bin/XCL-Charts-demo.apk?raw=true

  6. EazeGraph
    Android chart library, supports bar charts, hierarchical bar charts, pie charts, linear charts
    Project address: https://github.com/blackfizz/EazeGraph
    Demo address: https://play.google.com/store/apps/details?id=org.eazegraph.app

  7. WilliamChart
    A library for drawing charts that supports three chart types: LineChartView, BarChartView and StackBarChartView, and supports Android 2.2 and above systems.
    Project address: https://github.com/diogobernardino/WilliamChart
    Demo address: https://play.google.com/store/apps/details?id=com.db.williamchartdemo
    Demo project: https://github.com/diogobernardino/WilliamChart/tree/master/sample
    Rendering:

  8. HelloCharts for Android
    Supports line charts, bar charts, pie charts, bubble charts, and combination charts; supports preview, zoom in, and scroll, and some charts support animation; supports Android 2.2 and above
    Project address: https://github.com/lecho/hellocharts-android
    Demo address: https://play.google.com/store/apps/details?id=lecho.lib.hellocharts.samples
    Online demonstration: https://www.youtube.com/watch?v=xbSBjyjH2SY

黄舟

This kind of androidplot?

刘奇

Html5 is not required, usually you draw directly on the canvas.
There are also many mature chart libraries..
Just list 2:

XCL-Charts
https://github.com/xcltapestry/XCL-Charts

MPAndroidChart
https://github.com/PhilJay/MPAndroidChart

洪涛

There are some open source tools. If you want to implement it yourself, you can use the tools provided by the android.graphics package to draw.
The key is to define several classes like this:
1. Represents the data model of each discount, which can add, delete, modify and check the data. This part is mainly about designing the data structure
2. The polyline drawing class contains a draw(Canvas canvas, Paint paint) method, and the drawing is completed within the method
3. The data model of the chart includes references to the polyline to be drawn, as well as some coordinate system attributes, etc.
4. Customize the View to present the above icon, rewrite the onDraw(Canvas canvas) method, and call the draw method of each polyline one by one in this method
1 and 2, and 3 and 4 can be combined and defined as one class, which not only manages data, but also contains a method responsible for drawing.
The specific implementation is more complicated than the above, but the general idea is this.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template