Support for empty data points
Closed this issue ยท 11 comments
Image a graph displaying some data from the last X days. Where some data is not available for whatever reason.
It would be great, if we could display a "broken" line etc. indicating the data point is actually missing instead of missing either a day or set the data to a zero value, so the line just drops to the bottom - which is not the same as "there is no data".
I propose to allow to set "empty" data items that specifically exist only to allow the graph to be incomplete.
Yeah, that would be exactly what we need. I'd need to switch from TilesFX to Charts, but that would be acceptable. ๐
Ok...so let me see how to make that possible. And if it will be in charts...it will probably also be in tilesfx :)
The question is how to define a "null" datapoint. Should there be a special EmptyXYChartItem for example that you create manually if needed or should the XYChartItem take Double instead of double values and in case the Double value is null it should not throw an error but use it as an empty chart item?
I think from your perspective, I'd prefer the EmptyXYChartItem.
Taking a null value could be difficult in some cases: The TilesFX tile we are currently using, takes JavaFX's own XYChart.Data
item. That isn't allowed to be null (triggers an NPE).
I was thinking about to add an isEmpty flag to the Item class. So you could set the item to empty and it would not matter what data is in there, it would be handled as an empty item.
Sounds reasonable. In the end I'm most likely happy with everything you concoct. ๐
From the pure chart point of view, this is exactly what I would need. But as you noticed tooltips would be required rather sooner than later as well.
I'm currently looking into how to add the tooltips in a useable way into this kind of chart...
I've added support for tooltips in xycharts too. You can test it by running the EmptyItemTestLauncher in the tests package.