Chart runtime properties

Hello,
I am struggling to find a way to modify chart properties at runtime.
In particular I need to set the range of the y axis of a xyChart and I would like to add a title in runtime depending on the data I am showing.

It would be good to have more use examples in the documentation.

Thanks,
Ricardo

Hi,

You can trigger repaint after changing properties at runtime:

@Inject
private XYChart chart;
...
chart.setBackgroundColor(Color.AZURE);
chart.repaint();

Ok, thanks but the problem I have is with the graph sub-components:
How can I change the range (max and min) of the y axis?
Or how can I add or modify a title?

Each chart type provides Java API. For instance, you could add new Title as follows:

xyChart.addTitles(
        new Title()
                .setText("New title")
                .setBold(true)
);
xyChart.repaint();

Just check the corresponding Java interface, e.g. com.haulmont.charts.gui.components.charts.XYChart.

Check com.haulmont.charts.gui.amcharts.model.ValueAxis class for min / max values of Y axis. See also this demo in Sampler.

That’s more like it. Thanks!!