Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Charts Exporting stops working on vaadin version 23.2.11 #4696

Closed
homerstone opened this issue Feb 16, 2023 · 3 comments
Closed

Charts Exporting stops working on vaadin version 23.2.11 #4696

homerstone opened this issue Feb 16, 2023 · 3 comments

Comments

@homerstone
Copy link

Describe the bug

Exporting Vaadin Charts to SVG, PNG, etc. via the Exporting class works fine in Vaadin version 23.2.10, but stops working on version 23.2.11-23.3.6.

Expected-behavior

Using Exporting class allows to add a dropdown-menu to a chart containing buttons to export the chart in different formats.

Reproduction

  • Download quick-start project (in my case the vaadin-version was 23.3.6)
  • add code below to MainView.java
    -> exporting charts does not work
  • set <vaadin.version>23.2.10</vaadin.version> in pom.xml
    -> exporting charts does work

My testing showed that it stops working on version 23.2.11.

@PageTitle("Main")
@Route(value = "")
public class MainView extends HorizontalLayout {
    public MainView() {
        add(createChart());
    }

    private Chart createChart() {
        Chart chart = new Chart(ChartType.COLUMN);

        Configuration conf = chart.getConfiguration();
        conf.setTitle("Reindeer Kills by Predators");
        conf.setSubTitle("Kills Grouped by Counties");

        ListSeries series = new ListSeries("Diameter");
        series.setData(4900,  12100,  12800,
                    6800,  143000, 125000,
                    51100, 49500);
        conf.addSeries(series);
        conf.setExporting(exportingOptions());

        return chart;
    }

    private Exporting exportingOptions() {
		Exporting exporting = new Exporting();
		exporting.setEnabled(true);
		exporting.setFilename("file_name");

		ContextButtonMenuItem png = new ContextButtonMenuItem();
		png.setText("Export png");
		png.setOnclick("function () {this.exportChart();}");

		ContextButtonMenuItem svg = new ContextButtonMenuItem();
		svg.setText("Export svg");
		svg.setOnclick("function () {this.exportChart({type: 'image/svg+xml'});}");

		ContextButton ctxBtn = new ContextButton();
		ctxBtn.setMenuItems(new ContextButtonMenuItem[] {png, svg});

		Buttons btns = new Buttons();
		btns.setContextButton(ctxBtn);

		exporting.setButtons(btns);
		return exporting;
	}
}

System Info

Windows 10, Firefox

@homerstone homerstone added the bug Something isn't working label Feb 16, 2023
@vaadin-bot
Copy link
Collaborator

Thanks for using Vaadin! We appreciate your help and we’ll take care of this as soon as possible.

@manolo manolo transferred this issue from vaadin/platform Feb 17, 2023
@alvarezguille
Copy link
Member

Probably related to vaadin/web-components#5080 which was backported and released in 23.2.11 (vaadin/web-components#5086)

@ugur-vaadin
Copy link
Contributor

Fixed by a PR for the web components. The fix will be back-ported to v24.0, v23.3, and v23.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

5 participants