1

I have dynamic chart for measuring CPU performance and I need my Java program to generate chart for a long period of time (for example: 24h). Problem is that as new data comes older ones disappear form chart. I don't want to lose that data. Can I somehow make x-axis fixed? Is there posibility to implement auto scroll on chart or to compress graph?

Thanks. :)

bralek
  • 23
  • 6

2 Answers2

1

There's no sample code, so we don't know how and when you generate a chart. But in general: if you don't want to lose information in the chart, you need to save new data without discarding the old data (e.g. in a database, just in a class variable ArrayList etc., whatever you need). If you generate the chart, use that data, and expect a dynamic size/amount of values. (It has to be generated upon request, or with a timer)

Blacklight
  • 3,809
  • 2
  • 33
  • 39
1

As shown here, you can use setMaximumItemAge() in a TimeSeries to decide how much data to retain. You can also use setMaximumItemCount().

Community
  • 1
  • 1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045