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.

11
votes
1answer
55 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 ...
2
votes
0answers
214 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 ...
4
votes
1answer
52 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 ...
8
votes
3answers
456 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 ...
2
votes
1answer
71 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 ...
6
votes
2answers
176 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 ...
0
votes
1answer
56 views

Simple chart class for SVG path generation

Here is a class I have: ...
3
votes
0answers
21 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 ...
7
votes
1answer
138 views

Random Dice Simulation

I extended the example in 04-random.elm to support N dice and to draw the results using SVG. ...
3
votes
1answer
505 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 ...
6
votes
1answer
499 views

Python fractal tree using SVG

I made a simple program to generate fractal tree using PATH object of SVG. Any suggestions? ...
1
vote
0answers
146 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: ...
7
votes
1answer
153 views

Loading an SVG into the canvas

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 ...
1
vote
1answer
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. ...
2
votes
0answers
512 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 ...
5
votes
1answer
4k views

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

I'm using the following function to enable dragging on an SVG group. ...
2
votes
0answers
171 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 ...
4
votes
1answer
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 ...
4
votes
1answer
224 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:...
4
votes
1answer
134 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: ...
8
votes
1answer
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:...
1
vote
1answer
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 ...
7
votes
1answer
87 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, ...
3
votes
0answers
242 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. <...
4
votes
1answer
177 views

Cutting rectangle from circle

Can the following code snippet be optimized or am I doing it right? ...
84
votes
3answers
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 ...
6
votes
1answer
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 ...
4
votes
1answer
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 ...
5
votes
1answer
2k 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 ...
0
votes
1answer
630 views

Colour-changing clock

I am fairly new to javascript and I would like to write my code on a more readable and efficient way. Any critique of what I've written would be greatly appreciated, especially the section of ...
3
votes
1answer
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? ...
6
votes
2answers
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 ...
2
votes
1answer
104 views

SVG drawing code

How could I optimize this code / make it look better? Any advice on things I'm doing wrong? ...
1
vote
1answer
566 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. ...
2
votes
1answer
770 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 ...
2
votes
0answers
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 ...
8
votes
1answer
21k 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. ...
-1
votes
1answer
313 views

Optimizing this SVG animation for size [closed]

I'd like to code review generated svg animation, while this might stretch definition of this site, I really hope this is interesting and revelant topic, as this SVG file is really like any other ...
3
votes
2answers
587 views

Python Barcode Generator v2

This is a complete rewrite of the code posted for review in this question. The question is identical. ...
12
votes
1answer
21k 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 ...
3
votes
1answer
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 ...
0
votes
1answer
163 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? ...
0
votes
1answer
150 views

Perl hash mapping SVG elements to content elements

Is there a more reliable way of getting the content elements for each SVG element? ...
6
votes
2answers
4k 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: ...
2
votes
1answer
2k views

D3.js zoomable map

I have this code and would like to have it reviewed: ...
5
votes
2answers
903 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: ...
3
votes
1answer
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 ...
2
votes
2answers
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 ...
8
votes
1answer
819 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: ...