Opened 10 years ago
Closed 10 years ago
#13292 closed defect (invalid)
dojox.charting.Chart.resize() in 1.6 does not resize surface for hidden elements
Reported by: | a06275 | Owned by: | Eugene Lazutkin |
---|---|---|---|
Priority: | high | Milestone: | 1.7 |
Component: | Charting | Version: | 1.7.0b1 |
Keywords: | Chart resize marginBox | Cc: | [email protected]… |
Blocked By: | Blocking: |
Description
Tested against Chrome and Firefox on Windows 7, but don't believe this is browser or OS-related.
Commit for revision 23834 against dojox trunk made a change to charting/Chart.js whereby the resize() method was refactored. As a result of this, any attempt to resize a surface of a node which is not currently visible will fail, as the "box" variable is reset to the width/height of the node being acted upon before the surface is sized against that box variable.
// This will fail if pieChart node has style of "display: none;" pieChart.resize(200,200);
Our code currently sets up two versions of charts (thumbnail and full-size) for each dataset on the page, and then only displays the relevant one (to make switching faster). Unfortunately, with them all initially set to hidden, this means that the offsetWidth/offsetHeight returned from the marginBox getter is resetting the box width/height to zero, and meaning that even when we display the charts, they're 0x0 pixels and hence invisible.
(Apologies for mistakes in bug creation - my first one!)
Change History (2)
comment:1 Changed 10 years ago by
comment:2 Changed 10 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
Invisible elements cannot be resized properly. You should resize them after you make them visible.
As far as I can see this box variable reset was already there in 1.6, see: http://svn.dojotoolkit.org/src/branches/1.6/dojox/charting/Chart.js It was indeed removed (by mistake) during 1.7 development and put back in [23834]. The correct way to do would be to resize the chart when you make it visible.
Or maybe I did not understand your issue. Do you have a minimal sample that does reproduce it and shows to potential regression from 1.6 to 1.7?
Thanks!