svg

D3 - make links flow along with nodes when tree loads

一曲冷凌霜 提交于 2021-01-05 11:46:18
问题 Below code represents a flow chart with connecting links that was built using D3.js Things work fine, but one issue I am seeing is with the links , right now the links are drawn first and then the nodes are transitioned/animated to their respective positions. How can I have both links and nodes transition to their positions simultaneously ( smoothly ) ? var margin = { top: 20, right: 120, bottom: 20, left: 120, }, width = 960 - margin.right - margin.left, height = 800 - margin.top - margin

How to get X,Y coordinates from path element inside SVG?

允我心安 提交于 2021-01-05 08:39:20
问题 Here is a fiddle of what actually have. https://jsfiddle.net/Lofdujwr/ I'm using a library for zoom and pan an SVG svgpanzoom. I have a button when clicked it zooms on spain for example, so I put the coordinates in: $("#spain").on("click", function() { panZoom.zoomAtPoint(12, {x: 188, y: 185}); }); The problem is when I resize the page that coordinates doens't work anymore I need to recalculate them, I have found a function that might work but I don't know how to use it: var s = instance

How to add a path with 'd' attributes to a svg dynamically [duplicate]

两盒软妹~` 提交于 2021-01-04 09:17:16
问题 This question already has answers here : jquery's append not working with svg element? (14 answers) Closed 5 years ago . I'm having a problem dynamically generating path elements inside an empty svg with javascript. I'm not interested in using third-party libraries, I'd like to understand how it works in vanilla javascript. For the following codepen, I'm using jQuery for simplicity's sake. here is the javascript for those not interested in visiting the codepen link: $(function() { function

Import svg with gradient stroke to paper.js project

非 Y 不嫁゛ 提交于 2021-01-04 07:26:28
问题 Paper.js don't show path with gradient imported from SVG. Here is an example https://codepen.io/Husband/pen/LoomQo As you can see a path with stroke color red is displayed, and path with a gradient is hidden. <canvas id="canvas" resize></canvas> <svg xmlns="http://www.w3.org/2000/svg" width="1440" height="593" viewBox="0 0 1440 593" id="svg" style="display: none"> <defs> <linearGradient id="a" x1="3.463%" y1="53.239%" y2="53.239%"> <stop offset="0%" stop-color="#2CC2FE" stop-opacity="0"/>

How to show SVG image in PyQT5 from string/xml stream?

这一生的挚爱 提交于 2021-01-03 08:47:22
问题 In a Python3/QT5 application, I'm trying to show a SVG image built originally as a string. I need to manipulate this SVG image (e.g. change its color), so I have the string changing over time. Here is a minimal working example: import sys from PyQt5.QtWidgets import QApplication from PyQt5.QtSvg import QSvgWidget svg_str = """<?xml version="1.0" encoding="UTF-8" standalone="no"?> <svg width="300" height="300" viewBox="0 0 300 300" id="smile" version="1.1"> <path style="fill:#ffaaaa" d="M 150

How to update C3.js graph line width and tick color?

断了今生、忘了曾经 提交于 2021-01-02 05:48:11
问题 How to update the default line width in a C3.js graph? How to update the tick (the circles) color? 回答1: If you use a DOM inspector you can see what classes the different objects have and then it's just a case of assigning some CSS to them e.g. .c3-line { stroke-width: 2px; } .c3-circle { fill: red !important; } 回答2: For case of increasing scatterplot circle radius, radius of circles on line charts. Please use like this: c3.generate({ ... point: { r: 10, }, ... }) 回答3: As per documentation you

How to turn on the 'throwIfNamespace' flag in React.js

浪子不回头ぞ 提交于 2021-01-02 05:23:08
问题 I have some code like below in my component. <svg id="SvgjsSvg3254" width="318" height="152" xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.com/svgjs" class="apexcharts-svg" xmlns:data="ApexChartsNS" transform="translate(0, 0)" style="background: transparent none repeat scroll 0% 0%;"> I am getting error like below Namespace tags are not supported by default. React's JSX doesn't support namespace tags. You can turn on the

Google chart grid background with multiple colors

耗尽温柔 提交于 2021-01-01 04:32:45
问题 I create below simple scatter chart with only one point, (I always have only one point) In the above chart I want to mark top left and bottom right boxes as one color and remaining two boxes as different to suggest to users that whether their value is good or bad. Top left and bottom right are good(green) and top right and bottom left are bad(red). just for reference, i'm adding sample image of what colors go where I've searched a lot and couldn't find any solution for this. I tried linear

Is there any way to make user uploaded SVG images safe from code injection etc?

﹥>﹥吖頭↗ 提交于 2020-12-30 08:26:22
问题 I want to display user uploaded SVG images on a website, but they're quite open to exploits: https://security.stackexchange.com/questions/11384/exploits-or-other-security-risks-with-svg-upload https://security.stackexchange.com/questions/36447/img-tag-vulnerability For example, arbitrary javascript can be embedded in SVG. There's also issues with performance exploits, but I'd consider those lower priority. Is there any mechanism to make SVG somewhat safe and only use it as an image? Can I

Is there any way to make user uploaded SVG images safe from code injection etc?

戏子无情 提交于 2020-12-30 08:23:23
问题 I want to display user uploaded SVG images on a website, but they're quite open to exploits: https://security.stackexchange.com/questions/11384/exploits-or-other-security-risks-with-svg-upload https://security.stackexchange.com/questions/36447/img-tag-vulnerability For example, arbitrary javascript can be embedded in SVG. There's also issues with performance exploits, but I'd consider those lower priority. Is there any mechanism to make SVG somewhat safe and only use it as an image? Can I