Search code examples
javascriptd3.jsresizeoverridingc3

Is there a way to override c3_chart_internal_fn.generateResize on c3js?


I have been using d3js all these days and recently found out that c3js makes the job easier.

Now, I have the graph and when I try to resize the page the graph redraws itself. Is there a way I can override this? Tried Onresize and Onresized, they are not overriding the default behavior. Found from the code that when I resize, it calls this function https://github.com/masayuki0812/c3/blob/master/c3.js#L968

Any help is appreciated!


Solution

  • You can just overwrite it for your chart instance. Something like

    chart.internal.generateResize = function () { }
    

    That said, what you probably want is if there are no other resize handlers

    window.onresize = null;