I am getting counter values in one class using a thread and writing JFreeChart
in another thread. While executing, it works alternatively, but only shows the graph
Don't sleep on the event dispatch thread (EDT). As shown in Concurrency in Swing, use a worker thread to update the dataset on the EDT in process()
. A complete example is shown here.
For your second question (integer axis labels instead of float), this can be handled by calling the setStandardTickUnits() method on the axis. You can pass any TickUnitSource, but easiest for you is probably NumberAxis.createIntegerTickUnits().