Diff
checker
텍스트
텍스트
이미지
문서
Excel
폴더
Legal
Enterprise
데스크톱
요금제
로그인
데스크톱 앱 다운로드
텍스트 비교
두 텍스트 파일의 차이점을 찾아보세요
도구
기록
실시간 편집
공백 변경 숨기기
변경 없는 행 숨기기
줄바꿈 비활성화
레이아웃
나란히 보기
합쳐 보기
비교 단위
스마트
단어
글자
텍스트 스타일
모양 변경
구문 강조
언어 선택
제외
텍스트 변환
첫 변경으로
수정
Diffchecker Desktop
가장 안전하게 Diffchecker를 사용하는 방법. 데스크톱 앱을 사용하면 비교 데이터가 외부로 전송되지 않습니다!
데스크톱 앱 받기
Untitled diff
생성일
9년 전
비교 결과 만료 없음
초기화
내보내기
공유
설명
20 삭제
행
총
삭제
글자
총
삭제
이 기능을 계속 사용하려면 업그레이드해 주세요
Diff
checker
Pro
요금제 보기
162 행
복사
22 추가
행
총
추가
글자
총
추가
이 기능을 계속 사용하려면 업그레이드해 주세요
Diff
checker
Pro
요금제 보기
164 행
복사
var params = {};
var params = {};
params.width = 320;
params.width = 320;
params.height = 320;
params.height = 320;
params.more = 31;
params.more = 31;
params.container = '.network';
params.container = '.network';
params.nodes = [
params.nodes = [
{
{
"name": "Karnataka",
"name": "Karnataka",
"value": 16
"value": 16
},
},
{
{
"name": "Uttar Pradesh(East)",
"name": "Uttar Pradesh(East)",
"value": 22,
"value": 22,
},
},
{
{
"name": "Uttar Pradesh East",
"name": "Uttar Pradesh East",
"value": 31
"value": 31
},
},
{
{
"name": "Delhi",
"name": "Delhi",
"value": 55
"value": 55
},
},
{
{
"name": "Andhra Pradesh",
"name": "Andhra Pradesh",
"value": 108
"value": 108
}
}
];
];
var data = params.nodes;
var data = params.nodes;
var margin = {top: 0, right: 40, bottom: 40, left: 60};
var margin = {top: 0, right: 40, bottom: 40, left: 60};
var width = params.width - margin.right - margin.left;
var width = params.width - margin.right - margin.left;
var height = params.height - margin.top - margin.bottom;
var height = params.height - margin.top - margin.bottom;
var left = 5;
var left = 5;
var top = 5;
var top = 5;
var axisLeft = 20;
var axisLeft = 20;
var svg = d3.select(params.container)
var svg = d3.select(params.container)
.select('svg')
.select('svg')
.attr('width', width + margin.right + margin.left)
.attr('width', width + margin.right + margin.left)
.attr('height', height + margin.top + margin.bottom)
.attr('height', height + margin.top + margin.bottom)
.select('g')
.select('g')
.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
// Remove any other chart
// Remove any other chart
svg.selectAll('*').remove();
svg.selectAll('*').remove();
// set the ranges
// set the ranges
var yScale = d3.scaleBand()
var yScale = d3.scaleBand()
.range([height, 0])
.range([height, 0])
.padding(0.1);
.padding(0.1);
var xScale = d3.scaleLinear()
var xScale = d3.scaleLinear()
.range([0, width]);
.range([0, width]);
// Scale the range of the data in the domains
// Scale the range of the data in the domains
xScale.domain([0, d3.max(data, function(d) { return d.value; })]);
xScale.domain([0, d3.max(data, function(d) { return d.value; })]);
yScale.domain(data.map(function(d) { return d.name; }));
yScale.domain(data.map(function(d) { return d.name; }));
var yAxis = d3.axisLeft(yScale);
var yAxis = d3.axisLeft(yScale);
복사
복사됨
복사
복사됨
var bar = svg
.selectAll('g')
var bar = svg
.data(data)
.enter()
.append('g')
.append('g')
.attr('class', 'y axis')
.attr('class', 'y axis')
.attr('transform', 'translate(' + axisLeft + ',0)')
.attr('transform', 'translate(' + axisLeft + ',0)')
복사
복사됨
복사
복사됨
.call(yAxis)
;
.call(yAxis)
svg.selectAll('.tick text')
svg.selectAll('.tick text')
.attr('dy', '.35em')
.attr('dy', '.35em')
.text(function(d) {
.text(function(d) {
if (d.length > 20) {
if (d.length > 20) {
return d.substring(0, 20) + '...';
return d.substring(0, 20) + '...';
}
}
return d;
return d;
})
})
.attr('transform', function(d) {
.attr('transform', function(d) {
var name = d;
var name = d;
if (d.length > 20) {
if (d.length > 20) {
name = d.substring(0, 20) + '...';
name = d.substring(0, 20) + '...';
}
}
var names = name.split(' ');
var names = name.split(' ');
return 'translate(0,' + (-names.length / 2) * 10 + ')';
return 'translate(0,' + (-names.length / 2) * 10 + ')';
})
})
.call(wrap, 50)
.call(wrap, 50)
.on('click', function(d) {
.on('click', function(d) {
//$scope.$broadcast('bar:clicked', d);
//$scope.$broadcast('bar:clicked', d);
});
});
// append the rectangles for the bar chart
// append the rectangles for the bar chart
복사
복사됨
복사
복사됨
bar
.append('rect')
bar
.selectAll('rect')
.data(data)
.enter()
.append('rect')
.attr('class', 'barChart')
.attr('class', 'barChart')
.attr('x', left)
.attr('x', left)
.attr('width', function(d) { return xScale(d.value); })
.attr('width', function(d) { return xScale(d.value); })
.attr('y', function(d) { return yScale(d.name) + yScale.bandwidth() / 4; })
.attr('y', function(d) { return yScale(d.name) + yScale.bandwidth() / 4; })
.attr('height', yScale.bandwidth() / 2)
.attr('height', yScale.bandwidth() / 2)
.attr('fill', 'black')
.attr('fill', 'black')
//.attr('fill', function(d) { return $scope.getBubbleFill(d); })
//.attr('fill', function(d) { return $scope.getBubbleFill(d); })
.on('click', function(d) {
.on('click', function(d) {
//$scope.$broadcast('bar:clicked', d.name);
//$scope.$broadcast('bar:clicked', d.name);
});
});
복사
복사됨
복사
복사됨
bar.append('text')
.attr('class', 'label')
.attr('fill', 'white')
.attr('text-anchor', function(d) {
return xScale(d.value) < 20 ? 'middle' : 'end';
})
.attr('x', function(d) {
return xScale(d.value);
})
.attr('y', function(d) {
return yScale(d.name) + (yScale.bandwidth() / 2 + top);
})
.on('click', function(d) {
//$scope.$broadcast('bar:clicked', d.name);
});
if (params.more) {
if (params.more) {
bar.append('text')
bar.append('text')
.attr('class', 'label')
.attr('class', 'label')
.attr('fill', 'white')
.attr('fill', 'white')
.text(function() { return '+' + params.more + ' more'; })
.text(function() { return '+' + params.more + ' more'; })
.attr('transform', 'translate(' + 0 + ',' + (height + 20) + ')')
.attr('transform', 'translate(' + 0 + ',' + (height + 20) + ')')
.on('click', function(d) {
.on('click', function(d) {
//$scope.gotoExplore(d);
//$scope.gotoExplore(d);
});
});
}
}
function wrap(text, width) {
function wrap(text, width) {
text.each(function() {
text.each(function() {
var text = d3.select(this); // eslint-disable-line no-invalid-this
var text = d3.select(this); // eslint-disable-line no-invalid-this
var words = text.text()
var words = text.text()
.split(/\s+/)
.split(/\s+/)
.reverse();
.reverse();
var word;
var word;
var line = [];
var line = [];
var lineHeight = 1.1;
var lineHeight = 1.1;
var lineNumber = 0;
var lineNumber = 0;
var y = 0;
var y = 0;
var x = 0;
var x = 0;
// var dy = 0;
// var dy = 0;
var tspan = text.text(null)
var tspan = text.text(null)
.append('tspan')
.append('tspan')
.attr('x', x)
.attr('x', x)
복사
복사됨
복사
복사됨
.attr('y', y)
;
.attr('y', y)
.text('1');
var tspanHeight = tspan.node().getBBox().height;;
word = words.pop();
word = words.pop();
복사
복사됨
복사
복사됨
while (word) {
while (word) {
line.push(word);
line.push(word);
tspan.text(line.join(' '));
tspan.text(line.join(' '));
복사
복사됨
복사
복사됨
if (tspan.node().getComputedTextLength() > width - x) {
if (tspan.node().getComputedTextLength() > width - x) {
line.pop();
line.pop();
tspan.text(line.join(' '));
tspan.text(line.join(' '));
line = [word];
line = [word];
lineNumber += 1;
lineNumber += 1;
복사
복사됨
복사
복사됨
tspan = text.append('tspan')
tspan = text.append('tspan')
.attr('x', x)
.attr('x', x)
.attr('dy', lineHeight + 'em')
.attr('dy', lineHeight + 'em')
.text(word);
.text(word);
}
}
word = words.pop();
word = words.pop();
}
}
복사
복사됨
복사
복사됨
var textHeight = text.node().getBBox().height;
console.log('tspanHeight', tspanHeight)
console.log('textHeight', textHeight)
var yTransition = textHeight / 2 - tspanHeight / 2;
text.attr('transform', 'translate(-10,-'+ yTransition +')')
});
});
};
};
저장된 비교 결과
원본
파일 열기
var params = {}; params.width = 320; params.height = 320; params.more = 31; params.container = '.network'; params.nodes = [ { "name": "Karnataka", "value": 16 }, { "name": "Uttar Pradesh(East)", "value": 22, }, { "name": "Uttar Pradesh East", "value": 31 }, { "name": "Delhi", "value": 55 }, { "name": "Andhra Pradesh", "value": 108 } ]; var data = params.nodes; var margin = {top: 0, right: 40, bottom: 40, left: 60}; var width = params.width - margin.right - margin.left; var height = params.height - margin.top - margin.bottom; var left = 5; var top = 5; var axisLeft = 20; var svg = d3.select(params.container) .select('svg') .attr('width', width + margin.right + margin.left) .attr('height', height + margin.top + margin.bottom) .select('g') .attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); // Remove any other chart svg.selectAll('*').remove(); // set the ranges var yScale = d3.scaleBand() .range([height, 0]) .padding(0.1); var xScale = d3.scaleLinear() .range([0, width]); // Scale the range of the data in the domains xScale.domain([0, d3.max(data, function(d) { return d.value; })]); yScale.domain(data.map(function(d) { return d.name; })); var yAxis = d3.axisLeft(yScale); var bar = svg.selectAll('g') .data(data) .enter() .append('g') .attr('class', 'y axis') .attr('transform', 'translate(' + axisLeft + ',0)') .call(yAxis); svg.selectAll('.tick text') .attr('dy', '.35em') .text(function(d) { if (d.length > 20) { return d.substring(0, 20) + '...'; } return d; }) .attr('transform', function(d) { var name = d; if (d.length > 20) { name = d.substring(0, 20) + '...'; } var names = name.split(' '); return 'translate(0,' + (-names.length / 2) * 10 + ')'; }) .call(wrap, 50) .on('click', function(d) { //$scope.$broadcast('bar:clicked', d); }); // append the rectangles for the bar chart bar.append('rect') .attr('class', 'barChart') .attr('x', left) .attr('width', function(d) { return xScale(d.value); }) .attr('y', function(d) { return yScale(d.name) + yScale.bandwidth() / 4; }) .attr('height', yScale.bandwidth() / 2) .attr('fill', 'black') //.attr('fill', function(d) { return $scope.getBubbleFill(d); }) .on('click', function(d) { //$scope.$broadcast('bar:clicked', d.name); }); bar.append('text') .attr('class', 'label') .attr('fill', 'white') .attr('text-anchor', function(d) { return xScale(d.value) < 20 ? 'middle' : 'end'; }) .attr('x', function(d) { return xScale(d.value); }) .attr('y', function(d) { return yScale(d.name) + (yScale.bandwidth() / 2 + top); }) .on('click', function(d) { //$scope.$broadcast('bar:clicked', d.name); }); if (params.more) { bar.append('text') .attr('class', 'label') .attr('fill', 'white') .text(function() { return '+' + params.more + ' more'; }) .attr('transform', 'translate(' + 0 + ',' + (height + 20) + ')') .on('click', function(d) { //$scope.gotoExplore(d); }); } function wrap(text, width) { text.each(function() { var text = d3.select(this); // eslint-disable-line no-invalid-this var words = text.text() .split(/\s+/) .reverse(); var word; var line = []; var lineHeight = 1.1; var lineNumber = 0; var y = 0; var x = 0; // var dy = 0; var tspan = text.text(null) .append('tspan') .attr('x', x) .attr('y', y); word = words.pop(); while (word) { line.push(word); tspan.text(line.join(' ')); if (tspan.node().getComputedTextLength() > width - x) { line.pop(); tspan.text(line.join(' ')); line = [word]; lineNumber += 1; tspan = text.append('tspan') .attr('x', x) .attr('dy', lineHeight + 'em') .text(word); } word = words.pop(); } }); };
수정본
파일 열기
var params = {}; params.width = 320; params.height = 320; params.more = 31; params.container = '.network'; params.nodes = [ { "name": "Karnataka", "value": 16 }, { "name": "Uttar Pradesh(East)", "value": 22, }, { "name": "Uttar Pradesh East", "value": 31 }, { "name": "Delhi", "value": 55 }, { "name": "Andhra Pradesh", "value": 108 } ]; var data = params.nodes; var margin = {top: 0, right: 40, bottom: 40, left: 60}; var width = params.width - margin.right - margin.left; var height = params.height - margin.top - margin.bottom; var left = 5; var top = 5; var axisLeft = 20; var svg = d3.select(params.container) .select('svg') .attr('width', width + margin.right + margin.left) .attr('height', height + margin.top + margin.bottom) .select('g') .attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); // Remove any other chart svg.selectAll('*').remove(); // set the ranges var yScale = d3.scaleBand() .range([height, 0]) .padding(0.1); var xScale = d3.scaleLinear() .range([0, width]); // Scale the range of the data in the domains xScale.domain([0, d3.max(data, function(d) { return d.value; })]); yScale.domain(data.map(function(d) { return d.name; })); var yAxis = d3.axisLeft(yScale); var bar = svg .append('g') .attr('class', 'y axis') .attr('transform', 'translate(' + axisLeft + ',0)') .call(yAxis) svg.selectAll('.tick text') .attr('dy', '.35em') .text(function(d) { if (d.length > 20) { return d.substring(0, 20) + '...'; } return d; }) .attr('transform', function(d) { var name = d; if (d.length > 20) { name = d.substring(0, 20) + '...'; } var names = name.split(' '); return 'translate(0,' + (-names.length / 2) * 10 + ')'; }) .call(wrap, 50) .on('click', function(d) { //$scope.$broadcast('bar:clicked', d); }); // append the rectangles for the bar chart bar .selectAll('rect') .data(data) .enter() .append('rect') .attr('class', 'barChart') .attr('x', left) .attr('width', function(d) { return xScale(d.value); }) .attr('y', function(d) { return yScale(d.name) + yScale.bandwidth() / 4; }) .attr('height', yScale.bandwidth() / 2) .attr('fill', 'black') //.attr('fill', function(d) { return $scope.getBubbleFill(d); }) .on('click', function(d) { //$scope.$broadcast('bar:clicked', d.name); }); if (params.more) { bar.append('text') .attr('class', 'label') .attr('fill', 'white') .text(function() { return '+' + params.more + ' more'; }) .attr('transform', 'translate(' + 0 + ',' + (height + 20) + ')') .on('click', function(d) { //$scope.gotoExplore(d); }); } function wrap(text, width) { text.each(function() { var text = d3.select(this); // eslint-disable-line no-invalid-this var words = text.text() .split(/\s+/) .reverse(); var word; var line = []; var lineHeight = 1.1; var lineNumber = 0; var y = 0; var x = 0; // var dy = 0; var tspan = text.text(null) .append('tspan') .attr('x', x) .attr('y', y) .text('1'); var tspanHeight = tspan.node().getBBox().height;; word = words.pop(); while (word) { line.push(word); tspan.text(line.join(' ')); if (tspan.node().getComputedTextLength() > width - x) { line.pop(); tspan.text(line.join(' ')); line = [word]; lineNumber += 1; tspan = text.append('tspan') .attr('x', x) .attr('dy', lineHeight + 'em') .text(word); } word = words.pop(); } var textHeight = text.node().getBBox().height; console.log('tspanHeight', tspanHeight) console.log('textHeight', textHeight) var yTransition = textHeight / 2 - tspanHeight / 2; text.attr('transform', 'translate(-10,-'+ yTransition +')') }); };
비교하기