VisualizationsForVaadin Gauge - Question

Hi everyone!,

I need to use google charts in a project, I asked about this in the General forum and one user recommended me the VisualizationsForVaadin addon.
It is a really good addon, however I am having some problems when trying to use a Gauge chart.

When I use a Gauge chart with an initial value set, it works just fine.


Gauge g = new Gauge();
		g.setOption("redFrom", 90);
		g.setOption("redTo", 100);
		g.setOption("yellowFrom", 75);
		g.setOption("yellowTo", 90);
		g.setOption("minorTicks", 5);

		double mem = 50;
	
		g.add("Memory", mem);

But what I really need to do is to be able to set this parameter (mem), to a new value every 5 minutes with a value that I am going to receive from another project, in a plain text or an xml file, that is not the problem.
So I am trying this, just to test the chart.


for (int i = 0; i < 10; i++){
			try {
				wait(1000*5);
				g.setOption("Memory", i*5);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}

The first question would be if I am using the “g.setOption” fine, in order to pass to the chart a new value.
The second, if it is possible to do what I am trying to, and how could I accomplish this.

Thank you very much!
Lea

If you try to change the UI from a thread outside the UI update thread, it will not work.

There are certain add-ons that solves this kind of problem. For example, Refresher component.