Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There were only two things with rixo's code which prevented resize to work properly:</p> <p>Firstly, size of chart was set as constant (instead of being calculated based on container's size)</p> <p>I've removed line </p> <pre><code>size:{height:200,height:300} </code></pre> <p><em>UPDATE</em>: there was a single issue with size, there is no need in timeout</p> <p><strike>Secondly, by some reason ExtJS fires "resize" event <em>before</em> actual resize (so container still has exactly the same size)</p> <p>To re-render chart after real resize, I've added setTimeout call with zero interval</p> <pre><code> setTimeout(function () { chart._render({ animate: false }) }) </code></pre> <p></strike> Now it appears to be working and resizing properly</p> <p>Reworked version of rixo's fiddle is accessible here: <a href="http://jsfiddle.net/kaatula/4sHkZ/1/" rel="nofollow">http://jsfiddle.net/kaatula/4sHkZ/1/</a></p> <p>Code now looks like:</p> <pre><code>Ext.define('DxChartPanel', { extend: 'Ext.Panel' ,resizable: true ,html: '&lt;div class="chartContainer" style="width: 100%; height: 100%"&gt;&lt;/div&gt;' ,initComponent: function() { this.callParent(arguments); this.on({ scope: this ,resize: function(panel) { var ct = panel.body.down('.chartContainer'), chart = $(ct.dom).dxChart('instance'); console.log($(ct.dom).height()); ct.setSize(panel.body.getSize()); setTimeout(function () { chart._render({ animate: false }) }) } ,afterrender: function(panel) { var el = this.body, target = el.down('.chartContainer'); target.setSize(el.getSize()); this.createChart($(target.dom)); } }); } ,createChart: function(target) { var c = target.dxChart({ commonSeriesSettings: { label: { visible: true } }, series: [{ data: [ { arg: 0, val: 1 }, { arg: 2, val: 4 }, { arg: 4, val: 2 }] }, { data: [ { arg: 1, val: 1 }, { arg: 2.5, val: 9 }, { arg: 3.7, val: 5.6 }] }] }); }, resize: function () { console.log(resize); } }); Ext.create('DxChartPanel', { renderTo: Ext.getBody() ,title: "Resizable Panel" ,height: 300 ,width: 300 }); Ext.widget('window', { autoShow: true ,title: "dxChart Window" ,width: 350 ,height: 350 ,layout: 'fit' ,items: [Ext.create('DxChartPanel', { border: false })] }); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload