Export vaadin chart to CSV


In my web application, the user is able to see a lot of data through graphs.
I was wondering if it is possible to export the data to a CSV or excel file, simply to allow the user to manipulate the data offline.

I’ve seen a lot of export-plugins, but since the data I want already is formatted and lies in the charts, it would be so awesome if it was possible to export these data.

Hope you guys can help :slight_smile:

Have a great day - even though it’s a monday :wink:


I see the original software had a pluging for it:

Anybody knows if and how this could be compatible?


I must admit I was a bit doubtful about how this would work, but did a small test and seems to be working fine.

  1. Add HighchartsPluginResources similar to HighchartResources class in client package and create a TextResource for the plugin js file.
  2. Add plugin js file in same folder but under src/main/resources.
  3. Create HighchartsPluginScriptLoader class extending HighchartsScriptLoader. Override injectResources so that both original and new plugin resources are injected.
  4. In project widgetset.gwt.xml file replace the original script loader with extended one:
<replace-with class="uy.com.chartexport.client.HighchartsPluginScriptLoader">
    <when-type-is class="com.vaadin.addon.charts.client.HighchartsScriptLoader"/>

And remember to enable chart exporting.

A simple project with the mentioned changes is available in github

Hope this helps!


Seems genious! :slight_smile:
I tried it, but I can’t seem to compile the widgetset, it can’t find the scriptloader, even though it is in the right place.
Could not find uy.com.chartexport.client.HighchartsPluginScriptLoader in types compiled from source. Is the source glob too strict?
Errors in ‘com/vaadin/addon/charts/client/HighchartsScriptLoader.java’
Line 27: Rebind result ‘uy.com.chartexport.client.HighchartsPluginScriptLoader’ could not be found
Adding ‘1’ new generated units

Why does it do this? It does exist, and in the right package. :frowning:

For some reason I used uy in package name which you might’ve missed.
Is your HighchartsPluginScriptLoader also un uy.com.chartexport… package?

Probably that!

After I changed the structure to the following and compiled the widgetset, it worked!
You’re awesome mate!

Cool! Glad it worked!