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

Chart doesn't appear without error. Apex-charts-wrapper has size 0x0 #146

Open
NejdanX opened this issue Sep 29, 2022 · 3 comments
Open

Comments

@NejdanX
Copy link

NejdanX commented Sep 29, 2022

Hi! I am stuck with one problem. When I try to print LineChart, created Div and I expect that the chart to be inside. But, Div was created empty. What could be the problem?
Technologies: Java 11, vaadin 23.2.0, ApexCharts 23.0.0, Spring boot.

Screenshot_3
Screenshot_4

public class LineChart extends Div {

    public LineChart(List<String> categories, Integer[] data, String dataName) {
        setWidth("100%");
        setHeight("500px");
        ApexCharts lineChart = ApexChartsBuilder.get()
                .withChart(ChartBuilder.get()
                        .withType(Type.LINE)
                        .withZoom(ZoomBuilder.get()
                                .withEnabled(false)
                                .build())
                        .build())
                .withStroke(StrokeBuilder.get()
                        .withCurve(Curve.STRAIGHT)
                        .build())
                .withTitle(TitleSubtitleBuilder.get()
                        .withText("Product Trends by Month")
                        .withAlign(Align.LEFT)
                        .build())
                .withGrid(GridBuilder.get()
                        .withRow(RowBuilder.get()
                                .withColors("#f3f3f3", "transparent")
                                .withOpacity(0.5).build()
                        ).build())
                .withXaxis(XAxisBuilder.get()
                        .withCategories("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep")
                        .build())
                .withSeries(new Series<>("Desktops", 10.0, 41.0, 35.0, 51.0, 49.0, 62.0, 69.0, 91.0, 148.0))
                .build();
        lineChart.setHeight("100%");
        lineChart.setHeight("100%");
        add(lineChart);
    }
}
@AlexRoig
Copy link
Contributor

AlexRoig commented Sep 30, 2022

make sure that on your application.properties you have included com.github.appreciated on vaadin.whitelisted-packages key

your application.properties should look like this:
vaadin.whitelisted-packages = com.vaadin,org.vaadin,dev.hilla,com.github.appreciated

@NejdanX
Copy link
Author

NejdanX commented Oct 1, 2022

Thanks for the answer. Actually, I tried that but I get next error:

Failed to resolve import "@vaadin/combo-box/src/vaadin-combo-box-dropdown.js" from "node_modules\multiselect-combo-box\theme\lumo\multiselect-combo-box.js". Does the file exist?
11:33:22 [vite] Internal server error: Failed to resolve import "@vaadin/combo-box/src/vaadin-combo-box-dropdown.js" from "node_modules\multiselect-combo-box\theme\lumo\multiselect-combo-box.js". Does the file exist?
Plugin: vite:import-analysis
File: C:/Users/Plaho/IdeaProjects/KataProject/trade_front-dev/node_modules/.vite/deps/multiselect-combo-box_theme_lumo_multiselect-combo-box__js.js?v=0e653c2e
243|  // node_modules/multiselect-combo-box/src/multiselect-combo-box-dropdown.js
244|  import { html as html2 } from "@polymer/polymer/lib/utils/html-tag.js";
245|  import { ComboBoxDropdown } from "@vaadin/combo-box/src/vaadin-combo-box-dropdown.js";
      |                                                                ^
246|  var MultiselectComboBoxDropdown = class extends ComboBoxDropdown {
247|    static get is() {

I understand that "@vaadin/combo-box/src/vaadin-combo-box-dropdown.js" not found but where I can get this file?
I tried delete node_modules and installing again using file "package.json" but this didn't solve the problem. So, I don't know what I should do.
Error

@kweles
Copy link

kweles commented Feb 13, 2025

I Had the same problem.
In my case, I was using Java 21 with Vaadin 24.
Solution:
1- Add this line: Application.Properties:

vaadin.allowed-packages = com.vaadin,org.vaadin,[your application package],com.github.appreciated

2 - Run some commands:

    • If you dont't have a package.json file:
      • npm init -y
  • mvn vaadin:build-frontend;
  • rm -rf node_modules && npm I
  • mvn vaadin:build-frontend;

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

No branches or pull requests

3 participants