TimeLine - Update vertical axis range

Hello !

I am developping an application with Vaadin timeline.
Under my graph, I have a list of checkboxes: the aim is to give the posibility to the user to hide or show one of the line in the graph.

The problem I have, is that the vertical axis range doesn’t adapt itself automatically. It stays the same even when I set the visibility of some containers to false. Is there a way to adapt it automatically ?

Or should I, for every container, find out manually which is the max and min value, and then use setVerticalAxisRange() everytime the user decides to show / hide a container ?
Here is a part of my CheckBoxListener :


	@Override
	public void valueChange(ValueChangeEvent event) {
		if (event.getProperty().toString().equals("false")) {
			timeline.setGraphVisibility(containerList.get(indexContainer), false);
		}
		else {
			timeline.setGraphVisibility(containerList.get(indexContainer), true);
		}
	}

I have tryed with adding timeline.setVerticalAxisRange(null, null), but this hasn’t resolved the problem.
If someone would have an idea, I would appreciate !

Thank you !

The visibility of a graph does not effect the vertical range calculations, it will only hide the graph from view.

What you can do however is instead of hiding the graph, remove it completely from the Timeline. That will trigger a recalculation of the vertical axis. Note however that you will need to use the latest version (1.2.4) of the Timeline, due to
#8267
, for this to work.

In some cases however it is actually performance wise better setting the min/max manually. When using automitic vertical scale calculations the Timeline needs to iterate through all the graphs points to find the min/max. If you set range manually it will just use those values and rendering should be a little bit faster.

Thank you very much John for your answer! I guess I will use the manual way.