1

I'm using JFreeChart to display data recorded by a sensor several times per second. When I feed this data into a chart, it tries to display all the different time values on the x-Axis, which makes it look like this:

Is there a way to only display as much values on the x-Axis as there is space in the window?

TigersEye120
  • 664
  • 1
  • 9
  • 28
  • Two approaches are examined [here](https://stackoverflow.com/q/5048852/230513). – trashgod Feb 05 '20 at 20:00
  • Also consider `SlidingXYDataset`, mentioned [here](https://stackoverflow.com/search?tab=votes&q=%5bjfreechart%5d%20slidingxydataset). – trashgod Feb 06 '20 at 20:55
  • @trashgod Unfortunately neither of these is what I'm looking for. I don't want to display live data and the SlidingDataset relies on an underlying TimeSeriesCollection which operates on a consistent interval between the x-values, which is not what I have. What I wonder is: On the y-axis, it manages to format decently (in this case 2 meters per tick) without me having to do anything. Why doesn't it do the same on the x-axis, and instead tries to label every value in the Dataset? – TigersEye120 Feb 20 '20 at 15:25
  • If your time domain uses a `CategoryAxis`, try `setCategoryLabelPositions()`, seen [here](https://stackoverflow.com/a/45331595/230513). – trashgod Feb 21 '20 at 00:32

0 Answers0