开发者

What's the best way to draw a pie chart in Android with selectable slices?

I've looked into achartengine and a couple other options, but none of them seem to 开发者_运维技巧support any way to implement drill down into the data.


I had a similar problem, but with histograms. I ended up creating a custom view that:

  • takes a maximum value as the top of the graph, to make a proportion with values to graph (you have 360 constant degrees)
  • an array of values
  • a parameter for column width

then draws the histogram (it won't be too hard drawing a pie chart) and overriding onTouchEvent() to determine which column was clicked.

As we're talking of a pie chart you'll have to do some more maths to find which slice was clicked.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜