jra*_*rez 0 statistics graphics android canvas
我正在为我的应用程序开发一个简单的统计图形类.我已经尝试过aChartEngine和其他更多,但我更喜欢使用自己的类.我正在使用包含Android的Canvas类绘制图形,但问题是我不知道如何填充线和底部边框之间的区域.现在,矩形没有填满所有区域,显然,你知道任何解决方案吗?非常感谢.

Eri*_*ric 12
使用Path,用Paint它已.setStyle(Paint.Style.FILL);调用.
Path fillPath = new Path();
fillPath.moveTo(0, 0); // Your origin point
fillPath.lineTo(x1, y1); // First point
// Repeat above line for all points on your line graph
fillPath.lineTo(xN, yN); // Final point
fillPath.lineTo(xN, 0); // Draw from final point to the axis ++
fillPath.lineTo(0, 0); // Same origin point
yourCanvas.drawPath(fillPath, /* Your paint */);
Run Code Online (Sandbox Code Playgroud)
++感谢@TheCapn这个位.
| 归档时间: |
|
| 查看次数: |
1810 次 |
| 最近记录: |