You can get the svg bounding box using
svg is your svg node, e.g.
let svg = document.getElementsByTagName("svg"); let box = svg.getBBox()
and then use
.height to calculate the correct
viewBox attribute value, width and height.
- d3.tree scrollbar instead of panning
- D3.js Zooming and panning a collapsible tree diagram
- D3: remap mousewheel to be panning gesture instead of zoom gesture
- How to return Neo4j OGM entities in GraphJSON format instead of tree format for visualization?
- Drawing a collapsible indented tree with d3.xml instead of d3.json
- Collapsible Radial Tidy Tree found in ObservableHQ is not collapsing after mouse click if I use d3 v6 instead of d3 v5
- D3 force layout that moves branches in tree instead of nodes
- use a php SESSION string for d3.js tree JSON instead of .json file
- A horizontal chart with Ordinal scale yscale, but instead of pure flat names > a tree structure<
- How do you create a family tree in d3.js?
- D3js take data from an array instead of a file
- d3js Tree square
- D3 Tree Layout Separation Between Nodes using NodeSize
- Is there a way to tell crossfilter to treat elements of array as separate records instead of treating whole array as single key?
- Can I create a flow chart (no tree chart) using D3.js
- d3.js how to dynamically add nodes to a tree
- Dynamically resize the d3 tree layout based on number of childnodes
- Bubble tree in d3?
- Multiple partners in a family tree in d3.js?
- d3 - reading JSON data instead of CSV file
- D3 force layout - linking nodes by name instead of index
- Extending d3js hierarchical tree for representing topology
- Use d3 log scale instead of linear scale
- Render D3 graph from a string of JSON instead of a JSON file
- Tree drawing orientation
- how to load a json object instead of json file
- D3.JS time-series line chart with real-time data, panning and zooming
- D3: Using node attribute for links instead of index in array
- How do I create a tree layout using JSON data in d3.v4 - without stratify()
- Curved line on d3 force directed tree
More Query from same tag
- AngularJS: inject service into directive?
- Select element with specific properties d3.js
- Error: <rect> attribute width: Expected length, "NaN". and <text> attribute dx: Expected length, "NaN"
- finer control over NVD3 tooltip
- Angular NVD3 inverse Focus bar ticks display order
- d3 to account for missing data in line chart
- categorical data with D3 scale
- render bar chart with different colors in react native
- Coordinate trigonometry - calculate midpoint in arc for flightpath
- I've defined a path in d3.js, it draws correctly, but .getTotalLength() is undefined
- d3js pie graph from jquery ajax - correlating json keys and values on the chart
- How to draw a dynamic Horizontal tree with expandable div?
- filter data from csv using array filter not working as expected
- Getting unexpected black background after applying style:"stroke: blue; stroke-width: 2px;"
- nvd3 Bubble chart with log scale
- Animation is not working for d3 line chart
- how to know the current Zoom level in D3.js
- Infinite zooming in force layout d3.js
- bootstrap css messes with d3 (because... huh?)
- Shade between two curves using D3.js v5
- How do I get rickshaw to aggregate data into weeks instead of days
- source code in tickSize d3.js v4
- SVG path not displaying
- How to save d3 selections in an array for later use D3.js?
- Unable to add grid lines to bar chart
- Plotting 2 graphs together in Rickshaw
- what is the d3 default key function?
- D3: data update "enter" selection is empty