Comments (13)
UPDATE:
The procedure mention in #59 (comment) is working in Angular 5. Tried and tested!
from angular-highcharts.
@tavuntu yes, the following should work.
import { Highcharts } from 'angular-highcharts';
// Apply the theme
Highcharts.setOptions(Highcharts.theme);
from angular-highcharts.
The object Highcharts is undefined when importing it, so it throws an error when trying to use .theme or .setOptions(). I've added the ChartModule un app.moduel.ts, maybe I'm missing something else?
EDIT: this results in an undefined object as well... weird:
import { Highcharts } from 'highcharts';
from angular-highcharts.
To resolve this issue i need more code to dig into this. Can you setup a minimal repo or Plunkr?
from angular-highcharts.
here you go, I'm using npm 5.4.0 and the latest version of angular-highcharts
https://github.com/tavuntu/general-stuff
from angular-highcharts.
Was this issue resolved? Is there any workaround?
from angular-highcharts.
@SayakMukhopadhyay I haven't tested this since then (I switched to Chart.js), are seeing the issue?
from angular-highcharts.
Yeah, I am. I am planning on the only workaround of loading the theme js in the header for now. Using setOptions
is more flexible though.
from angular-highcharts.
Highcharts.setOptions(Highcharts.theme); seems to affect the new charts after it.
What would the easiest way to refresh the charts so that the new theme is applied immediately to existing charts?
from angular-highcharts.
If you don't mind looking through source code, I have implemented a dynamic theme switcher in https://github.com/SayakMukhopadhyay/elitebgs . This is the service file . The theme switch is triggered in this component and the chart is rendered in this component
from angular-highcharts.
Interesting, so you are basically recreating the chart when switching themes right?
this.themeService.theme$.subscribe(theme => {
this.chart = new Chart(this.options);
});
By doing
this.linkRef.onload = () => this.themeService.themeLoaded();
and
this.linkRef.href = this.themeService.getTheme().href;
You are loading the style sheet related to the theme dynamically and also triggering the theme change, right?
from angular-highcharts.
Yup. Recreating the chart object is the only way to change the theme as far as what I have found.
from angular-highcharts.
I was able to get it working like this:
this.chart = new Chart({...});
this.chart.theme = {...};
Highcharts.setOptions(this.chart.theme);
from angular-highcharts.
Related Issues (20)
- License HOT 4
- Thanks everyone and wish you all the best for the holiday season. HOT 1
- StockChart doesn't contain getSVG() method HOT 6
- CommonJS or AMD dependencies Warning HOT 1
- Cannot read property 'showLoading' of undefined
- activate plugin
- angular 13 incompatible HOT 1
- Is it possible to toggle full screen using a separate button. I am using Stock Chart?
- How to resize stock chart HOT 1
- Angular Server-side rendering (SSR) - issue
- Pie chart in lower to higher all datalabels not displayed in chart view (Opera, QQ, Other) datalable not available
- Cannot read properties of undefined (reading 'forExport')
- How it differs from highcharts-angular?
- Angular 15 incompatibility HOT 1
- Update flag adds new legend elements
- No peer dependency mentioning highcharts
- Angular 16 Compatibility - Error HOT 7
- Support for Angular v17 HOT 3
- [Bug] HighchartsGantt class HOT 1
- Add support ESbuild imports HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-highcharts.