Vaadin Charts SVGGenerator creates image with black background

I’m using Vaadin 6.8.15, Vaadin Charts 1.1.9 and Phantomjs 2.0.0

I tried to export chart to pdf using Vaadin example codes but background of the chart changes to black. I saved the picture to disk and opened it with Gimp (see attached picture) and it is still black. IE shows background as white.

It seems to be problem with Highcharts 4 (Is this the version Vaadin Charts 1.1.9 uses?)

Any ideas how to fix this? Upgrading to Vaadin 7 is not an option.

This is the code I used:

 final Chart chart = new Chart(ChartType.COLUMN);
      final Configuration conf = chart.getConfiguration();
      conf.setSubTitle("2011 - 2014");

      final XAxis xAxis = conf.getxAxis();
      xAxis.setCategories("2011", "2012", "2013", "2014");

      final YAxis yAxis = conf.getyAxis();

      final Tooltip tooltip = conf.getTooltip();
      tooltip.setPointFormat("{}: {point.y} B€");

      conf.addSeries(new ListSeries("Revenue", 1.5, 1.8, 1.2, 2.3));
      conf.addSeries(new ListSeries("Expenses", 1.2, 1.1, 1.3, 0.9));
      conf.addSeries(new ListSeries("Net income", -0.3, 0.7, -0.1, 1.4));

      final String svg = SVGGenerator.getInstance().generate(chart.getConfiguration());

      final ByteArrayInputStream inputStream = new ByteArrayInputStream(svg.getBytes());
      final byte[] buffer = new byte[inputStream.available()]

      final File file = new File("c:/temp/chart.svg");
      FileOutputStream fileOutputStream;

      fileOutputStream = new FileOutputStream(file);



How can you know which vaadin charts version corresponds to which highcharts version ?


Regarding the version, you can check the version by checking vaadin charts jar. Under ‘com.vaadin.addon.charts.client’ you will find highcharts.js used that has a header with the version. In the case of Vaadin Charts 1.1.9 it is Highcharts JS v4.0.4.

I’ll try to think if there’s a workaround for this and answer here later.