We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
var colors:[UIColor] = [ UIColor(hexString: "#F69300"), UIColor(hexString: "#93D460"), UIColor(hexString: "#5D86EF"), UIColor(hexString: "#F16051"), UIColor(hexString: "#FFFFFF")] var texts:[String] = [ "Lorem", "Ipsum", "Correct", "Wrong", "Correct"] var percentages:[CGFloat] = [15,12,18,25,30] var textLayers:[PieLineTextLayer] = [] var sliceModels:[PieSliceModel] = []
for index in stride(from: 0, to: texts.count, by: 1) { sliceModels.append(PieSliceModel(value: Double(percentages[index]), color: colors[index])) let textLayerSettings = PieLineTextLayerSettings() textLayerSettings.label.font = Fonts.bold(size: 17) textLayerSettings.label.textColor = UIColor(hexString: "#F69300") let formatter = NumberFormatter() formatter.maximumFractionDigits = 1 let textToSet = "\(percentages[index])% \(texts[index])" textLayerSettings.label.labelGenerator = { slice in let lbl = UILabel(frame: CGRect.zero) lbl.sizeToFit() lbl.text = textToSet lbl.textColor = self.colors[index] lbl.font = Fonts.bold(size: 18) lbl.setfont(text: textToSet, words: [self.texts[index]], firstFont: Fonts.bold(size: 18), secondFont: Fonts.medium(size: 14), wordColor: UIColor.white) return lbl } textLayerSettings.label.textGenerator = {slice in return textToSet } let textLayer = PieLineTextLayer() textLayer.settings = textLayerSettings textLayers.append(textLayer) } pieChart.models = sliceModels pieChart.layers = textLayers
The text was updated successfully, but these errors were encountered:
No branches or pull requests
var colors:[UIColor] = [ UIColor(hexString: "#F69300"), UIColor(hexString: "#93D460"), UIColor(hexString: "#5D86EF"), UIColor(hexString: "#F16051"), UIColor(hexString: "#FFFFFF")]
var texts:[String] = [ "Lorem", "Ipsum", "Correct", "Wrong", "Correct"]
var percentages:[CGFloat] = [15,12,18,25,30]
var textLayers:[PieLineTextLayer] = []
var sliceModels:[PieSliceModel] = []
The text was updated successfully, but these errors were encountered: