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

Discussão em 'Angular' iniciado por Ihescode, Março 18, 2025.

  1. Ihescode

    Ihescode Guest

    I was using echarts 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 and ngx-echarts packages 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 library I am only importing the theme in the module by 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>

    So the graphics must displayed correctly in the application with the macaron theme as well as in the library. Because if I run the library 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.

    Continue reading...

Compartilhe esta Página