这是我的代码 –
// This is the delegate method for creating data for chart func offDaysDIDLoaded(controller: DataModel,chartArray:[PFObject]) { let formatter = NSDateFormatter() formatter.dateFormat = "MMM" dataDict = [:] for od in chartArray { let date = od["Date"] as! NSDate let month = formatter.stringFromDate(date) if self.dateDict.indexForKey(month) != nil { self.dateDict[month]! += 1.0 }else{ self.dateDict.updateValue(1.0,forKey: month) } } let dataPointArray = Array(dateDict.keys) let valuesArray = Array(dateDict.values) pIEChartVIEw.data = nil pIEChartVIEw.backgroundcolor = UIcolor.graycolor() setChart(dataPointArray,values: valuesArray) }func setChart(dataPoints: [String],values: [Double]) { var dataEntrIEs: [ChartDataEntry] = [] for i in 0..<dataPoints.count { let dataEntry = ChartDataEntry(value: values[i],xIndex: i) dataEntrIEs.append(dataEntry) } let pIEChartDataSet = PIEChartDataSet(yVals: dataEntrIEs,label: "Months") let pIEChartData = PIEChartData(xVals: dataPoints,dataSet: pIEChartDataSet) pIEChartData.setDrawValues(false) pIEChartVIEw.data = pIEChartData pIEChartVIEw.animate(xAxisDuration: NSTimeInterval(5)) var colors: [UIcolor] = [] for _ in 0..<dataPoints.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) } pIEChartDataSet.colors = colors}
我在here中看到了类似的问题并且构建和运行,问题中使用的饼图也没有在图表下方显示任何图例.任何帮助或指针将非常感激.
谢谢
解决方法 最后这个问题解决了,这不是BUG.请找到详细的解决方案 here. 总结以上是内存溢出为你收集整理的ios-charts缺少PieChart的标签(传说)全部内容,希望文章能够帮你解决ios-charts缺少PieChart的标签(传说)所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)