d3条形图在Firefox中隐藏但不在chrome中

时间:2013-02-14 10:01:18

标签: javascript html google-chrome firefox d3.js

我有d3条形图的奇怪案例。 我能够用chrome看到它很好,但在firefox中它表现得好像某个元素覆盖了它的某些部分。但是当我在firefox中以3D形式查看页面时,它会向我显示矩形但它们在页面上不可见。 我包括用d3生成的生成的HTML,它在chrome和firefox中表现不同。

<script type="text/javascript" src="js/bar_chart.js"></script><script  type="text/javascript" src="d3/d3.v3.min.js"></script></head>
<body>
<div style="position:fixed;
    position:obsolute;/*for ie6*/
    background-color: rgba(0,0,0,1.0);
    height:206px;
    width: 100%;
    top:0px;
    right:0px;" class="plot" id="barchart">

<br><br>
<p class="bob"></p>
<svg class="bar"><g transform="translate(20,0)"><line x1="0" x2="1295" y1="149.5"  y2="149.5" style="stroke: #ffffff;"></line><line x1="0" x2="1295" y1="119.5" y2="119.5" style="stroke: #cccccc;"></line><line x1="0" x2="1295" y1="89.5" y2="89.5" style="stroke: #cccccc;"></line><line x1="0" x2="1295" y1="59.5" y2="59.5" style="stroke: #cccccc;"></line><line x1="0" x2="1295" y1="29.5" y2="29.5" style="stroke: #cccccc;"></line><line x1="0" x2="1295" y1="-0.5" y2="-0.5" style="stroke: #cccccc;"></line><rect x="-0.5" y="119.5" width="64" height="30" fill="steelblue"></rect><rect x="63.5" y="89.5" width="64" height="60" fill="steelblue"></rect><rect x="127.5" y="71.5" width="64" height="78" fill="steelblue"></rect><rect x="191.5" y="35.5" width="64" height="114" fill="steelblue"></rect>
<rect x="255.5" y="23.5" width="64" height="126" fill="steelblue"></rect><rect x="319.5" y="-0.5" width="64" height="150" fill="steelblue"></rect><rect x="383.5" y="17.5" width="64" height="132" fill="steelblue"></rect><rect x="447.5" y="41.5" width="64" height="108" fill="steelblue"></rect><rect x="511.5" y="59.5" width="64" height="90" fill="steelblue"></rect><rect x="575.5" y="71.5" width="64" height="78" fill="steelblue"></rect><rect x="639.5" y="83.5" width="64" height="66" fill="steelblue"></rect><rect x="703.5" y="77.5" width="64" height="72" fill="steelblue"></rect><rect x="767.5" y="59.5" width="64" height="90" fill="steelblue"></rect><rect x="831.5" y="29.5" width="64" height="120" fill="steelblue"></rect><rect x="895.5" y="41.5" width="64" height="108" fill="steelblue"></rect><rect x="959.5" y="47.5" width="64" height="102" fill="steelblue"></rect><rect x="1023.5" y="53.5" width="64" height="96" fill="steelblue"></rect><rect x="1087.5" y="41.5" width="64" height="108" fill="steelblue"></rect><rect x="1151.5" y="11.5" width="64" height="138" fill="steelblue"></rect><rect x="1215.5" y="-0.5" width="64" height="150" fill="steelblue"></rect><text class="rule" x="0" y="149.5" dx="6" text-anchor="middle" fill="white" font-size="14px">0</text><text class="rule" x="0" y="119.5" dx="6" text-anchor="middle" fill="white" font-size="14px">5</text><text class="rule" x="0" y="89.5" dx="6" text-anchor="middle" fill="white" font-size="14px">10</text><text class="rule" x="0" y="59.5" dx="6" text-anchor="middle" fill="white" font-size="14px">15</text><text class="rule" x="0" y="29.5" dx="6" text-anchor="middle" fill="white" font-size="14px">20</text><text class="rule" x="0" y="-0.5" dx="6" text-anchor="middle" fill="white" font-size="14px">25</text></g></svg></div>

</body>

1 个答案:

答案 0 :(得分:1)

此问题已在以下主题中解决: SVG renders but gets cut off in Firefox only - why? 谢谢。