score:1
Use selectAll()
method instead of select()
in svgToCan()
function there you will get all the list of svgs.
Replace the function svgToCan(){} with these lines
var arr=[];
for(var i=0;i<d3.selectAll("svg").length;i++){
arr=d3.selectAll("svg")[i];
console.log(d3.selectAll("svg")[i]);
}
for(var j=0;j<arr.length;j++)
var svg = arr[j],
img = new Image(),
serializer = new XMLSerializer(),
svgStr = serializer.serializeToString(svg);
For your reference i have attached my jsfiddle example.
Source: stackoverflow.com
Related Query
- How to convert SVG to canvas to PNG when there are multiple SVGs in a page
- Appending svg of d3 chart to separate divs when there are multiple json files
- d3 click coordinates are relative to page not svg - how to translate them (Chrome error)
- How to load data to D3 chart from JSON when there are only tuples
- How to let multiple SVG drawings render smoothly when scrolled to?
- how to improve the drilling performance of d3 sunburst chart when there are too many paths? like dynamically show partial levels?
- Canvas convert SVG to PNG doesn't get the full size
- Is there any compatibility between HTML canvas and SVG or are they completely separate beasts?
- How to Show all the child nodes when there are many
- How to fix SVG path masking problem when too many parts of path are cut off when a mask is applied
- How to covert multiple svg to png in single html page?
- How to have only one brush show on page load when using multiple charts in dc.js/d3.js
- How to bring a selected (clicked on) bootstrap popover forward when multiple popovers are open?
- d3.js - How can I set the cursor to hand when mouseover these elements on SVG container?
- D3.js How to apply multiple classes when using a function
- D3js : How to convert svg text to path?
- Convert SVG to PNG and maintain CSS integrity
- How to fill inner area between multiple SVG paths?
- How to show a tooltip with value when mouseover a svg line graph using d3.js?
- How to avoid the overlapping of text elements on the TreeMap when child elements are opened in D3.js?
- How can I convert SVG coordinates (x,y) defined relatively to an element into absolute coordinates/position?
- Adding css style when converting svg to png
- d3js: zooming when there are two y axes
- How do I hide the text labels in d3 when the nodes are too small?
- D3 how to select element by ID when there is a dot in ID
- how to center SVG canvas in the window d3.js
- How to export PNG within SVG
- How to modify axis labels in d3 for a stacked bar chart when the axis labels are mapped as part of the scale's domain
- How to get background color of SVG converted properly into Canvas
- Bootstrap popover on svg element repositions itself incorrectly when page is scrolled
More Query from same tag
- Create a padding for the first and last data points using a time scale
- Integrating D3 charts in Meteor
- Hexbin from D3js
- Changing number displayed as svg text gradually, with D3 transition
- Group shapes/counties together by a list of attributes with D3.js
- d3 drag jumping to other position when clicked - origin?
- Getting Vega-Lite / D3 to Work in Nuxt.js
- javascript/D3 basics: If asynchronous call, why is code outside of json request?
- Dagre-D3 graph. Can egde path be customized?
- How can I open and parse a local csv file into an array?
- Handling Removal of Elements with Data Join in D3.js
- D3: Why does a 'get' action spoil the value
- D3.js animate rotation
- brush and context for a line graph
- Zoomable D3 Angular Treemap Directive
- How to add desc elements using d3.js
- C3.js in Angular2 getting error
- D3, Angular component passing in variable
- How to create one line plot per color series in Observable Plot?
- Two Rows with Circles in D3
- brush selection in scatterplot matrix example in d3.js is offset?
- D3 Fisheye Distortion on simple Scatter plot
- Cannot disable d3 topojson base map zooming on Ionic V5 App
- d3 convert to number in an array of objects
- d3.js pushing object into another object which has array of object
- Converting EPSG projection bounds to a D3.js map
- How can I specify a domain x-axis in NVD3 lineChart
- d3 svg attrtween each by each
- d3 append img to li
- Cannot hover over points that are behind path.area