svg

simple bar plot with mithril.js and d3.js

折月煮酒 提交于 2021-01-29 08:47:07
问题 I am very very new to javascript and mithril.js. I am trying to create a very simple bar plot using mithril.js and d3.js. But, I am not having any luck even getting the axis in place. Firstly, I created a mithril "svg" component and appended a mithril "g" compent as follows: var g = m(gView, {transpose:"translate(10, 10)"}) var svg = m(SVGView, {width: 100, height:100}, g) where gView and SVGView are as follows: var gView = { view: function(vnode) { return m("g", vnode.attrs, [vnode.children]

How do I rotate and skew an SVG rect “in-place”?

喜你入骨 提交于 2021-01-29 08:44:24
问题 I am playing with SVG and I am stumped by something. I am trying to make the pink square into a diamond by using skew and rotate . However I am getting strange behaviour that I cannot figure out how to overcome. Adding the skew , gets me the diamond effect I want, but then I need to rotate and reposition it so it lines up with the circles. <rect x="126" y="0" width="40" height="40"fill="pink" transform="skewY(10)" /> However, when I apply rotation transform="rotate(45)" to the rect , it doesn

How to Use Loaded SVG Module

隐身守侯 提交于 2021-01-29 08:11:16
问题 I have set up webpack to load SVG files into my TSX port of the create-react-app, per this answer: const logo = require('./logo.svg'); However, when I try to use it as follows I get a nasty 404. <img src={logo} className="App-logo" alt="logo" /> Failed to load resource: the server responded with a status of 404 () [object%20Module]:1 This makes sense - I require the svg, so it loads as a module, and you can't jolly well make a src URL out of that. That being said, how do I use an SVG loaded

Why do only the first two curves of this SVG display in Firefox?

自闭症网瘾萝莉.ら 提交于 2021-01-29 07:22:52
问题 Why does this SVG display in its entirety in Chrome, but not in Firefox? It is handcrafted, and I'm trying to figure out if I missed something, or I'm using it incorrectly - or, if it's instead just a problem with Firefox. The correct display would seem to be Chrome's (six 'bumps' visible), while in Firefox it only displays the first two curves (the first 'bump'). <svg width="450" height="50" viewBox="0 0 450 50"> <path d="M0,0 C13.642086,0,23.815591,50,37.457677,50 C51.099763,50,61.273268,0

There is a web standard for animated vector images?

删除回忆录丶 提交于 2021-01-29 06:13:01
问题 Assuming that the SVG is the standard for still vector images, there is an equivalent for animated vector-based images too ? The problem I'm trying to solve can't be solved by pixel-based formats such as APNG or GIF, they don't scale at all on different displays, and they also get really really heavy pretty quick, vector images are what I need but I need a standard way to provide a file with an animated vector entities in it. To be clear I'm not trying to animate a webpage or part of it, I'm

Setting “width: auto” inside a <div> with “display: flex; flex-direction: row” doesn't work

柔情痞子 提交于 2021-01-29 04:11:52
问题 I'm trying to place bunch of divs side by side, left to right. So I'm using a flexbox with direction set to row . I want each of those divs to derive their height and width from the content inside, hence I have left their height and width to default. Lastly, I want to use an svg as the background. For that, I'm using a grid container and placing both the svg and the div in the same column and row as suggested in this stackoverflow post. Im setting the height and width of the svg to 100% to

Touch events are wrong for transformed SVG elements

允我心安 提交于 2021-01-29 03:14:20
问题 In the process of experimenting with scaling/panning an inline SVG image by applying a matrix transform I have discovered a rather peculiar thing. After loading the image I am attaching a touchstart event listener to some of the elements in the SVG image and the event fires right away when the object is touched. However, after applying a transform document.getElementById('mysvg').setAttribute('transform''matrix(a b c d e)') which has the effect of scaling and/or translating the entire SVG

SVG pathLength don't work on safari

泄露秘密 提交于 2021-01-29 03:08:01
问题 I am trying to do some growing line animation with SVG and CSS animation. Since the lines have different length respectively, I use pathLength to assign a virtual length for them. Thus i can use only one @keyframe for all of them. Here is the sample code <svg width="1000px" height="100px"> <g stroke="#FAB" stroke-width="3"> <line id="Line1" x1="20", y1="20", x2="520", y2="20" pathLength="1000"/> <line id="Line2" x1="20", y1="50", x2="780", y2="50" pathLength="1000"/> </g> </svg> <style> line

SVG animations artifacts on Safari

为君一笑 提交于 2021-01-29 02:06:21
问题 I'm using d3.js to do some svg layout/animations and am running into the problem described by the first example here (only on Safari / Safari mobile): http://www.mysparebrain.com/svgbug.html (e.g., when the rect+text moves, it leaves rendering artifacts in its path) Does anyone know of a workaround for this? The only similar question on SO I could find is this unanswered one: Canvas draws artifacts in Safari for animated, filled bezier curves 回答1: You should definitely file a WebKit bug

SVG animations artifacts on Safari

允我心安 提交于 2021-01-29 02:05:02
问题 I'm using d3.js to do some svg layout/animations and am running into the problem described by the first example here (only on Safari / Safari mobile): http://www.mysparebrain.com/svgbug.html (e.g., when the rect+text moves, it leaves rendering artifacts in its path) Does anyone know of a workaround for this? The only similar question on SO I could find is this unanswered one: Canvas draws artifacts in Safari for animated, filled bezier curves 回答1: You should definitely file a WebKit bug