S
S
Sergey750il2016-06-03 01:14:17
JavaScript
Sergey750il, 2016-06-03 01:14:17

How to make SVG chart responsive?

Good day. It is not possible to add adaptability to the chart made according to this example bl.ocks.org/mbostock/3883245 I tried to set percentages for the pixel space, but nothing came of it.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
profesor08, 2016-06-03
@profesor08

Place the graph in a container, and set the container to:

overflow-x: scroll;
overflow-y: none;
width: 100%;

The graph itself will not decrease, but if it does not fit into the screen, it can be scrolled. But better find with built-in adaptability.

K
kravchenko-me, 2016-06-03
@kravchenko-me

codepen.io/anon/pen/aZOZmM
We remove the width and height in the markup in the svg,
and transfer their values ​​​​to the viewbox and write the percentage width in css

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question