score:7
You can do this by adding a new method to chart that will manually trigger the reflow like so:
chart.reflowNow = function(){
this.containerHeight = this.options.chart.height || window.window.HighchartsAdapter.adapterRun(this.renderTo, 'height');
this.containerWidth = this.options.chart.width || window.window.HighchartsAdapter.adapterRun(this.renderTo, 'width');
this.setSize(this.containerWidth, this.containerHeight, false);
this.hasUserSize = null;
}
Then whenever you want to get away from manual resizing using setSize() just call chart.reflow()
Here's an working example: jsFiddle
Reference taken from: github-issue
UPDATE for ng-highcharts users
For doing this when using ng-highcharts library, you can simply pull out the chart object in the controller that has highcharts-ng
dependency and add the reflowNow
function, like so:
var chart = this.chartConfig.getHighcharts();
chart.reflowreflowNow = function (){ ... }
This is also the recommended way to pull out chart to do custom jobs by author of ng-highcharts as noted here and this fiddle.
score:3
I ended up finding an alternative solution to be the only thing I could get working, and it actually was pretty simple and straight forward to do. In case anyone else is looking for a fix for this, here's links to the resources that were useful and solved the issue for me.
You can simply add this to your chart config object, at the same level as the config.series or config.options. The comment references info but the actual solution that worked for me uses $timeout with 0 seconds, here
*For using highcharts-ng
obviously
http://plnkr.co/edit/14x7gfQAlHw12XZVhWm0?p=preview
$scope.chartConfigObject = {
// function to trigger reflow in bootstrap containers
// see: http://jsfiddle.net/pgbc988d/ and https://github.com/pablojim/highcharts-ng/issues/211
func: function(chart) {
$timeout(function() {
chart.reflow();
//The below is an event that will trigger all instances of charts to reflow
//$scope.$broadcast('highchartsng.reflow');
}, 0);
}
};
Source: stackoverflow.com
Related Query
- HighCharts: How to use reflow to allow auto-resize after changing size
- highcharts donut pie - How to calculate pie size percentages after resize the chart
- how to use highcharts tooltip formatter in python code
- Highcharts chart resize on window resize event after setting a specific size
- How to use jquery to access highcharts piechart plotOptions: pie : size parameter?
- how can I use rangeselector and navigation in highcharts in the given code
- Changing Highcharts font size
- How to use highcharts with angular 5?
- How To Use Epoch Time With Highcharts Series Data?
- How to use highcharts with princeXML?
- Highcharts how to use JavaScript variable as series data source?
- How to change axis label size when exporting in Highcharts / Highstock
- How to use dotnet highcharts dll to show HighCharts in MVC3?
- Query regarding why and how to use highcharts license
- How to add new points to highcharts after plotting the first 'n' points?
- Using PhantomJS to create HighCharts grahps server side for use in PDF creation (PHP) - results in exit code 11 from PHPs exec();
- How do I use an Highcharts Solid Gauge in angular 6 with typescript?
- How can i force Highcharts to use same symbols in Legend and Series?
- How do I configure the options in Highcharts to allow multiple drilldowns asynchronously?
- How to use Highcharts Drupal 7 module
- How do I use Highcharts to display candlestick with small values?
- how to use Highcharts on Ionic?
- How to use Highmaps and Highcharts with Meteor?
- How to use HighCharts dart library in Flutter app?
- How to scale Highcharts height on window resize with React
- How to keep an empty slice area in highcharts after clicking on legendItem
- How do I get my highcharts to reduce in size when the window is resized down
- Highcharts stacked column how to use different label on each category
- How to use Highcharts Gantt chart in angular?
- How to add series after click event in HighCharts
More Query from same tag
- How to change the background color of measure tool in stock chart in highstock?
- Left-align y-axis title with labels in Highcharts
- highstock display tooltip wrong in iframe
- Unselect and Select Event
- Highcharts, stacked column range with date in y-axis
- Tick and label alignment for Highcharts datetime
- Highcharts series data array not working
- unable to get the charts in the PDF download
- Laravel get two value array count from controller in javascript
- Highcharts: "Print all" button
- Highcharts Format tooltip for linkedTo: ':previous'
- Highstock datetime xAxis, can only show all. no zoom
- Prevent source to load twice
- Not able to align highchart made using angular js
- Moving javascript data series to html data attribute breaks Highchart
- How to avoid duplicate X time axis labels
- Weekly PDF generation using PHP and Highcharts
- Highcharts - graph - decades
- Vaadin-Charts won´t apply all CSS styles on export/download
- Highcharts - timeseries chart with y-axis values need to be group with text labels
- Highcharts xAxis padding is lost when navigator when zooming in and out and can't get the padding back when zoom out
- Highchart network graph with tooltip when hover on every node
- Highcharts, highslide and ReportViewer
- highcharts change series color when data is dynamically inserted
- Highcharts Polar Chart customization
- Disabling Handlebars in HighStock charts navigator
- Highcharts generate column chart from XML
- having issue when updation Highcharts object using highcharts-ng directive
- highcharts find point with given x value
- Highstock don't draw