0
今、私はチャートの中心の代わりに、円グラフに画像を追加したいCharts
迅速セット画像中心の円グラフ
から円グラフを使用しています。
私は何をすべき?
コード
func updatePieChart(){
let track = ["", ""]
let money = [65, 45]
var entries = [PieChartDataEntry]()
for (index, value) in money.enumerated() {
let entry = PieChartDataEntry()
entry.y = Double(value)
entry.label = track[index]
entries.append(entry)
}
let set = PieChartDataSet(values: entries, label: "Pie Chart")
var colors: [UIColor] = []
for _ in 0..<money.count {
let red = Double(arc4random_uniform(256))
let green = Double(arc4random_uniform(256))
let blue = Double(arc4random_uniform(256))
let color = UIColor(red: CGFloat(red/255), green: CGFloat(green/255), blue: CGFloat(blue/255), alpha: 1)
colors.append(color)
}
set.colors = colors
let data = PieChartData(dataSet: set)
pieview.data = data
pieview.noDataText = "No data available"
// user interaction
pieview.isUserInteractionEnabled = true
let d = Description()
d.text = "iOSCharts.io"
pieview.chartDescription = d
pieview.centerText = "Pie Chart"
pieview.holeRadiusPercent = 0.9
pieview.transparentCircleColor = UIColor.clear
pieview.holeRadiusPercent = 0.65
pieview.transparentCircleRadiusPercent = 0
pieview.legend.enabled = false
pieview.chartDescription?.enabled = false
この作業ですか? –