Reputation: 653
My question is about the charts_flutter charting library for Flutter (https://pub.dev/packages/charts_flutter) and how to draw an empty chart without any data with it? The library has an example gallery: https://google.github.io/charts/flutter/gallery.html showing different charts one can create using the library, but there is no example how to create an empty chart.
The reason for this need is that my app starts with no data and all the data is created during the run. I have successfully updated my chart an modified how it looks, when starting the app with fake debug data.
If a chart with no data is not possible, I would accept a solution where the whole widget is being build only after the first data are created. Is this possible in Flutter? To my understanding all the classes are initialized when the app is started. Is this correct?
One workaround would be starting with some artificial data, update the data and only after that show the chart widget, but this sounds more like a hack: I do not like this one.
Am I dealing with a crappy charting library and should I find a better library, or is it just my Flutter skills and understanding that are (still a bit) crappy? :)
Upvotes: 1
Views: 1160
Reputation: 8607
It is absolutely possible to create a chart with the charts_flutter package that doesn't contain any data to start with.
The data field in the Series-class cannot be null, but you can provide an empty list.
Upvotes: 2