score:1
Accepted answer
You need to recreate the chart to apply Highcharts.setOptions
theme change. The simplest solution to do that in Angular seems to be conditional rendering of two highcharts-chart
components. Example:
HTML:
<div>
<highcharts-chart
[Highcharts]="Highcharts"
[options]="chartOptions"
*ngIf="isLightTheme;"
>
</highcharts-chart>
<highcharts-chart
[Highcharts]="Highcharts"
[options]="chartOptions"
*ngIf="!isLightTheme;"
>
</highcharts-chart>
<button (click)="changeTheme()">Change theme</button>
</div>
Component:
Highcharts.setOptions(theme2);
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
})
export class AppComponent {
Highcharts: typeof Highcharts = Highcharts;
isLightTheme = true;
chartOptions: Highcharts.Options = {...};
changeTheme() {
Highcharts.setOptions(this.isLightTheme ? theme1 : theme2);
this.isLightTheme = !this.isLightTheme;
}
}
Docs: https://github.com/highcharts/highcharts-angular#readme
Source: stackoverflow.com
Related Query
- How to update the theme of highchart
- How to change the Highchart plotline color for theme
- How to update drilldown data in highchart without redraw the chart?
- How to change the font family of Highchart to Bootstrap css default font family
- How to export a Highchart chart to PDF thanks to a button outside the chart?
- How to know information about the clicked bar in highchart column r shiny plot
- How can I do in Highchart to have 1px space between the columns and the y Axis?
- How can I extend the lines of this Highchart series to the edges of my chart area?
- How to use add series and update methods in the high chart wrapper for angular?
- Is there a way how to dynamically create a plotline in highchart when the value is lower than previous one?
- How to update Highchart from inside react a component?
- How to set series-label to false by default and change the color of series label text in highchart
- Highchart how to animate from the xaxis bottom line upward
- How to grab correct highchart number in selectors using Selenium Webdriver with Python with several charts on the page?
- how to display 2 same highcharts without duplicate the code
- Highchart how to enlarge the plotBands in a gauge?
- How to properly update the nodes on a Highcharts Sankey?
- How to disable or remove the default HighChart loading message?
- How to update the highcharts.js to make the export server to my own ipaddress,instead of connect to the highcharts server?
- How to do In highchart tooltip display the first 100 characters and then say "See more .."?
- How to make two charts using highchart show up in the same line side by side using div
- How can I put the Highchart to the html page
- Unable to update the linkLength of networkgraph highchart js
- How do I dynamically update the range inside a Gauge (HighCharts)?
- Vue js + HighChart - how can I make a synchronous axios call before the component get rendered?
- Why is the legend of my HighChart PieChart behaving irradically, when I update my series data?
- How do I set the highchart gantt headers as fixed when I scroll vertically
- how to add an color picker control to highchart for changing the color of series by user
- Highcharts. How to update x and y of the dataLabel?
- How to add value of y-axis under the x-axis labels in highchart with given dataset
More Query from same tag
- highcharts-angular dynamically update from DB
- How to implement Highcharts column-drilldown chart in Rails application?
- Rendering Mathjax in Highcharts
- Highcharts Density Dot Map Support?
- jQuery/AJAX data loading & replacement in Highcharts
- Highchart Js Column Chart Stacked and Grouping
- special characters in title of charts of Charts Js
- Highcharts Options not working
- Proper x-axis for Highcharts stack group column
- Highcharts not plotting series correctly on secondary axis
- Highcharts Legend Title Horizontal Align
- HighCharts. How to display X axis labels line without data?
- Highchart change the chart type in drilldown
- Highcharts - How do I keep both line points in from splitting between the two bar charts
- How to implement drilldown in asp.net mvc project?
- iPad - Highcharts interferes with links in the drop down
- Don't show data label if not enough room
- Highchart Legend Alignment
- Dates instead of values on Highchart labels in graph with multiple axis
- Highcharts, how to put markers on min/max values on yAxis
- Highcharts - stacked column - order series index dynamically for each category
- How do I reshape my existing JSON to fit Highcharts
- Highcharts bars are half missing after drillup
- Highcharts not workng with angular 4
- Highcharts Pie chart return slice animation on mouseout
- How to add icon/svg/image on X-axis for bar graph onclick event using highcharts?
- Show gridLines when the chart is empty(no series) in highstock
- change startOnTick after a (High)chart has been created
- PhoneGap and Highcharts
- setExtremes Event not working post setExtremes method call