ChartsOrg / Charts

Beautiful charts for iOS/tvOS/OSX! The Apple side of the crossplatform MPAndroidChart.
Apache License 2.0
27.43k stars 5.97k forks source link

facing problem with PieChart.noDataText is not display #5145

Closed MallikarjunaMore closed 5 months ago

MallikarjunaMore commented 5 months ago

Hi Team, facing same problem, I am using PieChart in TabBarController, same noDataText is not displaying. I tried to place in viewdidload and viewwillappear both. Assist me. statusPieChart.noDataText = "Something"

What did you do?

statusPieChart.noDataText = "No chart data available"

What did you expect to happen?

when getting nil response, need to showing No chart data available

What happened instead?

getting empty screen

DGCharts Environment

DGCharts version/Branch/Commit Number: DGCharts (5.0.0) Xcode version: Version 14.3.1 (14E300c) Swift version: Swift 5 Platform(s) running DGCharts: iOS macOS version running Xcode: 13.6.3

pmairoldi commented 5 months ago

I think the problem is that you are missing a chart.setNeedsDisplay(). Some operations do not automatically redraw the chart it seems like.

This seems to work:

let chart = PieChartView(frame: CGRect(x: 0, y: 0, width: 200, height: 200));
chart.noDataText = "No Data";
chart.setNeedsDisplay()