highchartsvaadinvaadin14

vaadin 14+ - charts - change drillup button text


How do I change the text of the drillup button in a chart? E.g. to translate it?

Example: How to change the Text of "Back to hauptserie"

enter image description here


Solution

  • The text can be set via Lang object using Lang#setDrillUpText.

        Lang lang = new Lang();
        lang.setDrillUpText("Zurück zur Hauptserie");
        ChartOptions.get().setLang(lang);
    

    https://vaadin.com/api/platform/23.3.5/com/vaadin/flow/component/charts/model/Lang.html#setDrillUpText(java.lang.String)

    However in Vaadin 14 the Lang object is not supported. This improvement came post Vaadin 14. Chart version 21.0.9 however is known to work with Vaadin 14, and has the support for Lang object.

        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-charts-flow</artifactId>
            <version>21.0.9</version>
        </dependency>