Skip to content

[Bug] ScatterChart with labelLine and labelLayout fails to move labels when built with vue2+vite #17799

@MatthewAry

Description

@MatthewAry

Version

5.4.0

Link to Minimal Reproduction

https://github.com/MatthewAry/echarts-scatter-label-bug

Steps to Reproduce

Background:
The file with the chart is located in src/components/EChart.vue

Reproduction Steps:
Step 0: It goes without saying that you need to clone and then use yarn to download all dependencies.

View in the development server:
Step 1: To view the chart in the dev environment run yarn run dev and vite will give you a link to view the application on the dev server which you can open in the browser. You should be able to see the chart as shown in the first picture seen in the current behavior section.

Build For Production and Preview:
Step 1: run yarn run build
Step 2: run yarn run preview and again vite will give you a link to view the compiled SPA on the preview server. You should be able to see the chart as shown in the second picture above.

Current Behavior

When running from the dev server the chart renders as expected
image
But when built for production, the chart renders like this (unexpected)
image

Expected Behavior

There is a general expectation that (unless it is explicitly desired), there should be no difference between what you see from a dev server and what you get in production, but this expectation is not holding here.

Instead we're seeing that the labelLayout and labelLine are not taking effect when the SPA is built for production.

Environment

- OS: macOS Monterey
- Browser: Chrome 106.0.5249.119
- Framework: Vue 2, Vite

Any additional comments?

I'm not sure why this is breaking, but I suspect that vite and rollup (which vite uses) has something to do with this. I did try a few things, I disabled minification on build (which is done using terser) to no effect. I also manually put ECharts into its own chunk. It's hard to speculate as to what the problem is but you might find this page https://vitejs.dev/config/build-options.html helpful.

I used https://github.com/logue/vite-vue2-vuetify-ts-starter to make my reproduction. This saved me a ton of time when making a reproduction of what I am seeing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enThis issue is in Englishsupport

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions