당신은지도의 <defs>
요소에 그라데이션 요소를 추가 한 다음 해당 ID에 fill
속성을 연결할 수 있습니다. 그라디언트를 추가하려면 d3.js와 그라데이션 정의를 추가지도를 초기화 3d.js 라이브러리
를 사용하고 채우기 속성
$(function() {
$('#map').vectorMap({
map: 'world_mill_en',
regionStyle: {
initial: {
fill: 'url(#my-gradient)'
},
}
});
});
을 설정할 수 있습니다
$(function() {
var defs = d3.select('defs');
var myGradient = defs.append('linearGradient')
.attr('id', 'my-gradient')
.attr('x1', '0%')
.attr('y1', '100%')
.attr('x2', '100%')
.attr('y2', '0%');
myGradient.append('stop')
.attr('offset', '0%')
.attr('style', 'stop-color:rgb(255,255,255)')
.attr('stop-opacity', 1);
myGradient.append('stop')
.attr('offset', '100%')
.attr('style', 'stop-color:rgb(51,51,51)')
.attr('stop-opacity', 1);
});
jvectormap 소스를 수정하지 않으면 이것이 가능하지 않다고 생각합니다. jvectormap이 인식하는 속성은 '채우기'및 '채우기 불투명도'라고 생각합니다. – dhc