Search code examples
ios-charts

Does the Charts library support showing a message when there's no data to display?


I'm using the Charts library (Charts) and I want to display a message on the chart if there's no data to display - something like this:

enter image description here

I've read the documentation, searched the code base, and searched the issues on Github and the only thing I could find is an old issue that suggests ChartViewBase has a property called noDataTextDescription. As far as I can tell, that's not in the Charts 3.1.1 code.

There is a chartDescription property, but that only shows a description in the bottom right corner of the chart. Is this intended to be used for a message like 'There's no data to display`?


Solution

  • In newer version after 3.X many properties name updated and as per your requirement for No Data Text you can use below property for the same.

    lineChartView.noDataText = "<Your custom Text>"
    

    Hope this will help to show Message while there is no data.