1. ?d3.brush() ?//選中或者刷子
d3.brushX() ? d3.brushY() ? brush.extent([]||function) 創(chuàng)建brush的范圍 ? ? ?brush.handlesize([size])拖選的寬高,默認為6 ? ? brush.on('start brush end',function)事件監(jiān)聽婶博,只有三個時間start brush end,跟回調事件
2.d3的12鐘地圖投影
(1)d3.geoAlbersUsa()阿伯斯投影? ;(2)d3.geoAzimuthalEqualArea()等面積方位投影? ;(3)d3.geoAzimuthalEquidistant()等距方位投影? ;(4)d3.geoConicConformal()圓錐共形投影 ; (5)d3.geoConicEqualArea()圓錐等面積投影 ; (6)d3.geoConicEquidistant()圓錐等距投影 步绸; (7)d3.geoEquirectangular()相等矩形投影? ; (8)d3.geoGnomonic()球心投影? 吃媒; (9)d3.geoMercator()墨卡托投影 瓤介; (10)d3.geoOrthographic()正射投影? ; (11)d3.geostereographic()極射赤平投影 赘那; (12)d3.geoTransverseMercator()橫向墨卡托投影刑桑。
3.d3的路徑path()
d3.geoPath.projection(projection)繪制路徑
projection().fitSize([width,height],pathdata)//根據(jù)長寬適應路徑大小
4.topojson ? d3推薦使用的地理數(shù)據(jù)json格式
topojson.feature(result,result.object)? //將result的topojson數(shù)據(jù)轉換成geojson格式, ? ? ? ? ? ?topojson.mesh(result,result.object募舟,function(a,b){return boolean}) //將result的topojson數(shù)據(jù)轉換成GeoJSON MultiLineString格式,第三個參數(shù)是返回布爾值祠斧,a是數(shù)據(jù)數(shù)組的第一個,b是非第一個的數(shù)據(jù)
5.scale
基本的d3.scaleLinear().domain([]).range([]),domain映射range的值
continuous.invert()反向映射胃珍,range映射domain的值
.scaleTime()//時間長度梁肿,.range(a,b,der) or .range(a)? ? scaleLinear()//等間隔線性長度? continuous.ticks(count)把domain分成count返回數(shù)組? ? continuous.tickFormat(count,specifier) 返回一個函數(shù),對domain格式化 ? ?
6.常用函數(shù)
(1)range(a觅彰,b,der)可以是一個參數(shù)或者三個參數(shù)? ? ? map(function(d){return d})映射要return? .randomBates()//不同的數(shù)據(jù)分布? ? format('.0f')//格式化返回的是函數(shù)format('.0f')(value)
7.時間
interval.ceil()? ? interval.floor()? ? ? interval.round()? 時間的約等于钮热,interval.domain(start,end,step)是一個時間數(shù)組填抬,step是間隔數(shù)(1,2隧期,3飒责。。仆潮。)? interval.count()計數(shù)宏蛉,統(tǒng)計多少個? ? interval.every(number)是日期間隔number=1,2性置,3拾并。。鹏浅。? ? interval.offset(date,step)現(xiàn)在的時間前進step時間? ? interval.filter(function(d){return})過濾時間? ? d3.timeInterval() 創(chuàng)建新的interval ? ?d3.timeDay是單個時間嗅义,d3.timeDays(start,end,step)時間數(shù)組
8.axis軸
d3.axisBottom(x) d3.axisTop(x)? d3.axisLeft(y)? d3.axisRight(y) 各個位置的軸,axis.scale(x)如果有軸的數(shù)據(jù)指向x如果沒有就返回原來的隐砸,?
axis.ticks(arguments…)axis.ticks([count[,specifier]])axis.ticks([interval[,specifier]])可以直接傳入count刻度數(shù)之碗,也可以再加一個specifier值變換或者時間值 ??
axis.tickValues([])傳入數(shù)組代替ticks,傳入的數(shù)組值在domain范圍內
axis.tickFormat(function(d){return})格式化tick的值
axis.tickSizeInner([size])刻度的長度
9.histogram()直方圖
d3.histogram()(data)傳入數(shù)據(jù)季希,返回一組數(shù)組褪那,每個數(shù)組都是一個容器數(shù)組幽纷,包含數(shù)據(jù)個數(shù),以及額外的兩個屬性x0,x1是這個容器的數(shù)據(jù)范圍 ? ??
d3.histogram()用histogram表示 ? histogram.domain()是指的直方圖給取data的這部份 ? ?histogram.thresholds(count)將data分count個容器里也就是控制x0,x1的值
10.d3-transition
d3.transition()過度函數(shù) ?d3.transition().duration(time).ease().delay()過渡時間和過度曲線博敬、延遲觸發(fā) ? ?d3.active()是過度的中開始的過程友浸,d3.interrupt(node,name)取消過度,node是節(jié)點 name是過度內容
11.d3-ease
12.d3.format
d3.format('.0%')(0.1235)//12% ?格式成百分數(shù)冶忱,0表示保留0位小數(shù)
13.d3.zoom
d3.zoom()