A negative value for svg attribute <width> is not allowed
Asked Answered
C

3

7

I am trying to draw two google treemaps and keep them in tabs and am getting the error:

A negative value for svg attribute <width> is not allowed

Only one of the treemaps is visible. I am assuming the other one is not able to finish drawing. There is no other description of the error in the console. (Google chrome).

My code: http://jsfiddle.net/tTqjr/

Clavate answered 13/9, 2011 at 2:22 Comment(2)
Have you checked for negative weight values already?Kuibyshev
Not sure I understood your question. I can draw both the treemaps if I remove the code which is trying to "tabify" them.Clavate
C
11

Solved the problem. The div element on which Google Annotated timeline was being created had display:none property. Just made sure that display:none is changed to display:block before calling the draw function.

Clavate answered 14/9, 2011 at 22:58 Comment(2)
This has just solved the same issue with angularjs. Thanks!Nannana
I had a google.visualization.PieChart in a div with CSS border: 1px solid; which was causing the same issue. Removing it cured the problem!Randers
T
2

Appreciate this wasn't the OP's issue, but I had the same error, and setting display: block; didn't make any difference for me, but I had padding-top: 50px; on the div for the chart, and removing that resolved the issue for me!

Trigg answered 20/6, 2016 at 11:5 Comment(0)
V
2

I wrapped my two divs in a boostrap row/col pair to solve and togglke them with hide()/show()/toggle() buttons.

From

<div class="row">
    <div class="col-md-12" id="chart_div">
    </div>
</div>
<div class="row">
    <div class="col-md-12" id="chart_div2">
    </div>
</div>

to:

<div class="row">
    <div class="col-md-12">
        <div id="chart_div">
        </div>
    </div>
</div>
<div class="row">
    <div class="col-md-12">
        <div id="chart_div2">
        </div>
    </div>
</div>
Videlicet answered 20/9, 2016 at 13:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.