0

I'm trying to modify the simple example in lets-plot-mini-apps github repo which using Lets-Plot Kotlin API in JVM app and renders plot to JavaFX Scene in way to periodically update data on a chart.

This example rebuilds a plot panel each time after data is changed and the chart flickered. How to update chart with new data and avoid such flickers?

fmvin
  • 591
  • 2
  • 5
  • 9
  • 1
    I don't know if the ideas from [this](https://stackoverflow.com/questions/53573747/dynamic-bar-chart-in-java-fx/53579013#53579013) will work for you, but have a look. – SedJ601 Sep 24 '22 at 14:14
  • 1
    Update the _model_, a `Series` in the example cited; the listening _view_, a `BarChart`, will update itself in response. – trashgod Sep 24 '22 at 18:58
  • A workaround using CardLayout seems to work. See this thread: https://github.com/alshan/lets-plot-mini-apps/issues/2 – alshan Oct 06 '22 at 00:01

1 Answers1

0

Following @alshan's clue about CardLayout the issue was resolved by naive trick.

  1. Reserved CardLayout with 2 cards.
  2. On first data update a first card is shown and new chart is pushed to the second card. On next data update the second card is shown and new chart is pushed to the first card. And so on.
fmvin
  • 591
  • 2
  • 5
  • 9