Conditional re-size of chart

edited March 7, 2017 in Questions
I am relatively new to highchart API and need some assistance with re-size the chart image based on certain condition. Following is the code snippet I am using. But it is not having any impact on the size of the chart:

var chartObj = arguments[0],$ = skuid.$;
if(some condition...) {
$.extend(true, chartObj.chart[0],{
    width:100,
    height:100
});
}

Comments

  • Matt SonesMatt Sones 💎💎💎
    edited February 10, 2017
    You may need to add 'px' or '%'... 100px.

    If that doesn't work...
     I occasionally have had trouble with the $.extend syntax (probably just my own mistakes). But I think you can just set the width and height directly:

    chartObj.chart[0].width = 100px;
    chartObj.chart[0].height = 100px;
  • J.J. 💎
    edited March 7, 2017
    Riju,

    I think it should be chartObj.chart, not chartObj.chart[0]. Both of them are numbers (highcharts interprets them as px), so you shouldn't need to specify "px" either. 
  • edited August 3, 2015
    Thanks for your responses. But it still does not have any impact on the image. This is however working if I try it on a standalone highchart image. I need to spend some more time on it and check if I am missing something.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!