1

I'm trying to implement the Vaadin Flow (14) charts to SVG converter and the pom dependencies are failing. The instructions I'm following are at: https://vaadin.com/docs/v14/ds/components/charts/charts-installing to install Charts as well as: https://vaadin.com/docs/latest/ds/components/charts/java-api/installing I'm then using these instructions to convert the charts to export them to SVG files: https://vaadin.com/docs/latest/ds/components/charts/java-api/svg-generator

With that in mind I've added the following to my pom.xml file:

<dependency>
    <groupId>com.vaadin</groupId>
    <artifactId>vaadin-charts-flow</artifactId>
</dependency>
<dependency>
    <groupId>com.vaadin</groupId>
    <artifactId>vaadin-charts-flow-svg-generator</artifactId>
</dependency>

The instructions say to leave out the version but the SVG generator dependencies fails saying it requires a version. I then add the version number as stated in the documentation: <version>6.0.0</version>This results in the following error: com.vaadin:vaadin-charts-flow-svg-generator:jar:6.0.0 was not found in https://repo.maven.apache.org/maven2 during a previous attempt. And as I suspect this will be the first answer yes I do have the vaadin-addons repository added to the pom file. I'm actually using the default project constructed from https://start.vaadin.com/app which includes the vaadin-addons by default.

My final version in the pom was:

<dependency>
    <groupId>com.vaadin</groupId>
    <artifactId>vaadin-charts-flow</artifactId>
    <version>6.0.0</version>
</dependency>
<dependency>
    <groupId>com.vaadin</groupId>
    <artifactId>vaadin-charts-flow-svg-generator</artifactId>
    <version>6.0.0</version>
</dependency>
Stephane Grenier
  • 15,527
  • 38
  • 117
  • 192

2 Answers2

4

I didn't try the latest version of Charts with Vaadin 14, but you have an upgrade guide here: https://vaadin.com/docs/v14/ds/components/charts/upgrading

The versioning has been changed for Vaadin 20+ and now the components have the same version as Vaadin:

<dependency>
    <groupId>com.vaadin</groupId>
    <artifactId>vaadin-charts-flow</artifactId>
    <version>21.0.0.alpha10</version>
</dependency>
<dependency>
    <groupId>com.vaadin</groupId>
    <artifactId>vaadin-charts-flow-svg-generator</artifactId>
    <version>21.0.0.alpha10</version>
</dependency>

As it's an alpha version you also need to add the pre-release repository:

 <repository>
      <id>vaadin-prereleases</id>
      <url>
           https://maven.vaadin.com/vaadin-prereleases/
       </url>
 </repository>
2

This feature is not implemented for Vaadin 14. It's currently in development and targeted for Vaadin 21. See https://github.com/vaadin/platform/issues/2101 for more information.

Knoobie
  • 1,968
  • 10
  • 14
  • Is there any way to export a chart to a png/jpg outside of this? I was using the SVG converted in Vaadin 8. – Stephane Grenier Jul 19 '21 at 19:56
  • I think the client side (the end user) can download one, but I don't know of any server side feature for it so far. We are waiting for this addition as well. – Knoobie Jul 19 '21 at 19:59
  • That's too bad because it was available in Vaadin 8 and I'm in the process of converting an app which uses the charts generated and puts them in the printable reports as images. – Stephane Grenier Jul 19 '21 at 20:02
  • 1
    Just an idea (haven't tested it) - if you have prime you could try to use Multiplatform Runtime and use the Vaadin 8 charts inside Vaadin 14 until the next LTS in probably 9month has the updated version of charts. – Knoobie Jul 19 '21 at 20:07
  • I've got a Pro license. The key is that I'd have to somehow confirm it works before upgrading licenses. And even then it's hard to justify the upgrade for that one feature. At that point it would be worth considering alternatives. I don't like the dependency on phantomJS and so on outside of Vaadin that it's required to make it run. It's a tough one because it adds a decent fee per year per developer. The expert chat looks interesting but there's limited details on the website. – Stephane Grenier Jul 19 '21 at 20:13
  • 2
    As @Knoobie said this feature was added to V21 that is still currently in pre-release stage, in order to use the V21 version in V14 you need to override vaadin-charts-flow version and add the matching vaadin-charts-flow-svg-generator dependency to your pom.xml. – Guille Jul 20 '21 at 08:00
  • @Guille Do either of you know if it's possible to mix and match core Vaadin version 14 with the the Charts version 21 alpha? Or do I have to move to 21? I'm trying to hold back going to 21 until it's released as the next LTS. – Stephane Grenier Jul 20 '21 at 17:28
  • 1
    It should be safe to use charts from vaadin 21 in a vaadin 14 app, unless you are using vaadin 14 in compatibility mode (bower mode). There are docs on how to use Charts from Vaadin 17 in a Vaadin 14 app https://vaadin.com/docs/latest/ds/components/charts/java-api/migrating-from-earlier-versions#running-charts-9-in-v14 and the same should apply to Vaadin 21. – Guille Jul 21 '21 at 06:34