2016-10-22 53 views
0

我正在为iOS使用Charts并且有一个饼图我想要删除内部圆并更改饼图内每个饼图的宽度。我一直没能找到如何减少饼图的宽度并去掉内圈,this是我的意思。iOS饼图属性

我试过在我的PieChartView上更改draw属性,但没有成功。任何想法如何解决这个问题?

回答

1

PieChartView具有以下属性:

  1. holeRadiusPercent
  2. transparentCircleRadiusPercent

他们都设置为0.0,你应该实现你想要的。

您还可以通过设置chartView.drawHoleEnabled = false

明确地隐藏孔如果你需要更多的属性,只需打开source code。它受到很多评论。

1

添加@ sulthan的回应与一些示例代码。

图表视图框架的CGSize可以修改以影响图表宽度本身。

但是,超过图表父视图的CGSize的CGSize可能导致不可预知的布局。

let chart = PieChartView(frame: self.view.frame) 
// setup data...etc. 

// style 
chart.holeRadiusPercent = 0 
chart.transparentCircleColor = UIColor.clear 

// increase width 
// width in excess of the parentView.size.width will cause layout issues 
chart.frame.size = CGSize(width: 500, height: chart.frame.size.height) 

无耻插头:了解更多关于iOS的饼图在ioscharts.io/piechart

enter image description here

+0

该网站是非常有益的! –