score:9
Accepted answer
After reading Ricardo's comment I realized I just had to move the setOptions() call inside the $(document).ready call.
A much simplified version of my code:
Highcharts.theme1 = {
chart: {
borderWidth: 0,
},
};
var chart;
$(document).ready(function() {
// Apply the theme
var highchartsOptions = Highcharts.setOptions(Highcharts.theme1);
// Build the chart
chart = new Highcharts.Chart({});
});
Highcharts.theme2 = {
chart: {
borderWidth: 5,
},
};
var chart2;
$(document).ready(function() {
// Apply the theme
var highchartsOptions = Highcharts.setOptions(Highcharts.theme2);
// Build the chart
chart = new Highcharts.Chart({});
});
score:9
Best practice currently would be to merge in the theme with your chart options
:
chart1 = new Highcharts.Chart(Highcharts.merge(options1, theme1));
var options1 = {
// options goes here
chart: {
renderTo: 'chart1',
type: 'bar',
},
title: {
text: 'Conversions'
},
};
var theme1 = {
// themes goes here
};
var chart1 = new Highcharts.Chart(Highcharts.merge(options1, theme1));
this way you can set individual themes for each chart if you need too
Source: stackoverflow.com
Related Query
- Getting Multiple drilldown highcharts on same page to work
- Multiple "Script src" on same page causing sorting functions not to work on HighCharts
- Multiple highcharts at same page based on clientId value?
- how to render multiple line charts - highcharts on same page using highcharts react wrapper - highcharts-react-offical
- Highcharts - Same chart multiple times in same page
- multiple highcharts on same page
- Highcharts Error #16: charts not showing on the same page
- Highcharts.js - multiple themes on same page?
- Highcharts - multiple plot with the same x scale
- Highcharts clickable column to open another page on same site
- drilldown maps and funnell charts on the same page using highcharts
- Cannot display multiple Highcharts on a single page
- Multiple highcharts charts dynamically created in angular2 on one page
- Using highcharts & highstock together on same page
- Using multiple Highcharts in a single page
- How to generate single PDF of page that contained multiple highcharts in DIVs
- Highcharts show the same yAxis start and end value with multiple data series
- how to display 2 same highcharts without duplicate the code
- Display multiple points with exact same value in scatter HighCharts
- Highcharts shown in multiple divs with the same name
- How to use Highcharts React to create chart with multiple lines for same XAxis?
- Multiple Highcharts in one page - only one chart displays
- Multiple pie-charts in the same chart with HighCharts
- Highcharts multiple charts on a single page using c# asp.net mvc3
- How to show multiple Highcharts graph on one page
- Multiple chart in same page Highchart
- Highcharts (Gauge) and Highstock on the same page with Meteor
- What's the code in Highcharts such that the bars (columns) in the same group use the same color?
- Highcharts - Multiple Charts On Mobile Page
- Highcharts - how to display multiple graphs on one page using multiple xml files
More Query from same tag
- how to sync updates on several highchart graphs
- React-Native HighCharts Boost Module Usage
- Highcharts Y axis horizontal title
- create bubble chart (Highcharts) with rCharts package
- rCharts::rPlot on click event
- I was working on highcharts and react and want to built something like this with highcharts. Is it possible?
- Highchart spline Cut Off when reach to maximum scale value. How can it fixed?. I have attached may sample code on body
- How to make a Highcharts semi-circle donut chart using Hightchart-ng
- How to force start on min/max and prevent automatic rounding
- Highcharts multiple series in drill down
- Highcharts limit the amount of items that will be displayed in categories on the yAxis
- How do you change plotBackGroundColor dynamically if value exceeds a maxium value in Highcharts?
- Highcharts js different when installed with bower
- How to draw two lines in HighStocks using candlestick with intraday
- How to disable Print Chart button when there is no Chart present
- Why is one day's null data two days wide?
- highcharts datetime x-axis custom formatting
- Highcharts import loading properly in Django - Python
- Can someone help me to provide space between the time stamps on x-axis
- How can i add dynamic data inside flag series in highcharts
- Dynamically bind the series in High-charts with a dictionary object
- Highcharts donut label overflow container
- How do I create a break on the x-axis with highcharts?
- Parsing data in Highchart
- Highmaps - Legend Item Filter
- Get Highchart (/ Highstock) from public data (json)
- Highcharts: Area clickable
- Trouble showing results with pie highchart
- Real time chars using highcharts, JSON, REST and Spring MVC
- How to get columns category name on hover in highcharts