apache / echarts

Apache ECharts is a powerful, interactive charting and data visualization library for browser
https://echarts.apache.org
Apache License 2.0
60.63k stars 19.61k forks source link

Import a echart theme with echarts v5.5.0 and ngx-echarts v15.0.3 #19789

Open lmarquinez opened 7 months ago

lmarquinez commented 7 months ago

Version

5.5.0

Link to Minimal Reproduction

-

Steps to Reproduce

Create a package that creates a graph using echarts and ngx-echarts, and then install that package in an application to use that graph with these packages as peerDependency.

Current Behavior

I was usingecharts v5.4.3 with ngx-echarts 15.0.3 and angular 15, but when I updated echarts to v5.5.0 I notice that the theme is not working.

I have an application as a library where I am using the echarts package to create some graphics and there it is working correctly, I have problems in the application when I install this package. Echarts is a peerDependency of this package as well as ngx-echarts.

In the aplication as library I am only importing the theme in the module this way:

import 'echarts/theme/macarons.js';
import * as echarts from 'echarts';
import { NgxEchartsModule } from 'ngx-echarts';

@NgModule({
  imports: [
    NgxEchartsModule.forRoot({
      echarts
    })
  ],

And I am using this way to create the graphics:

<div echarts [options]="echartsOption" theme="macarons"></div>

Expected Behavior

That the graphic is displayed correctly in the application with the macaron them

Environment

- OS: Windows
- Browser: Chrome
- Framework: Angular 15

Any additional comments?

If I run the package it displays correctly, it is in the application where you can see that it does not pick up the theme styles.

Should I add something in the angular.json or in some other file? For example in the scripts section of angular.json like:

 "scripts": [
      "node_modules/echarts/dist/echarts.js",
      "node_modules/echarts/theme/macarons.js",
 ],

Although with the previous version I didn't need to add any of this.

echarts-bot[bot] commented 7 months ago

I'm sorry to close this issue for it lacks the necessary title. Please provide a descriptive and as concise as possible title to describe your problems or requests and then the maintainers or I will reopen this issue.

Every good bug report or feature request starts with a title. Your issue title is a critical element as it's the first thing maintainers see.

A good issue title makes it easier for maintainers to understand what the issue is, easily locate it, and know what steps they'll need to take to fix it.

Moreover, it's better to include keywords, as this makes it easier to find the issue self and similar issues in searches.