xieziyu / ngx-echarts

An angular (ver >= 2.x) directive for ECharts (ver >= 3.x)
https://xieziyu.github.io/ngx-echarts/
MIT License
1.1k stars 197 forks source link

Theme is not getting updated #52

Closed jain13aman closed 6 years ago

jain13aman commented 6 years ago

rough1 rough2 rough3

I am trying to add themes to my echarts but none is working and only default theme is set. I have attached 3 files. In first one, you can see I have included 'theme' property in my html file. In second file, you can see that I have imported that theme in my .angular-cli.json. In third file, you can see that my theme is there in node_modules>echarts>theme folder. Am I missing something? I am following this link: " [https://xieziyu.github.io/ngx-echarts/#/usage/theme] ".

xieziyu commented 6 years ago

Your theme path in .angular-cli.json is wrong. For your case, you should write

"../node_modules/echarts/theme/macarons.js"
jain13aman commented 6 years ago

Thanks for your quick reply ! I tried your suggestion and it still isn't working. Please refer some other solution. I am not sure but may be it's related with a point mentioned in documentation of Baidu. (http://echarts.baidu.com/theme-builder/) Whenever I try to add a custom theme, it asks me to follow 3 steps. rough4 Please refer to the 3rd step in the attached file. I am not sure if I have to use in-built themes also, like that only. I don't know where should I use the 3rd step. It's not working in my component or module.
All of your other demos are working. Only theme is not getting updated in each of them.

xieziyu commented 6 years ago

@jain13aman You don't need to follow the steps. ngx-echarts has done that for you.

It's obviously the theme .js file is not correctly imported in your project. Does your project depend on other module resolvers rather than angular-cli?

My demo project is generated by angular-cli, so I only need to modify .angular-cli.json to import the theme file.

jain13aman commented 6 years ago

Thanks for your quick response. It worked for me after I restarted my project. Kinda weird because I was regularly saving all my files and my compiler was also working. May be some bug is there in visual studio code. I want to thank you for helping us out through demo !! Cheers ! I will be closing this issue now.

xieziyu commented 6 years ago

@jain13aman Good news! As far as I know, angular-cli will not reload .angular-cli.json file if ng serve is working. So any changes in .angular-cli.json requires a restart.