Z
Z
zlodiak2018-08-27 16:17:16
JavaScript
zlodiak, 2018-08-27 16:17:16

Why is svg not rubber?

In angular, I added the D3 library and drew the axes of the graph. at the same time, I set values ​​for the svg viewport and the width of the parent container: STACKBLITZ DEMO
The problem is that svg does not adjust to the width of the browser window (or parent container). Please help me to solve it. Moreover, the same code works without problems outside the context of the angular: JSFIDDLE
tpl:

<div class="cost-square-wrap">
  <svg id="costSquareGraph" viewbox="0 0 1200 250"></svg> 
</div>

css:
.cost-square-wrap {
    width: 100%;
}

svg {
    width: 100%;
    min-height: 250px;
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
Web Developer, 2018-08-27
@zlodiak

Angular requires the correct capitalization of the property name.
"viewbox"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question