-
Notifications
You must be signed in to change notification settings - Fork 462
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Charts don't resize at all. #597
Comments
Same issue here. $element.find("#mychart").highcharts();
chart.setSize(width, height); where #mychart is the directive id attribute. Or you can add $watch on the directive itself for element.clientWidth and element.clientHeight: HighChartNGController.$inject = ['$scope', '$element', '$timeout'];
function HighChartNGController($scope, $element, $timeout) {
$scope.$watch(function() {
return $element[0].clientWidth
}, function() {
ctrl.chart.setSize($element[0].clientWidth, $element[0].clientHeight);
});
} (The latter may need to make $scope.$digest() call somewhere...) |
I have the same issue using bootstrap and Highcharts-ng. The chart is always 600x400 https://i.imgur.com/f5FP8iQ.png no matter the div's size |
Seems that you need to include |
the highcharts-ng.css file also just has one css class in it. you can just paste it into your own css and it works for me without the overhead of a http load of another file for one 3 line css class. |
For me, letting the "width" property in the HighCharts object, and adding this snippet to my wrapper component, works (In Angular 5, both Chrome and Firefox Quantum):
Where "mychart" is the ID of the div that holds your chart. |
I was going to PR this repo, but it doesn't look like anyone's been supporting it in a long time. If anyone is looking for the answer, I discovered that it's because browsers (Chrome, in my testing) treat elements that they don't know about as |
I'm not sure if this is intended, but charts don't resize at all--not even when the parent container size changes. I don't see any documentation stating what is expected. This is true for the fiddle linked in the bug creation comments. (http://jsfiddle.net/gh/get/jquery/3.1.1/pablojim/highcharts-ng/tree/master/jsfiddles/basic/)
How can I get the chart to resize its width to the parent container and when window sizes change?
Highcharts 5.1.0, Angular 1.6.4, highcharts-ng 1.1.0
This happens on Edge on Windows and Chrome on Windows and Linux. On Firefox on Windows and Linux, all but the top ~5% of the chart is clipped (this also happens in the jsfiddle provided).
(I saw a lot of discussion about "reflow" hacks. That had no effect and those issues didn't describe what I'm seeing now.)
The text was updated successfully, but these errors were encountered: