Open Deepak-kumar-varshney opened 1 month ago
Hello dear,
I cloned your demo of Swift ios and checking PieChart it is working fine as expected but it is not showing % symbol in your github demo, can you please look into this?
I am attaching the video for same.
https://github.com/user-attachments/assets/fbc8a09e-c211-4526-b31b-f95ff8a0b096
code
func setDataCount(_ count: Int, range: UInt32) { let entries = (0..<count).map { (i) -> PieChartDataEntry in // IMPORTANT: In a PieChart, no values (Entry) should have the same xIndex (even if from different DataSets), since no values can be drawn above each other. return PieChartDataEntry(value: Double(arc4random_uniform(range) + range / 5), label: parties[i % parties.count], icon: #imageLiteral(resourceName: "icon")) } let set = PieChartDataSet(entries: entries, label: "Election Results") set.drawIconsEnabled = false set.sliceSpace = 2 set.colors = ChartColorTemplates.vordiplom() + ChartColorTemplates.joyful() + ChartColorTemplates.colorful() + ChartColorTemplates.liberty() + ChartColorTemplates.pastel() + [UIColor(red: 51/255, green: 181/255, blue: 229/255, alpha: 1)] let data = PieChartData(dataSet: set) let pFormatter = NumberFormatter() pFormatter.numberStyle = .percent pFormatter.maximumFractionDigits = 1 pFormatter.multiplier = 1 pFormatter.percentSymbol = " %" data.setValueFormatter(DefaultValueFormatter(formatter: pFormatter)) data.setValueFont(.systemFont(ofSize: 11, weight: .light)) data.setValueTextColor(.black) chartView.usePercentValuesEnabled = true chartView.data = data chartView.highlightValues(nil) }
Thanks and regards Deepak kumar
Hello dear,
I cloned your demo of Swift ios and checking PieChart it is working fine as expected but it is not showing % symbol in your github demo, can you please look into this?
I am attaching the video for same.
https://github.com/user-attachments/assets/fbc8a09e-c211-4526-b31b-f95ff8a0b096
code
Thanks and regards Deepak kumar