Programming/jquery2018. 11. 5. 14:34

get은 DOM 객체를 받는다면

eq는 jquery 객체를 받는 차이가 있다.


그래서 이전에.. canvas를 얻었을때 width나 scrollwidth 같은게

jquery 통해서 획득한 녀석은 받아내질 못했던 것으로 보인다.


Retrieve the DOM elements matched by the jQuery object. 

[링크 : https://api.jquery.com/get/]


Reduce the set of matched elements to the one at the specified index. 

[링크 : https://api.jquery.com/eq/]


[링크 : http://www.jquerybyexample.net/2013/04/jquery-difference-between-eq-and-get-method.html]

[링크 : https://fronteer.kr/bbs/view/250]



Posted by 구차니
Programming/jquery2018. 11. 5. 14:32

jquery 의 셀렉터로 잡은 녀석과

document.getElementById 로 잡은 녀석이 접근 가능한 내용이 다른데

원인은 jquery는 jquery에서 만든 object를 사용하고

document.getElementById 은 Object를 사용하기 때문

즉, 같은 객체가 아니기에 접근 가능한 항목이 다르다~


[링크 : https://www.simonewebdesign.it/difference-between-getelementbyid-jquery/]

[링크 : https://www.quora.com/What-are-the-differences-between-foo-and-document-getElementById-foo]

[링크 : https://api.jquery.com/get/]

'Programming > jquery' 카테고리의 다른 글

jquery를 이용하여 특정 테이블의 열로 이동하기  (0) 2018.11.06
jquery eq() get() 차이  (0) 2018.11.05
jquery trigger()  (0) 2018.10.25
jqeury ajax 수행 완료 기다리기  (0) 2018.10.23
jquery ajax data, header  (0) 2018.10.23
Posted by 구차니
Posted by 구차니

음.. 해보려는데 잘 안된다?

먼저 CSS를 통해서 사이즈가 정해져 있는데

canvas.width로 하고 이미지를 써올려 보니 커진다.. -_-


var canvas = document.getElementById("canvas"),

    ctx = canvas.getContext("2d");


canvas.width = 600;

canvas.height = 300;

and then change its displayed size using css


#canvas{

   width: 300px;

   height: 150px; 

}​ 

[링크 : https://stackoverflow.com/questions/9742131/scaling-canvas-element-with-static-resolution]


[링크 : https://www.html5canvastutorials.com/advanced/html5-canvas-transform-scale-tutorial/]

[링크 : https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/scale]

[링크 : https://www.w3schools.com/tags/canvas_scale.asp]

'Programming > javascript & HTML' 카테고리의 다른 글

canvas 이미지 품질 저하  (0) 2018.11.06
자바스크립트 절대값 abs()  (0) 2018.11.05
js array keys(),values()  (0) 2018.10.31
js eval  (0) 2018.10.30
js split \n ' '  (0) 2018.10.26
Posted by 구차니
Programming/angular2018. 11. 2. 19:30

'Programming > angular' 카테고리의 다른 글

angular 빌드 최적화(?)  (0) 2019.03.18
angular with reverse proxy  (0) 2019.03.18
angular4 ie11 호환성 설정  (0) 2019.02.18
vscode 및 angular.js 셋팅..  (0) 2018.08.08
Posted by 구차니
Programming/d32018. 11. 1. 17:40

당연(?) 하지만 circle의 stroke-width는 안과 밖으로 커진다.

[링크 : http://www.d3noob.org/2014/02/styles-in-d3js.html]

'Programming > d3' 카테고리의 다른 글

d3 update 두번째 검색내용..  (0) 2018.11.15
d3 update enter  (0) 2018.11.12
d3 svg string width in px  (0) 2018.11.01
d3 arc text  (0) 2018.10.31
d3 hyperlink  (0) 2018.10.31
Posted by 구차니
Programming/d32018. 11. 1. 07:40

getBBbox() 예제가 더 많긴한데...

어짜피 둘다 이미 그려진 시점에서 크기를 얻어 오는거라..

위치를 세밀하게 설정하기에는 무리가 있으려나?


getComputedTextLength();

[링크 : https://stackoverflow.com/questions/10254644/get-pixel-length-of-string-in-svg]

[링크 : https://www.w3.org/TR/SVG/text.html#__svg__SVGTextContentElement__getComputedTextLength]


getBBbox()

[링크 : https://gist.github.com/huytd/327e453c95ca3edadb32d0c867e2561b]

[링크 : https://bl.ocks.org/mbostock/1160929]

[링크 : http://blog.xogus.io/2017/01/15/SVG에서-getBBox-활용하기/]

[링크 : https://developer.mozilla.org/en-US/docs/Web/API/SVGGraphicsElement]




'Programming > d3' 카테고리의 다른 글

d3 update enter  (0) 2018.11.12
d3 svg circle  (0) 2018.11.01
d3 arc text  (0) 2018.10.31
d3 hyperlink  (0) 2018.10.31
d3 background image  (0) 2018.10.29
Posted by 구차니
Programming/d32018. 10. 31. 18:56


//Create an SVG path (based on bl.ocks.org/mbostock/2565344)
svg.append("path")
    .attr("id", "wavy") //Unique id of the path
    .attr("d", "M 10,90 Q 100,15 200,70 Q 340,140 400,30") //SVG path
    .style("fill", "none")
    .style("stroke", "#AAAAAA");

//Create an SVG text element and append a textPath element
svg.append("text")
   .append("textPath") //append a textPath to the text element
    .attr("xlink:href", "#wavy") //place the ID of the path here
    .style("text-anchor","middle") //place the text halfway on the arc
    .attr("startOffset", "50%")
    .text("Yay, my text is on a wavy path");

[링크 : https://www.visualcinnamon.com/2015/09/placing-text-on-arcs.html]

[링크 : http://tutorials.jenkov.com/svg/path-element.html]


+2018.11.01

의외로 startOffset이 중요하다!

      svg.append('text')
        .append('textPath')
        .attr({
          startOffset: '50%',
          'xlink:href': '#curvedTextPath'
        })
        .text('Hello, world!');

[링크 : http://bl.ocks.org/jebeck/196406a3486985d2b92e]

[링크 : https://gist.github.com/jebeck/196406a3486985d2b92e]

'Programming > d3' 카테고리의 다른 글

d3 svg circle  (0) 2018.11.01
d3 svg string width in px  (0) 2018.11.01
d3 hyperlink  (0) 2018.10.31
d3 background image  (0) 2018.10.29
d3 pulse / blink  (0) 2018.10.29
Posted by 구차니
Programming/d32018. 10. 31. 18:54

d3 에서 svg에 링크를 걸어줄 수 있다.

holder.append("a")
    .attr("xlink:href", "http://en.wikipedia.org/wiki/"+word)

[링크 : http://bl.ocks.org/d3noob/8150631]

'Programming > d3' 카테고리의 다른 글

d3 svg string width in px  (0) 2018.11.01
d3 arc text  (0) 2018.10.31
d3 background image  (0) 2018.10.29
d3 pulse / blink  (0) 2018.10.29
d3 v5... -0-?  (0) 2018.10.18
Posted by 구차니

associated array 라고 해야하나..

이녀석은 length나 length()로 받아올수 없으니까

반대로 key의 갯수로 길이를 얻는 식의 우회방법을 써야 한다.


var obj = { foo: 'bar', baz: 42 };

console.log(Object.keys(obj)); // ['bar', 42]

console.log(Object.values(obj)); // ['bar', 42] 


[링크 : https://4urdev.tistory.com/7]

[링크 : https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Object/keys]

[링크 : https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Object/values]

'Programming > javascript & HTML' 카테고리의 다른 글

자바스크립트 절대값 abs()  (0) 2018.11.05
html canvas 보이는 크기와 실제 크기 다르게 설정하기  (0) 2018.11.02
js eval  (0) 2018.10.30
js split \n ' '  (0) 2018.10.26
curl text/plain  (0) 2018.10.26
Posted by 구차니