I am building an editor that uses an SVG element as the canvas. It provides custom drag-and-drop behavior to drag elements inside the svg around. However, when I try to drag an <image> tag, the native browser drag behavior where you’re dragging a “ghost” of the image kicks in. How do I stop it? I tried setting user-select: none in
Tag: svg
How to prevent dragging of an
Can’t append simple svg to body element
I know this is a super easy question. But I am apparently missing something super obvious. I just want to create an svg element with D3 and see it on my page. My index.htmllooks like this: Whereas my selections.js looks like this: The first console.log() is still visible in the console. But I cant see the svg. I know I
How to add grid lines to a Chart in Javascript
I’m new to Javascript, and through exploring various websites I have created a draggable points line chart. The data points are movable and the line connecting the dots is made invisible. The data …
Add text to SVG path dynamically
I have an SVG exported from Adobe Illustrator with several paths like this, which produces a small polygon I intend to use as a text box &…
Insert circular text into sections in SVG using Javascript
It’s me again with my “Wheel of life” thing. But since last time i’ve got many steps further. I actually arrived at the final step, adding text in sections. Here is the code I have so far (…
How to make to drawing a SVG with D3.js?
I’m trying to draw a map in an SVG with the GEOJSON data that I bring from this API, the SVG paths are filled with the data, however, the SVG is blank, as can be seen when executing the code below. …
Integrate interactive map with React
I want to have an interactive map in an idlegame where you can click on a tile (See screenshot) and something should happen. I am trying to do so with an SVG and paths around the tile. Please tell me …
Hyperlink does not work in HTML code that connected with JS code
I’m creating an interactive map for office locations to make it easier for clients to reach out to the nearest office. I use HTML file, CSS file, and JS file together for this map. Everything works …
Changing the attribute cx and cy when screen resize in D3.js with React
I have a problem with the dynamic change of cx and cy attributes depending on the size of window.innerHeight/window.innerWidth. I am sending to component window.innerHeight/window.innerWidth as hight/…
Fill D3 arrow with colors
I managed to plot an arrow with D3 that changes direction and size dynamically. Now, I would like to fill the encapsulated area with a color. However, I plot the arrow outline with a succession of …