您好我在使用图表库并且我已经构建了一些图表,但是我想用PieChart做一些特别的事情但我不能这样做但我不会知道哪些可能是像y想要设置我的饼图的属性。好的,我想为图表设置一个最大值为100,通过设置这个,我想我的图表只显示我试图在这种情况下显示的数字es 50和其他部分图应该看起来是空的。我希望你能帮助我。
This is what I have now the graph has just one Double value that value is 50
答案 0 :(得分:0)
func createPieGraphRedemptions() {
var chart = PieChartView()
chart = PieChartView(frame: CGRect(x: 229, y: 40, width: 165, height: 165))
let yVals: [Double] = [50]
var entries = [ ChartDataEntry]()
for (i, v) in yVals.enumerated() {
let entry = ChartDataEntry()
entry.x = Double( i)
entry.y = v
entries.append( entry)
}
let set = PieChartDataSet( values: entries, label: "Pie Chart")
set.colors = [UIColor.red]
let data = PieChartData( dataSet: set)
//data.setDrawValues(false)
chart.data = data
chart.noDataText = "No hay datos disponibles"
chart.isUserInteractionEnabled = false
chart.legend.enabled = false
chart.chartDescription?.text = ""
chart.highlighter = nil
self.view.addSubview(chart)
}