D3 SVG issue in Internet Explorer

廉价感情. 提交于 2020-01-06 18:05:34

问题


I am having some trouble in displaying a scrolling legends using D3 and SVG. My legends vary based on data and can be of any range. from 1 to 150

here's a simple working fiddle:

https://jsfiddle.net/bikrantsharma/eqnnd84v/

On Chrome: everything works fine it scrolls well But in IE the container displays of a smaller height and all the legends are displaying real small and with no scroll coz the max-height is never hit.

I have read somewhere that IE does not determine the SVG height correctly so we have to use relative positioning and provide initial height.

I have tried applying relative and absolute positioning as

.legend-main-div{
height:0;
padding:40%;
position:relative;
}

.SVGClass{
    top:0;
    bottom:0;
     position:absolute;
}

where SVGClass is applied to the svg element. This displays the legends correctly but now i loose the scrolling functionality.

Is there a way to get scrolling legends working in both chrome and IE?

For some reason in the fiddle all the items are not getting displayed in my scrolling window but in my actual code it is working fine.


回答1:


Well thanks Gerado for the suggestion on the other question..

on Chrome - Setting height to '100%' was not affecting the viewport height which was set to the responsive div height.

Whereas on IE - Setting the height to 100% was causing the viewport to get the initial height instead of what was set inside the view port.

Setting the height of SVG to responsiveDiv height instead of 100% actually resolved the issue. Updated the fiddle.

if someone wants to see how it looks in IE change the legendSVG height to '100%'

Please let me know of any comment



来源:https://stackoverflow.com/questions/43625690/d3-svg-issue-in-internet-explorer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!