# Questions tagged [svg]

Scalable Vector Graphics (SVG) is a family of specifications of an XML-based file format for two-dimensional vector graphics, both static and dynamic.

51 questions
Filter by
Sorted by
Tagged with
5k views

### Shielding your CodeReview on GitHub

In response to a feature-request on meta, I spent a few hours today creating the feature in php. This application adds a review shield to your GitHub repository (or wherever else you want it). It ...
22k views

### Making lines with SVG and JavaScript

I just started trying out SVG the other day. Eventually I hope to be able to know how to do what SE does with their reputation graphs. For now, I've just been trying to set up an easier way to make ...
62 views

### Visualization of the Pythagorean theorem

Background The Pythagorean theorem asserts that for a right triangle with hypotenuse $c$ and other sides $a$ and $b$, the area of the square placed upon $c$ is equal to the sum of the areas ...
753 views

### Draw sine wave going around a circle

I have used d3 to draw a sine wave going around a circle. This is the very first time I've used d3 or drawn a SVG and I'm fairly new to JS as well, so I don't know if I've overcomplicated it/if there ...
23k views

### HTML / JS Slot Machine Simulator

This code is a slot machine simulator that uses elements of both HTML and JavaScript. Please pardon the lack of comments. ...
822 views

### First attempt at a SVG parser

I figured it's about time to jump into some Haskell, so here's a first attempt at an oddly specific SVG parser: ...
1k views

### 2D colliding disks in JavaScript (ideal billiard balls)

I am implementing a simulation of colliding disks (ideal 2D billiard balls) in JavaScript. I follow an event-driven algorithm that avoids discretizing time; the algorithm goes as follows at each step:...
149 views

### Random Dice Simulation

I extended the example in 04-random.elm to support N dice and to draw the results using SVG. ...
153 views

The code below is loading an svg into the canvas via RaphaelJS. There are mouseover/mouseout events, on click on an element of the svg, and drag/zoom. I would like to know, what are some good ...
93 views

### Git Insert Delete Graph

I attempted to recreate the github code frequency graph(example) with a daily granularity using perl and git log. How did I do, ...
5k views

### SVG path parsing

I have a module in Python for dealing with SVG paths. One of the problems with this is that the SVG spec is obsessed with saving characters to a pointless extent. As such, this path is valid: ...
1k views

### Parse floats from a string

While fixing some old code I came up with a class that parses floats from a string. This is used for parsing svg files in xml format. Floats can be separated by comma, space or anything at all in ...
213 views

### Soccer field map creator

I am fairly new to OOP and am working on a little website project to practice. I wanted to post after getting the initial setup done in case I am making any major errors or not following best ...
3k views

### Simple grid using SVG

I developed this grid which displays number of records for X & Y, user can click each number to see a list. (I didn't add list markup to fiddle yet - so lets not worried about it for now.) What I ...
649 views

### Python Barcode Generator v2

This is a complete rewrite of the code posted for review in this question. The question is identical. ...
592 views

### Python fractal tree using SVG

I made a simple program to generate fractal tree using PATH object of SVG. Any suggestions? ...
985 views

### Optimizing mouse in/out

I have this code that places a marker and on mouse-over this marker is scaled out and then back to the 'original' scale: ...
5k views

### Using d3.drag() to enable dragging on an SVG group

I'm using the following function to enable dragging on an SVG group. ...
3k views

### CSS mask clipping and overlay SVG to achieve a two effect

I am currently attempting to create a two SVG overlay / masking like the image below: I have created a SVG for the overlay. As it stands, I am trying to create two elements one for the green side and ...
181 views

### Cutting rectangle from circle

Can the following code snippet be optimized or am I doing it right? ...
76 views

### Shell function to convert .png to .svg file

I needed to convert some custom icons that were in .png format to .svg format and did not want to use an online converter for it. I could not find an out-of-the-box solution online so I created my ...
273 views

### Plotting discontinous function

I've made a simple web plot with D3 JS version 4. I've drawn a discontinuous function: $$f(x)=\frac{1}{x(x-2)}$$ which has 2 vertical asymptotes and 1 horizontal asymptote. I add a legend with LateX:...
2k views

### D3.js interpolating line on circumference of circle

For now, I've tried to make a line rotate on the path of a circle, but used setInterval multiple times and there might be other ways of achieving the same. I would ...
1k views

### SVG photo mosaic creator

I got this as part of some interview assignment. After some head scratching I think I have done quite well as the result can be seen here: After transformation(10x10 tile): More crisp picture with ...
141 views

### Render SVG background with Gradient

I'm new to and still fairly confounded by SVGs. I'm feeling pretty happy with the following hobbled together SCSS code demonstrated here: ...
2k views

### Best way to create SVG from database? (Using PHP)

I've got a SQL database that keeps track of which services a client has. I need to create an image using SVG that only displays the services that the client has. The database stores the services in ...
1k views

### Generating SVG animation of falling leaves

This is a Python script I wrote to generate a SVG animation of falling leaves. How can I simplify my script and also make the animation look more realistic? ...
628 views

### Compress svg files in PHP

I wrote something to "compress" svg files. The svg files I am using often have comments and empty <g> tags, and I want to remove them. My main goal is not the ...
2k views

### Displaying overlapping blocks using d3.js

The code takes in nodes with different start time as input and assigns the position such that they will not overlap. As I have coded with too many loops and conditions. Can anyone review the code and ...
18 views

### Browser-editable SVG diagrams using JS & SVG.js

[This is my first question to Code Review and it might be a bit too much.] I want to give users the means to draw a simple diagram in the browser, and because it is partly a self-education project ...
22 views

### Compare timestamps of svgs versus exported pngs and export via Inkscape

This script goes through all svg files in an assets folder and compares them to the exported layers (one level above). If the svg timestamp is newer, it will automatically export the svg using ...
575 views

### JSON schema visualizer

I have the following backbone function to read a JSON schema and draw the tree structure (as in the screenshot below). I want to make sure if checking against the type as object/array is alright or if ...
280 views

### Hourglass path in SVG for Android

I've created my first Android drawable, a hourglass shaped image, and I'm curious what can be improved with it. It seems weird having to use 4 paths, but I couldn't get it to work any other way. <...
78 views

### d3.js canvas performance

I've just rewritten this code (a simple gravitational restricted n-body simulation) to display using canvas, rather than SVG. The reason being that I'd like to be able to run it with many thousands of ...
2k views

### D3.js zoomable map

I have this code and would like to have it reviewed: ...
82 views

### Simplify SVG creation and manipulation using Proxy

A need I have always found dynamically creating SVG content and filters a painful and messy process. The constant need for conversion from JavaScript values to SVG and back, Access to the SVG ...
114 views

### SVG drawing code

How could I optimize this code / make it look better? Any advice on things I'm doing wrong? ...
1k views

### Optimize coloring book built with Raphaël and jQuery

I've been building a coloring book for kids: http://coloringbook.core.ba.lightburncloud.com/ It's got to work on an iPad, so I decided to try out Raphaël JS. I want to try and make this as efficient ...
817 views

### Google Map, SVG Graph and ruler

I would like to get feedback on the code. It is working and can be seen here. I welcome any kind of feedback, since I am just starting to use JavaScript. Epecially in the case of performance, there ...
451 views

### Grouped stacked bar chart in d3js

I've the following d3 chart which is both grouped and each grouped contains a stacked bar. But somehow, I feel this is not a proper way to implement and little complicated. If there was only stacked ...
179 views

### SVG filtering an image to stepped alpha grayscale

I have a variety of images that will be used in a style intended to mimic a dot-matrix LCD. In a previous version, I rendered these images using a program and essentially ended up with a duplicate of ...
2k views

### Optimizing snap SVG animation with collision detection

I have a snap SVG animation which animates a bunch of circles, and draws a line between them if they are within a certain proximity of each other. However, I realize that there is a lot of optimizing ...
2k views

### “Spinning wheels” - Animated spinner with SVG and Sass-CSS

I've made this little animation using SVG, CSS-keyframes and a bit of Sass. ...
3k views

### Converting an SVG polygon path from relative to absolute coordinates

This question was moved from StackOverflow as suggested by some users. I developed a function that aims to (should) provide a simple and effective method to transform a polygon ...
588 views

### Is the Button, an <a> element with svg code and hidden link content inside, ARIA conform and well laid out?

I have an a element for a button. The SVG snippet inside links to the containing SVG file at the top of the body. ...
150 views

### Line Graph animation with SVG and ES6 template strings

I've made this animation which shall be incorporated in the header of a webpage. Demo with compiled Sass and uncompiled ES6 code: ...
169 views

### Perl Hash mapping SVG elements to their attributes

Is there a more reliable way of building a hash of the attributes associated with each SVG element? ...
151 views

### Perl hash mapping SVG elements to content elements

Is there a more reliable way of getting the content elements for each SVG element? ...