JavaScript可視化圖表庫(kù)D3.js API中文參考
D3 庫(kù)所提供的所有 API 都在 d3 命名空間下。d3 庫(kù)使用語(yǔ)義版本命名法(semantic versioning)。 你可以用 d3.version
查看當(dāng)前的版本信息。
d3 (核心部分)
選擇集
- d3.select - 從當(dāng)前文檔中選擇一系列元素。
- d3.selectAll - 從當(dāng)前文檔中選擇多項(xiàng)元素。
- selection.attr - 設(shè)置或獲取指定屬性。
- selection.classed - 添加或刪除選定元素的 CSS 類(lèi)(CSS class)。
- selection.style - 設(shè)置或刪除 CSS 屬性。style優(yōu)先級(jí)高于attr。
- selection.property - 設(shè)置或獲原生的屬性值(raw property)。
- selection.text - 設(shè)置或獲取選定元素的標(biāo)簽體文本內(nèi)容。
- selection.html - 設(shè)置或獲取選定元素的 HTML 內(nèi)容(類(lèi)似 innerHTML )
- selection.append - 創(chuàng)建并添加新元素到選定元素后。
- selection.insert - 創(chuàng)建并添加新元素到選定元素前。
- selection.remove - 從當(dāng)前文檔對(duì)象中刪除選定的元素。
- selection.data - 設(shè)置或獲取一組元素的綁定數(shù)據(jù)(get or set data for a group of elements, while computing a relational join.)
- selection.enter - 返回缺失元素的占位對(duì)象(placeholder),指向綁定的數(shù)據(jù)中比選定元素集多出的一部分元素。
- selection.exit - 返回多余元素的元素集,即選擇元素中比綁定數(shù)據(jù)多出的一部分。(關(guān)于data, enter, exit原理的示例1, 示例2, 示例3)
- selection.datum - 設(shè)置或獲取單獨(dú)元素的數(shù)據(jù),不進(jìn)行關(guān)聯(lián)。(get or set data for individual elements, without computing a join.)
- selection.filter - 根據(jù)綁定的數(shù)據(jù)過(guò)濾選擇集。
- selection.sort - 根據(jù)綁定的數(shù)據(jù)對(duì)選擇的元素進(jìn)行排序。
- selection.order - 對(duì)文檔中的元素重排序以匹配選擇集。
- selection.on - 添加或刪除事件監(jiān)聽(tīng)器。
- selection.transition - 啟動(dòng)一個(gè)過(guò)渡效果(返回 Transition 對(duì)象),可以理解為動(dòng)畫(huà)。
- selection.interrupt - 立即停止所有正在進(jìn)行的動(dòng)畫(huà)動(dòng)作。
- selection.each - 為每個(gè)選擇的元素集調(diào)用指定的函數(shù)。
- selection.call - 為當(dāng)前選擇的元素集調(diào)用指定的函數(shù)。
- selection.empty - 測(cè)試選擇集是否為空。
- selection.node - 返回選擇集中的第一個(gè)元素。
- selection.size - 返回選擇集中的元素個(gè)數(shù)。
- selection.select - 選擇所選的元素中的第一個(gè)子元素組成新的選擇集。
- selection.selectAll - 選擇所選的元素中的多個(gè)子元素組成新的選擇集。
- d3.selection - 選擇集對(duì)象原型(可通過(guò)
d3.selection.prototype
為選擇集增強(qiáng)功能)。 - d3.event - 獲取當(dāng)前交互的用戶(hù)事件。
- d3.mouse - 獲取鼠標(biāo)的相對(duì)某元素的坐標(biāo)。
- d3.touches - 獲取相對(duì)某元素的觸控點(diǎn)坐標(biāo)。
過(guò)渡效果
- d3.transition - 開(kāi)始一個(gè)動(dòng)畫(huà)過(guò)渡。簡(jiǎn)單教程
- transition.delay - 指定每個(gè)元素過(guò)渡的延遲時(shí)間(單位:毫秒ms)。
- transition.duration - 指定每個(gè)元素過(guò)渡的持續(xù)時(shí)間(單位:毫秒ms)。
- transition.ease - 指定過(guò)渡的緩沖函數(shù)。
- transition.attr - 平滑過(guò)渡到新的attr屬性值(起始屬性值為當(dāng)前屬性)。
- transition.attrTween - 在不同attr屬性值之間平滑過(guò)渡(起始屬性值可在過(guò)渡函數(shù)中設(shè)置,甚至整個(gè)過(guò)渡函數(shù)都可以自定義)。
- transition.style - 平滑過(guò)渡到新的style屬性值。
- transition.styleTween - 在不同style屬性值之間平滑過(guò)渡。
- transition.text - 在過(guò)渡開(kāi)始時(shí)設(shè)置文本內(nèi)容。
- transition.tween - 使某個(gè)屬性過(guò)渡到一個(gè)新的屬性值,該屬性可以是非attr或非style屬性,比如text。
- transition.select - 選擇每個(gè)當(dāng)前元素的某個(gè)子元素進(jìn)行過(guò)渡。
- transition.selectAll - 選擇每個(gè)當(dāng)前元素的多個(gè)子元素進(jìn)行過(guò)渡。
- transition.filter - 通過(guò)數(shù)據(jù)篩選出當(dāng)前元素中的部分元素進(jìn)行過(guò)渡。
- transition.transition - 當(dāng)前過(guò)渡結(jié)束后開(kāi)始新的過(guò)渡。
- transition.remove - 過(guò)渡結(jié)束后移除當(dāng)前元素。
- transition.empty - 如果過(guò)渡為空就返回true。如果當(dāng)前元素中沒(méi)有非null元素,則此過(guò)渡為空。
- transition.node - 返回過(guò)渡中的第一個(gè)元素。
- transition.size - 返回過(guò)渡中當(dāng)前元素的數(shù)量。
- transition.each - 遍歷每個(gè)元素執(zhí)行操作。不指定觸發(fā)類(lèi)型時(shí),立即執(zhí)行操作。當(dāng)指定觸發(fā)類(lèi)型為'start'或'end'時(shí),會(huì)在過(guò)渡開(kāi)始或結(jié)束時(shí)執(zhí)行操作。
- transition.call - 以當(dāng)前過(guò)渡為this執(zhí)行某個(gè)函數(shù)。
- d3.ease - 定制過(guò)渡的緩沖函數(shù)。
- ease - 緩沖函數(shù)。緩沖函數(shù)可讓動(dòng)畫(huà)效果更自然,比如elastic緩沖函數(shù)可用以模擬彈性物體的運(yùn)動(dòng)。是一種插值函數(shù)的特例。
- d3.timer - 開(kāi)始一個(gè)定制的動(dòng)畫(huà)計(jì)時(shí)。功能類(lèi)似于setTimeout,但內(nèi)部用requestAnimationFrame實(shí)現(xiàn),更高效。
- d3.timer.flush - 立刻執(zhí)行當(dāng)前沒(méi)有延遲的計(jì)時(shí)??捎糜谔幚黹W屏問(wèn)題。
- d3.interpolate - 生成一個(gè)插值函數(shù),在兩個(gè)參數(shù)間插值。差值函數(shù)的類(lèi)型會(huì)根據(jù)輸入?yún)?shù)的類(lèi)型(數(shù)字、字符串、顏色等)而自動(dòng)選擇。
- interpolate - 插值函數(shù)。輸入?yún)?shù)在[0, 1]之間。
- d3.interpolateNumber - 在兩個(gè)數(shù)字間插值。
- d3.interpolateRound - 在兩個(gè)數(shù)字間插值,返回值會(huì)四舍五入取整。
- d3.interpolateString - 在兩個(gè)字符串間插值。解析字符串中的數(shù)字,對(duì)應(yīng)的數(shù)字會(huì)插值。
- d3.interpolateRgb - 在兩個(gè)RGB顏色間插值。
- d3.interpolateHsl - 在兩個(gè)HSL顏色間插值。
- d3.interpolateLab - 在兩個(gè)L*a*b*顏色間插值。
- d3.interpolateHcl - 在兩個(gè)HCL顏色間插值。
- d3.interpolateArray - 在兩個(gè)數(shù)列間插值。d3.interpolateArray( [0, 1], [1, 10, 100] )(0.5); // returns [0.5, 5.5, 100]
- d3.interpolateObject - 在兩個(gè)object間插值。d3.interpolateArray( {x: 0, y: 1}, {x: 1, y: 10, z: 100} )(0.5); // returns {x: 0.5, y: 5.5, z: 100}
- d3.interpolateTransform - 在兩個(gè)2D仿射變換間插值。
- d3.interpolateZoom - 在兩個(gè)點(diǎn)之間平滑地縮放平移。示例
- d3.interpolators - 添加一個(gè)自定義的插值函數(shù).
數(shù)據(jù)操作(Working with Arrays)
- d3.ascending - 升序排序函數(shù).
- d3.descending - 降序排序函數(shù).
- d3.min - 獲取數(shù)組中的最小值.
- d3.max - 獲取數(shù)組中的最大值.
- d3.extent - 獲取數(shù)組的范圍(最小值和最大值).
- d3.sum - 獲取數(shù)組中數(shù)字之和.
- d3.mean -獲取數(shù)組中數(shù)字的算術(shù)平均值.
- d3.median - 獲取數(shù)組中數(shù)字的中位數(shù) (相當(dāng)于 0.5-quantile的值).
- d3.quantile - 獲取排好序的數(shù)組的一個(gè)分位數(shù)(quantile).
- d3.bisect - 通過(guò)二分法獲取某個(gè)數(shù)在排好序的數(shù)組中的插入位置(同d3.bisectRight).
- d3.bisectRight - 獲取某個(gè)數(shù)在排好序的數(shù)組中的插入位置(相等的值歸入右邊).
- d3.bisectLeft - 獲取某個(gè)數(shù)在排好序的數(shù)組中的插入位置(相等的值歸入左邊).
- d3.bisector - 自定義一個(gè)二分函數(shù).
- d3.shuffle - 洗牌,隨機(jī)排列數(shù)組中的元素.
- d3.permute - 以指定順序排列數(shù)組中的元素.
- d3.zip - 將多個(gè)數(shù)組合并成一個(gè)數(shù)組的數(shù)組,新數(shù)組的的第i個(gè)元素是原來(lái)各個(gè)數(shù)組中第i個(gè)元素組成的數(shù)組.
- d3.transpose - 矩陣轉(zhuǎn)置,通過(guò)d3.zip實(shí)現(xiàn).
- d3.pairs - 返回臨近元素對(duì)的數(shù)組,d3.pairs([1, 2, 3, 4]); // returns [ [1, 2], [2, 3], [3, 4] ].
- d3.keys - 返回關(guān)聯(lián)數(shù)組(哈希表、json、object對(duì)象)的key組成的數(shù)組.
- d3.values - 返回關(guān)聯(lián)數(shù)組的value組成的數(shù)組.
- d3.entries - 返回關(guān)聯(lián)數(shù)組的key-value實(shí)體組成的數(shù)組, d3.entries({ foo: 42 }); // returns [{key: "foo", value: 42}].
- d3.merge - 將多個(gè)數(shù)組連成一個(gè),類(lèi)似于原生方法concat. d3.merge([ [1], [2, 3] ]); // returns [1, 2, 3].
- d3.range - 獲得一個(gè)數(shù)列. d3.range([start, ]stop[, step])
- d3.nest - 獲得一個(gè)nest對(duì)象,將數(shù)組組織成層級(jí)結(jié)構(gòu). 示例:http://bl.ocks.org/phoebebright/raw/3176159/
- nest.key - 為nest層級(jí)結(jié)構(gòu)增加一個(gè)層級(jí).
- nest.sortKeys - 將當(dāng)前的nest層級(jí)結(jié)構(gòu)按key排序.
- nest.sortValues - 將葉nest層級(jí)按value排序.
- nest.rollup - 設(shè)置修改葉節(jié)點(diǎn)值的函數(shù).
- nest.map - 執(zhí)行nest操作, 返回一個(gè)關(guān)聯(lián)數(shù)組(json).
- nest.entries - 執(zhí)行nest操作, 返回一個(gè)key-value數(shù)組. 如果nest.map返回的結(jié)果類(lèi)似于{ foo: 42 }, 則nest.entries返回的結(jié)果類(lèi)似于[{key: "foo", value: 42}].
- d3.map - 將javascript的object轉(zhuǎn)化為hash,屏蔽了object的原型鏈功能導(dǎo)致的與hash不一致的問(wèn)題。
- map.has - map有某個(gè)key就返回true.
- map.get - 返回map中某個(gè)key對(duì)應(yīng)的value.
- map.set - 設(shè)置map中某個(gè)key對(duì)應(yīng)的value.
- map.remove - 刪除map中的某個(gè)key.
- map.keys - 返回map中所有key組成的數(shù)組.
- map.values - 返回map中所有value組成的數(shù)組.
- map.entries - 返回map中所有entry(key-value鍵值對(duì))組成的數(shù)組.類(lèi)似于{ foo: 42 }轉(zhuǎn)化成[{key: "foo", value: 42}]
- map.forEach - 對(duì)map中每一個(gè)entry執(zhí)行某個(gè)函數(shù).
- d3.set - 將javascript的array轉(zhuǎn)化為set,屏蔽了array的object原型鏈功能導(dǎo)致的與set不一致的問(wèn)題。set中的value是array中每個(gè)值轉(zhuǎn)換成字符串的結(jié)果。set中的value是去重過(guò)的。
- set.has - 返回set中是否含有某個(gè)value.
- set.add - 添加某個(gè)value.
- set.remove - 刪除某個(gè)value.
- set.values - 返回set中的值組成的數(shù)組.set中的value是去重過(guò)的.
- set.forEach - 對(duì)set中每一個(gè)value執(zhí)行某個(gè)函數(shù).
Math
- d3.random.normal - 利用正態(tài)分布產(chǎn)生一個(gè)隨機(jī)數(shù).
- d3.random.logNormal - 利用對(duì)數(shù)正態(tài)分布產(chǎn)生一個(gè)隨機(jī)數(shù).
- d3.random.irwinHall - 利用Irwin–Hall分布(簡(jiǎn)單可行并且容易編程的正態(tài)分布實(shí)現(xiàn)方法)產(chǎn)生一個(gè)隨機(jī)數(shù).
- d3.transform - 將svg的tranform格式轉(zhuǎn)化為標(biāo)準(zhǔn)的2D轉(zhuǎn)換矩陣字符串格式.
載入外部資源(Loading External Resources)
- d3.xhr - 發(fā)起XMLHttpRequest請(qǐng)求獲取資源。
- xhr.header - 設(shè)置 request header。
- xhr.mimeType - 設(shè)置 Accept request header,并重寫(xiě) response MIME type。
- xhr.response - 設(shè)置response返回值轉(zhuǎn)化函數(shù)。如 function(request) { return JSON.parse(request.responseText); }
- xhr.get - 發(fā)起GET請(qǐng)求。
- xhr.post - 發(fā)起POST請(qǐng)求。
- xhr.send - 以指定的方法和數(shù)據(jù)發(fā)起請(qǐng)求。
- xhr.abort - 終止當(dāng)前請(qǐng)求。
- xhr.on - 為請(qǐng)求添加”beforesend”, “progress”, “l(fā)oad” 或 “error” 等事件監(jiān)聽(tīng)器。
- d3.text - 請(qǐng)求一個(gè)text文件。
- d3.json - 請(qǐng)求一個(gè)JSON。
- d3.html - 請(qǐng)求一個(gè)html文本片段。
- d3.xml - 請(qǐng)求一個(gè)XML文本片段。
- d3.csv - 請(qǐng)求一個(gè)CSV(comma-separated values, 逗號(hào)分隔值)文件。
- d3.tsv - 請(qǐng)求一個(gè)TSV(tab-separated values, tab分隔值)文件。
字符串格式化(String Formatting)
- d3.format - 將數(shù)字轉(zhuǎn)化成指定格式的字符串。轉(zhuǎn)化的格式非常豐富,且非常智能。
- d3.formatPrefix - 以指定的值和精度獲得一個(gè)[SI prefix]對(duì)象。這個(gè)函數(shù)可用來(lái)自動(dòng)判斷數(shù)據(jù)的量級(jí), 如K(千),M(百萬(wàn))等等。示例: var prefix = d3.formatPrefix(1.21e9); console.log(prefix.symbol); // “G”; console.log(prefix.scale(1.21e9)); // 1.21
- d3.requote - 將字符串轉(zhuǎn)義成可在正則表達(dá)式中使用的格式。如 d3.requote(‘$'); // return “\$”
- d3.round - 設(shè)置某個(gè)數(shù)按小數(shù)點(diǎn)后多少位取整。與toFixed()類(lèi)似,但返回格式為number。 如 d3.round(1.23); // return 1; d3.round(1.23, 1); // return 1.2; d3.round(1.25, 1); // return 1.3
CSV 格式化 (d3.csv)
- d3.csv - 獲取一個(gè)CSV (comma-separated values, 冒號(hào)分隔值)文件。
- d3.csv.parse - 將CSV文件字符串轉(zhuǎn)化成object的數(shù)組,object的key由第一行決定。如: [{"Year": "1997", "Length": "2.34"}, {"Year": "2000", "Length": "2.38"}]
- d3.csv.parseRows - 將CSV文件字符串轉(zhuǎn)化成數(shù)組的數(shù)組。如: [ ["Year", "Length"],["1997", "2.34"],["2000", "2.38"] ]
- d3.csv.format - 將object的數(shù)組轉(zhuǎn)化成CSV文件字符串,是d3.csv.parse的逆操作。
- d3.csv.formatRows - 將數(shù)組的數(shù)組轉(zhuǎn)化成CSV文件字符串,是d3.csv.parseRows的逆操作。
- d3.tsv - 獲取一個(gè)TSV (tab-separated values, tab分隔值)文件。
- d3.tsv.parse - 類(lèi)似于d3.csv.parse。
- d3.tsv.parseRows - 類(lèi)似于d3.csv.parseRows。
- d3.tsv.format - 類(lèi)似于d3.csv.format。
- d3.tsv.formatRows - 類(lèi)似于d3.csv.formatRows。
- d3.dsv - 創(chuàng)建一個(gè)類(lèi)似于d3.csv的文件處理對(duì)象,可以自定義分隔符和mime type。如:var dsv = d3.dsv(“|”, “text/plain”);
顏色
- d3.rgb - 指定一種顏色,創(chuàng)建一個(gè)RGB顏色對(duì)象。支持多種顏色格式的輸入。
- rgb.brighter - 增強(qiáng)顏色的亮度,變化幅度由參數(shù)決定。
- rgb.darker - 減弱顏色的亮度,變化幅度由參數(shù)決定。
- rgb.hsl - 將RGB顏色對(duì)象轉(zhuǎn)化成HSL顏色對(duì)象。
- rgb.toString - RGB顏色轉(zhuǎn)化為字符串格式。
- d3.hsl - 創(chuàng)建一個(gè)HSL顏色對(duì)象。支持多種顏色格式的輸入。
- hsl.brighter - 增強(qiáng)顏色的亮度,變化幅度由參數(shù)決定。
- hsl.darker - 減弱顏色的亮度,變化幅度由參數(shù)決定。
- hsl.rgb - 將HSL顏色對(duì)象轉(zhuǎn)化成RGB顏色對(duì)象。
- hsl.toString - HSL顏色轉(zhuǎn)化為字符串格式。
- d3.lab - 創(chuàng)建一個(gè)Lab顏色對(duì)象。支持多種顏色格式的輸入。
- lab.brighter - 增強(qiáng)顏色的亮度,變化幅度由參數(shù)決定。
- lab.darker - 減弱顏色的亮度,變化幅度由參數(shù)決定。
- lab.rgb - 將Lab顏色對(duì)象轉(zhuǎn)化成RGB顏色對(duì)象。
- lab.toString - Lab顏色轉(zhuǎn)化為字符串格式。
- d3.hcl - 創(chuàng)建一個(gè)HCL顏色對(duì)象。支持多種顏色格式的輸入。
- hcl.brighter - 增強(qiáng)顏色的亮度,變化幅度由參數(shù)決定。
- hcl.darker - 減弱顏色的亮度,變化幅度由參數(shù)決定。
- hcl.rgb - 將HCL顏色對(duì)象轉(zhuǎn)化成RGB顏色對(duì)象。
- hcl.toString - HCL顏色轉(zhuǎn)化為字符串格式。
命名空間
- d3.ns.prefix - 獲取或擴(kuò)展已知的XML命名空間。
- d3.ns.qualify - 驗(yàn)證命名空間前綴是否存在, 如”xlink:href”中xlink是已知的命名空間。
內(nèi)部方法(Internals)
- d3.functor - 函數(shù)化。將非函數(shù)變量轉(zhuǎn)化為只返回該變量值的函數(shù)。輸入函數(shù),則返回原函數(shù);輸入值,則返回一個(gè)函數(shù),該函數(shù)只返回原值。
- d3.rebind - 將一個(gè)對(duì)象的方法綁定到另一個(gè)對(duì)象上。
- d3.dispatch - 創(chuàng)建一個(gè)定制的事件。
- dispatch.on - 添加或移除一個(gè)事件監(jiān)聽(tīng)器。對(duì)一個(gè)事件可添加多個(gè)監(jiān)聽(tīng)器。
- dispatch.type - 觸發(fā)事件。其中‘type'為要觸發(fā)的事件的名稱(chēng)。
d3.scale(Scales)
定量變換(Quantitative)
- d3.scale.linear - 創(chuàng)建一個(gè)線(xiàn)性定量變換。(建議參考源碼以深入理解各種變換。)
- linear - 輸入一個(gè)定義域的值,返回一個(gè)值域的值。
- linear.invert - 反變換,輸入值域值返回定義域值。
- linear.domain - get或set定義域。
- linear.range - get或set值域。
- linear.rangeRound - 設(shè)置值域,并對(duì)結(jié)果取整。
- linear.interpolate - get或set變換的插值函數(shù),如將默認(rèn)的線(xiàn)性插值函數(shù)替換成取整的線(xiàn)性插值函數(shù)d3_interpolateRound。
- linear.clamp - 設(shè)置值域是否閉合,默認(rèn)不閉合。當(dāng)值域閉合時(shí),如果插值結(jié)果在值域之外,會(huì)取值域的邊界值。如值域?yàn)閇1, 2],插值函數(shù)的計(jì)算結(jié)果為3,如果不閉合,最終結(jié)果為3;如果閉合,最終結(jié)果為2。
- linear.nice - 擴(kuò)展定義域范圍使定義域更規(guī)整。如[0.20147987687960267, 0.996679553296417] 變成 [0.2, 1]。
- linear.ticks - 從定義域中取出有代表性的值。通常用于坐標(biāo)軸刻度的選取。
- linear.tickFormat - 獲取格式轉(zhuǎn)化函數(shù),通常用于坐標(biāo)軸刻度的格式轉(zhuǎn)化。如:var x = d3.scale.linear().domain([-1, 1]); console.log(x.ticks(5).map(x.tickFormat(5, “+%”))); // ["-100%", "-50%", "+0%", "+50%", "+100%"]
- linear.copy - 從已有的變換中復(fù)制出一個(gè)變換。
- d3.scale.sqrt - 創(chuàng)建一個(gè)求平方根的定量轉(zhuǎn)換。
- d3.scale.pow - 創(chuàng)建一個(gè)指數(shù)變換。(可參考linear對(duì)應(yīng)函數(shù)的注釋?zhuān)?/li>
- pow - 輸入一個(gè)定義域的值,返回一個(gè)值域的值。
- pow.invert - 反變換,輸入值域值返回定義域值。
- pow.domain - get或set定義域。
- pow.range - get或set值域。
- pow.rangeRound - 設(shè)置值域,并對(duì)結(jié)果取整。
- pow.interpolate - get或set變換的插值函數(shù)。
- pow.clamp - 設(shè)置值域是否閉合,默認(rèn)不閉合。
- pow.nice - 擴(kuò)展定義域范圍使定義域更規(guī)整。
- pow.ticks - 從定義域中取出有代表性的值。通常用于坐標(biāo)軸刻度的選取。
- pow.tickFormat - 獲取格式轉(zhuǎn)化函數(shù),通常用于坐標(biāo)軸刻度的格式轉(zhuǎn)化。
- pow.exponent - get或set指數(shù)的冪次。默認(rèn)為1次冪。
- pow.copy - 從已有的變換中復(fù)制出一個(gè)變換。
- d3.scale.log - 創(chuàng)建一個(gè)對(duì)數(shù)變換。(可參考linear對(duì)應(yīng)函數(shù)的注釋?zhuān)?/li>
- log - 輸入一個(gè)定義域的值,返回一個(gè)值域的值。
- log.invert - 反變換,輸入值域值返回定義域值。
- log.domain - get或set定義域。
- log.range - get或set值域。
- log.rangeRound - 設(shè)置值域,并對(duì)結(jié)果取整。
- log.interpolate - get或set變換的插值函數(shù)。
- log.clamp - 設(shè)置值域是否閉合,默認(rèn)不閉合。
- log.nice - 擴(kuò)展定義域范圍使定義域更規(guī)整。
- log.ticks - 從定義域中取出有代表性的值。通常用于坐標(biāo)軸刻度的選取。
- log.tickFormat - 獲取格式轉(zhuǎn)化函數(shù),通常用于坐標(biāo)軸刻度的格式轉(zhuǎn)化。
- log.copy - 從已有的變換中復(fù)制出一個(gè)變換。
- d3.scale.quantize - 創(chuàng)建一個(gè)quantize線(xiàn)性變換,定義域?yàn)橐粋€(gè)數(shù)值區(qū)間,值域?yàn)閹讉€(gè)離散值。
- quantize - 輸入數(shù)值,返回離散值。如: var q = d3.scale.quantize().domain([0, 1]).range(['a', 'b', 'c']); //q(0.3) === ‘a(chǎn)', q(0.4) === ‘b', q(0.6) === ‘b', q(0.7) ==='c;
- quantize.invertExtent - 返回得到某個(gè)離散值的值域范圍。 // q.invertExtent(‘a(chǎn)') 的結(jié)果為 [0, 0.3333333333333333]
- quantize.domain - get或set變換的定義域。
- quantize.range - get或set變換的值域。
- quantize.copy - 從已有的變換中復(fù)制出一個(gè)變換。
- d3.scale.threshold - 構(gòu)建一個(gè)threshold(閾值)線(xiàn)性變換。定義域?yàn)榉指糁禂?shù)值序列,值域?yàn)殡x散值。它與quantize的區(qū)別是quantize指定的值域?yàn)橐粋€(gè)區(qū)間,然后均分這個(gè)區(qū)間為多個(gè)小區(qū)間,以對(duì)應(yīng)各離散值。threshold則指定各小區(qū)間的邊界分隔值。示例: var t = d3.scale.threshold().domain([0, 1]).range(['a', 'b', 'c']); t(-1) === ‘a(chǎn)'; t(0) === ‘b'; t(0.5) === ‘b'; t(1) === ‘c'; t(1000) === ‘c'; t.invertExtent(‘a(chǎn)'); //returns [undefined, 0] t.invertExtent(‘b'); //returns [0, 1] t.invertExtent(‘c'); //returns [1, undefined]
- threshold - 輸入數(shù)值,返回離散值。
- threshold.invertExtent - 輸入離散值,返回?cái)?shù)值。
- threshold.domain - get或set變換的定義域。
- threshold.range - get或set變換的值域。
- threshold.copy - 從已有的變換中復(fù)制出一個(gè)變換。
- d3.scale.quantile - 構(gòu)建一個(gè)quantile線(xiàn)性變換。使用方法與quantize完全類(lèi)似,區(qū)別是quantile根據(jù)中位數(shù)來(lái)分隔區(qū)間,quantize根據(jù)算數(shù)平均值來(lái)分隔區(qū)間。example
- quantile - 輸入數(shù)值,返回離散值。
- quantile.invertExtent - 輸入離散值,返回?cái)?shù)值。
- quantile.domain - get或set變換的定義域。
- quantile.range - get或set變換的值域。
- quantile.quantiles - 獲得quantile變換的分隔值。示例: var q = d3.scale.quantile().domain([0, 1]).range(['a', 'b', 'c']); q.quantiles() returns [0.33333333333333326, 0.6666666666666665]
- quantile.copy - 從已有的變換中復(fù)制出一個(gè)變換。
- d3.scale.identity - 構(gòu)建一個(gè)identity線(xiàn)性變換。特殊的linear線(xiàn)性變換,此變換定義域和值域相同,只在一些d3內(nèi)部的axis或brush模塊中用到。
- identity - identity線(xiàn)性變換函數(shù)。返回輸入值。
- identity.invert - 和identity函數(shù)相同,返回輸入值。
- identity.domain - get或set變換的定義域。
- identity.range - get或set變換的值域。
- identity.ticks - 從定義域中取出有代表性的值。通常用于坐標(biāo)軸刻度的選取。
- identity.tickFormat - 獲取格式轉(zhuǎn)化函數(shù),通常用于坐標(biāo)軸刻度的格式轉(zhuǎn)化。
- identity.copy - 從已有的變換中復(fù)制出一個(gè)變換。
序數(shù)變換(Ordinal)
- d3.scale.ordinal - 構(gòu)建一個(gè)ordinal變換對(duì)象。ordinal變換的輸入定義域和輸出值域都是離散的。而quantitative變換的輸入定義域是連續(xù)的,這是兩者最大的不同。
- ordinal - 輸入一個(gè)離散值,返回一個(gè)離散值。不在當(dāng)前定義域中的輸入值會(huì)自動(dòng)加入定義域。
- ordinal.domain - get或set變換的定義域。
- ordinal.range - get或set變換的值域。
- ordinal.rangePoints - 用幾個(gè)離散點(diǎn)來(lái)分割一個(gè)連續(xù)的區(qū)間。詳情請(qǐng)看鏈接中的圖例。
- ordinal.rangeBands - 用幾個(gè)離散區(qū)間來(lái)分割一個(gè)連續(xù)的區(qū)間。詳情請(qǐng)看鏈接中的圖例。
- ordinal.rangeRoundBands - 用幾個(gè)離散區(qū)間來(lái)分割一個(gè)連續(xù)的區(qū)間,區(qū)間邊界和寬度會(huì)取整。詳情請(qǐng)看鏈接中的圖例。
- ordinal.rangeBand - 獲取離散區(qū)間的寬度。
- ordinal.rangeExtent - 獲取輸出域的最小最大值。
- ordinal.copy - 從已有的變換中復(fù)制出一個(gè)變換。
- d3.scale.category10 - 用10種顏色構(gòu)建一個(gè)ordinal變換。
- d3.scale.category20 - 用20種顏色構(gòu)建一個(gè)ordinal變換。
- d3.scale.category20b - 用另外20種顏色構(gòu)建一個(gè)ordinal變換。
- d3.scale.category20c - 用另外20種顏色構(gòu)建一個(gè)ordinal變換。
d3.svg (SVG)
Shapes
- d3.svg.line - 創(chuàng)建一個(gè)線(xiàn)段生成器.
- line - 在折線(xiàn)圖里生成一段折線(xiàn).
- line.x - 設(shè)置或獲取x軸訪問(wèn)器.
- line.y - 設(shè)置或獲取y軸訪問(wèn)器
- line.interpolate - 設(shè)置或獲取插值模式.
- line.tension - 獲取或設(shè)置曲線(xiàn)張力訪問(wèn)器(cardinal spline tension).
- line.defined - 定義線(xiàn)條在某一點(diǎn)是否存在.
- d3.svg.line.radial - 創(chuàng)建輻射線(xiàn)生成器.
- line - 生成分段的線(xiàn)性曲線(xiàn),用于緯度線(xiàn)/雷達(dá)線(xiàn)圖表.
- line.radius - 獲取或設(shè)置radius訪問(wèn)器.
- line.angle - 獲取或設(shè)置angle訪問(wèn)器.
- line.defined - 設(shè)置或獲取線(xiàn)條定義存取器.
- d3.svg.area - 創(chuàng)建一個(gè)新的區(qū)域生成器.
- area - 生成一個(gè)線(xiàn)性的區(qū)域,用于區(qū)域圖表.
- area.x - 獲取或設(shè)置x坐標(biāo)的訪問(wèn)器.
- area.x0 - 獲取或設(shè)置x0坐標(biāo)(基線(xiàn))的訪問(wèn)器.
- area.x1 - 獲取或設(shè)置x1坐標(biāo)(背線(xiàn))的訪問(wèn)器.
- area.y - 獲取或設(shè)置y坐標(biāo)的訪問(wèn)器.
- area.y0 - 獲取或設(shè)置y0坐標(biāo)(基線(xiàn))的訪問(wèn)器.
- area.y1 - 獲取或設(shè)置y1坐標(biāo)(背線(xiàn))的訪問(wèn)器.
- area.interpolate - 獲取或設(shè)置插值模式.
- area.tension - 獲取或設(shè)置張力訪問(wèn)器(the cardinal spline tension).
- area.defined - 判斷獲取或定義區(qū)域定義存取器.
- d3.svg.area.radial - 創(chuàng)建新的區(qū)域生成器.
- area - 生成分段的線(xiàn)性區(qū)域,用于緯度/雷達(dá)圖表.
- area.radius - 獲取或設(shè)置radius訪問(wèn)器.
- area.innerRadius - 獲取或設(shè)置內(nèi)部的radius(基線(xiàn))訪問(wèn)器.
- area.outerRadius - 獲取或設(shè)置外部的radius(背線(xiàn))訪問(wèn)器.
- area.angle - 獲取或設(shè)置angle訪問(wèn)器.
- area.startAngle - 獲取或設(shè)置內(nèi)部的angle(基線(xiàn))訪問(wèn)器.
- area.endAngle - 獲取或設(shè)置外部的angle(背線(xiàn))訪問(wèn)器.
- area.defined - 判斷獲取或定義區(qū)域定義存取器.
- d3.svg.arc - 創(chuàng)建弧度生成器.
- arc - 生成一個(gè)線(xiàn)性弧度,用于餅圖或甜甜圈圖.
- arc.innerRadius - 獲取或設(shè)置內(nèi)部的半徑訪問(wèn)器.
- arc.outerRadius - 獲取或設(shè)置外部的半徑訪問(wèn)器.
- arc.startAngle - 獲取或設(shè)置起始角度訪問(wèn)器.
- arc.endAngle - 獲取或設(shè)置結(jié)束角度訪問(wèn)器.
- arc.centroid - 計(jì)算弧的重心點(diǎn).
- d3.svg.symbol - 創(chuàng)建符號(hào)生成器.
- symbol - 生成指定的符號(hào),用于散列圖.
- symbol.type - 獲取或設(shè)置符號(hào)類(lèi)型訪問(wèn)器.
- symbol.size - 獲取或設(shè)置符號(hào)尺寸(in square pixels) 訪問(wèn)器.
- d3.svg.symbolTypes - 被支持的符號(hào)類(lèi)型數(shù)組.
- d3.svg.chord - 創(chuàng)建新的弦生成器.
- chord - 生成一個(gè)二次貝塞爾曲線(xiàn)連接兩個(gè)弧, 用于弦圖.
- chord.radius - 獲取或設(shè)置弧半徑訪問(wèn)器.
- chord.startAngle - 獲取或設(shè)置弧起始角度訪問(wèn)器.
- chord.endAngle - 獲取或設(shè)置弧結(jié)束角度訪問(wèn)器.
- chord.source - 獲取或設(shè)置源弧度訪問(wèn)器.
- chord.target - 獲取或設(shè)置目標(biāo)弧度訪問(wèn)器.
- d3.svg.diagonal - 創(chuàng)建新的斜線(xiàn)生成器.
- diagonal - 生成一個(gè)二維貝塞爾連接器, 用于節(jié)點(diǎn)連接圖.
- diagonal.source - 獲取或設(shè)置源點(diǎn)訪問(wèn)器.
- diagonal.target - 獲取或設(shè)置目標(biāo)點(diǎn)訪問(wèn)器.
- diagonal.projection - 獲取或設(shè)置一個(gè)可選的點(diǎn)變換器.
- d3.svg.diagonal.radial - 創(chuàng)建一個(gè)新的斜線(xiàn)生成器.
- diagonal - 創(chuàng)建一個(gè)二維貝塞爾連接器,用于節(jié)點(diǎn)連接圖.
坐標(biāo)軸(Axes)
- d3.svg.axis - 創(chuàng)建一個(gè)axis生成器。
- axis - 正式在頁(yè)面中生成axis。
- axis.scale - get或set坐標(biāo)軸的scale尺度變換,該尺度變換設(shè)定了數(shù)值和像素位置的轉(zhuǎn)換規(guī)則。
- axis.orient - get或set坐標(biāo)軸刻度方向。
- axis.ticks - 控制坐標(biāo)軸刻度的產(chǎn)生方式。
- axis.tickValues - 設(shè)置特定的坐標(biāo)軸的值。
- axis.tickSize - 指定坐標(biāo)軸上刻度線(xiàn)的像素長(zhǎng)度。
- axis.innerTickSize - get或set坐標(biāo)軸小刻度線(xiàn)的像素長(zhǎng)度。
- axis.outerTickSize - get或set坐標(biāo)軸大刻度線(xiàn)的像素長(zhǎng)度。
- axis.tickPadding - 指定坐標(biāo)軸刻度和刻度文字之間的像素距離。
- axis.tickFormat - 設(shè)置刻度文字的格式。
Controls
- d3.svg.brush - 點(diǎn)擊拖拽選擇一個(gè)二維區(qū)域。
- brush - 在頁(yè)面中某個(gè)區(qū)域中正式綁定一個(gè)brush。
- brush.x - get或set brush的x變換,用于水平方向的拖拽。
- brush.y - get或set brush的y變換,用于垂直方向的拖拽。
- brush.extent - get或set brush的選取范圍(extent)。
- brush.clear - 設(shè)置brush的選取范圍(extent)為空。
- brush.empty - 判斷brush的選取范圍(extent)是否為空。
- brush.on - get或set brush的事件監(jiān)聽(tīng)器??杀O(jiān)聽(tīng)3種事件:brushstart, brush, brushend。
- brush.event - 通過(guò)程序觸發(fā)監(jiān)聽(tīng)事件,在通過(guò)程序設(shè)置extent后使用。
d3.time (Time)
時(shí)間格式轉(zhuǎn)換(Time Formatting)
- d3.time.format - 創(chuàng)建基于某種時(shí)間格式的本地時(shí)間格式轉(zhuǎn)換器。
- format - 將一個(gè)date對(duì)象轉(zhuǎn)換成特定時(shí)間格式的字符串。
- format.parse - 將特定時(shí)間格式的字符串轉(zhuǎn)換成date對(duì)象。
- d3.time.format.utc - 創(chuàng)建基于某種時(shí)間格式的世界標(biāo)準(zhǔn)時(shí)間(UTC)格式轉(zhuǎn)換器。
- d3.time.format.iso - 創(chuàng)建基于某種時(shí)間格式的ISO世界標(biāo)準(zhǔn)時(shí)間(ISO 8601 UTC)格式轉(zhuǎn)換器。
時(shí)間變換(Time Scales)
- d3.time.scale - 創(chuàng)建一個(gè)線(xiàn)性時(shí)間變換,定義域?yàn)閿?shù)值區(qū)間,值域?yàn)闀r(shí)間區(qū)間。常用于時(shí)間坐標(biāo)軸的創(chuàng)建。詳情可參考d3.scale.linear。
- scale - 輸入為一個(gè)數(shù)值,返回為一個(gè)時(shí)間。
- scale.invert - 反變換,輸入時(shí)間返回?cái)?shù)值。
- scale.domain - get或set變換的定義域。
- scale.nice - 擴(kuò)展定義域范圍使定義域更規(guī)整。
- scale.range - get或set變換的值域。
- scale.rangeRound - 設(shè)置值域,并對(duì)結(jié)果取整。
- scale.interpolate - get或set變換的插值函數(shù),如將默認(rèn)的線(xiàn)性插值函數(shù)替換成指數(shù)插值函數(shù)。
- scale.clamp - 設(shè)置值域是否閉合,默認(rèn)不閉合。當(dāng)值域閉合時(shí),如果插值結(jié)果在值域之外,會(huì)取值域的邊界值。詳情參考linear.clamp。
- scale.ticks - 從定義域中取出有代表性的值。通常用于坐標(biāo)軸刻度的選取。
- scale.tickFormat - 獲取格式轉(zhuǎn)化函數(shù),通常用于坐標(biāo)軸刻度的格式轉(zhuǎn)化。
- scale.copy - 從已有的時(shí)間變換中復(fù)制出一個(gè)變換。
Time Intervals
- d3.time.interval - 返回一個(gè)對(duì)于本地時(shí)間時(shí)間間隔器.
- interval - 效果同interval.floor方法.
- interval.range - 返回指定區(qū)間內(nèi)日期.
- interval.floor - 下舍入到最近的間隔值.
- interval.round - 上舍入或下舍入到最近的間隔值.
- interval.ceil - 上舍入到最近的間隔值.
- interval.offset - 返回指定時(shí)間間隔的日期偏移量.
- interval.utc - 返回對(duì)應(yīng)的UTC時(shí)間間隔.
- d3.time.day - 返回指定時(shí)間基于天起始的時(shí)間(默認(rèn)起始是12:00am).
- d3.time.days - 返回指定時(shí)間區(qū)間和間隔條件的基于天的所有時(shí)間,效果同day.range.
- d3.time.dayOfYear - 計(jì)算指定時(shí)間在年中的天數(shù).
- d3.time.hour - 返回指定時(shí)間基于小時(shí)起始的時(shí)間(e.g., 1:00 AM).
- d3.time.hours - 返回指定時(shí)間區(qū)間和間隔條件的基于小時(shí)的所有時(shí)間, 效果同hour.range.
- d3.time.minute - 返回指定時(shí)間基于分鐘起始的時(shí)間 (e.g., 1:02 AM).
- d3.time.minutes - 返回指定時(shí)間區(qū)間和間隔條件的基于分鐘的所有時(shí)間,效果同minute.range.
- d3.time.month - 返回指定時(shí)間基于月起始的時(shí)間(e.g., February 1, 12:00 AM).
- d3.time.months - 返回指定時(shí)間區(qū)間和間隔條件的基于月的所有時(shí)間,效果同month.range.
- d3.time.second - 返回指定時(shí)間基于秒起始的時(shí)間(e.g., 1:02:03 AM).
- d3.time.seconds - 返回指定時(shí)間區(qū)間和間隔條件的基于秒的所有時(shí)間,效果同second.range.
- d3.time.sunday - 返回指定時(shí)間基于Sunday起始的時(shí)間(e.g., February 5, 12:00 AM).
- d3.time.sundays - 返回指定時(shí)間區(qū)間和間隔條件的基于sunday的所有時(shí)間, 效果同sunday.range.
- d3.time.sundayOfYear - 計(jì)算以sunday為基點(diǎn)的指定時(shí)間在一年中的周數(shù).
- d3.time.monday - every Monday (e.g., February 5, 12:00 AM).
- d3.time.mondays - alias for monday.range.
- d3.time.mondayOfYear - computes the monday-based week number.
- d3.time.tuesday - every Tuesday (e.g., February 5, 12:00 AM).
- d3.time.tuesdays - alias for tuesday.range.
- d3.time.tuesdayOfYear - computes the tuesday-based week number.
- d3.time.wednesday - every Wednesday (e.g., February 5, 12:00 AM).
- d3.time.wednesdays - alias for wednesday.range.
- d3.time.wednesdayOfYear - computes the wednesday-based week number.
- d3.time.thursday - every Thursday (e.g., February 5, 12:00 AM).
- d3.time.thursdays - alias for thursday.range.
- d3.time.thursdayOfYear - computes the thursday-based week number.
- d3.time.friday - every Friday (e.g., February 5, 12:00 AM).
- d3.time.fridays - alias for friday.range.
- d3.time.fridayOfYear - computes the friday-based week number.
- d3.time.saturday - every Saturday (e.g., February 5, 12:00 AM).
- d3.time.saturdays - alias for saturday.range.
- d3.time.saturdayOfYear - computes the saturday-based week number.
- d3.time.week - alias for sunday.
- d3.time.weeks - alias for sunday.range.
- d3.time.weekOfYear - alias for sundayOfYear.
- d3.time.year - 返回指定時(shí)間基于年起始的時(shí)間(e.g., January 1, 12:00 AM).
- d3.time.years - 返回指定時(shí)間區(qū)間和間隔條件的所有時(shí)間,效果同year.range.
構(gòu)圖(d3.layout)
Bundle
- d3.layout.bundle - construct a new default bundle layout.
- bundle - apply Holten's hierarchical bundling algorithm to edges.
弦圖(Chord)
- d3.layout.chord - 初始化一個(gè)弦圖對(duì)象, 返回一個(gè) Chord 實(shí)例
- chord.matrix - 設(shè)置或者獲取弦圖實(shí)例對(duì)應(yīng)的矩陣數(shù)據(jù)
- chord.padding - 設(shè)置或獲取弦圖各段圓弧之間的間隔角度
- chord.sortGroups - 設(shè)置或獲取矩陣分組的排序函數(shù)
- chord.sortSubgroups - 設(shè)置或獲取矩陣二級(jí)分組的排序函數(shù)
- chord.sortChords - 設(shè)置或獲取弦圖在z序上的排序函數(shù)(決定哪一組顯示在最上層)
- chord.chords - 該函數(shù)會(huì)將參數(shù)處理成對(duì) chord 更友好的格式并返回, 若沒(méi)有提供參數(shù), 會(huì)調(diào)用matrix()來(lái)獲取數(shù)據(jù)
- chord.groups - 該函數(shù)參數(shù)處理成更易于理解的分組信息, 若沒(méi)有提供參數(shù), 會(huì)調(diào)用matrix()來(lái)獲取數(shù)據(jù)
集群(Cluster)
- d3.layout.cluster - 用默認(rèn)設(shè)置生成一個(gè)集群布局對(duì)象.
- cluster.sort - 獲取或設(shè)置一個(gè)函數(shù), 用來(lái)給兄弟節(jié)點(diǎn)(同一父結(jié)點(diǎn)的子結(jié)點(diǎn))的排序.
- cluster.children - 獲取或設(shè)置子結(jié)點(diǎn)的訪問(wèn)器.
- cluster.nodes - 計(jì)算并返回指定結(jié)點(diǎn)的子結(jié)點(diǎn)在集群中的信息(坐標(biāo),深度等).
- cluster.links - 指定一個(gè)子結(jié)點(diǎn)數(shù)組(通常是nodes函數(shù)返回值), 計(jì)算它們與父結(jié)點(diǎn)的連接信息.
- cluster.separation - 獲取或設(shè)置相鄰結(jié)點(diǎn)間的間隔(不僅限于兄弟結(jié)點(diǎn)).
- cluster.size - 獲取或設(shè)置布局的 寬 和 高 的大小.
- cluster.nodeSize - 為結(jié)點(diǎn)指定大小.
力學(xué)(Force)
- d3.layout.force -節(jié)點(diǎn)(node)基于物理模擬的位置連接。
- force.on - 監(jiān)聽(tīng)布局位置的變化。(僅支持”start”,”step”,”end”三種事件)
- force.nodes - 獲得或設(shè)置布局中的節(jié)點(diǎn)(node)陣列組。
- force.links - 獲得或設(shè)置布局中節(jié)點(diǎn)間的連接(Link)陣列組。.
- force.size - 獲取或設(shè)置布局的 寬 和 高 的大小.
- force.linkDistance - 獲取或設(shè)置節(jié)點(diǎn)間的連接線(xiàn)距離.
- force.linkStrength - 獲取或設(shè)置節(jié)點(diǎn)間的連接強(qiáng)度.
- force.friction - 獲取或設(shè)置摩擦系數(shù).
- force.charge - 獲取或設(shè)置節(jié)點(diǎn)的電荷數(shù).(電荷數(shù)決定結(jié)點(diǎn)是互相排斥還是吸引)
- force.gravity - 獲取或設(shè)置節(jié)點(diǎn)的引力強(qiáng)度.
- force.theta - 獲取或設(shè)置電荷間互相作用的強(qiáng)度.
- force.start - 開(kāi)啟或恢復(fù)結(jié)點(diǎn)間的位置影響.
- force.resume - 設(shè)置冷卻系數(shù)為0.1,并重新調(diào)用start()函數(shù).
- force.stop - 立刻終止結(jié)點(diǎn)間的位置影響.(等同于將冷卻系數(shù)設(shè)置為0)
- force.alpha - 獲取或設(shè)置布局的冷卻系數(shù).(冷卻系數(shù)為0時(shí),節(jié)點(diǎn)間不再互相影響)
- force.tick - 讓布局運(yùn)行到下一步.
- force.drag - 獲取當(dāng)前布局的拖拽對(duì)象實(shí)例以便進(jìn)一步綁定處理函數(shù).
層級(jí)布局(Hierarchy)
- d3.layout.hierarchy - 獲得一個(gè)自定義的層級(jí)布局的實(shí)現(xiàn).
- hierarchy.sort - 獲取或設(shè)置一個(gè)函數(shù), 用來(lái)給兄弟節(jié)點(diǎn)(同一父結(jié)點(diǎn)的子結(jié)點(diǎn))的排序.
- hierarchy.children - 獲取或設(shè)置子結(jié)點(diǎn)的訪問(wèn)器.
- hierarchy.nodes - 計(jì)算并返回指定結(jié)點(diǎn)的子結(jié)點(diǎn)信息.
- hierarchy.links - 指定一個(gè)子結(jié)點(diǎn)數(shù)組(通常是nodes函數(shù)返回值), 計(jì)算它們與父結(jié)點(diǎn)的連接信息.
- hierarchy.value - 獲取或設(shè)置結(jié)點(diǎn)的值訪問(wèn)器.
- hierarchy.revalue - 重新計(jì)算層級(jí)布局.
直方圖(Histogram)
- d3.layout.histogram - 構(gòu)建一個(gè)默認(rèn)直方圖(用來(lái)表示一組離散數(shù)字的分布,橫軸表示區(qū)間,縱軸表示區(qū)間內(nèi)樣本數(shù)量或樣本百分比).
- histogram.value - 獲取或設(shè)置值訪問(wèn)器.
- histogram.range - 獲取或設(shè)置合法值范圍.
- histogram.bins - 指定如何將數(shù)據(jù)分組到不同的區(qū)間(bin)里, 返回一個(gè)構(gòu)造函數(shù) .
- histogram - 根據(jù)已設(shè)置的區(qū)間將數(shù)據(jù)分組,返回已分組的二維數(shù)組(compute the distribution of data using quantized bins).
- histogram.frequency - 設(shè)置直方圖Y軸值是區(qū)間內(nèi)數(shù)據(jù)的總量還是百分比(compute the distribution as counts or probabilities).
層包(Pack)
- d3.layout.pack - 用遞歸的圓環(huán)表現(xiàn)一個(gè)多層級(jí)布局.
- pack.sort - 獲取或設(shè)置一個(gè)函數(shù), 用來(lái)給兄弟節(jié)點(diǎn)(同一父結(jié)點(diǎn)的子結(jié)點(diǎn))排序.
- pack.children - 獲取或設(shè)置子結(jié)點(diǎn)的訪問(wèn)器.
- pack.nodes - 計(jì)算并返回指定結(jié)點(diǎn)的子結(jié)點(diǎn)信息.
- pack.links - 指定一個(gè)子結(jié)點(diǎn)數(shù)組(通常是nodes函數(shù)返回值), 計(jì)算它們與父結(jié)點(diǎn)的連接信息.
- pack.value - 獲取或設(shè)置一個(gè)函數(shù), 用來(lái)計(jì)算圓環(huán)的大小(近似值).
- pack.size - 設(shè)置整個(gè)布局畫(huà)布的 寬 and 高.
- pack.radius - 如果不想結(jié)點(diǎn)半徑與結(jié)點(diǎn)的值相同, 可以傳入一個(gè)函數(shù)用來(lái)計(jì)算結(jié)點(diǎn)半徑.
- pack.padding - 指定相鄰結(jié)點(diǎn)之點(diǎn)的間距(近似值).
分區(qū)(Partition)
- d3.layout.partition - 將一棵樹(shù)遞歸的分區(qū).
- partition.sort - 獲取或設(shè)置一個(gè)函數(shù), 用來(lái)給兄弟節(jié)點(diǎn)(同一父結(jié)點(diǎn)的子結(jié)點(diǎn))排序.
- partition.children - 獲取或設(shè)置子結(jié)點(diǎn)的訪問(wèn)器.
- partition.nodes - 計(jì)算并返回指定結(jié)點(diǎn)的子結(jié)點(diǎn)信息.
- partition.links - 指定一個(gè)子結(jié)點(diǎn)數(shù)組(通常是nodes函數(shù)返回值), 計(jì)算它們與父結(jié)點(diǎn)的連接信息.
- partition.value - 設(shè)置一個(gè)函數(shù)來(lái)來(lái)計(jì)算分區(qū)的值.
- partition.size - 設(shè)置整個(gè)布局畫(huà)布的 寬 and 高.
餅圖(Pie)
- d3.layout.pie - 構(gòu)建一個(gè)默認(rèn)的餅圖.
- pie - 該函數(shù)將傳入的原始參數(shù)轉(zhuǎn)換成可用于餅圖或者環(huán)形圖的數(shù)據(jù)結(jié)構(gòu).
- pie.value - 獲取或設(shè)置值訪問(wèn)器.
- pie.sort - 設(shè)置餅圖順時(shí)針?lè)较虻呐判蚍椒?
- pie.startAngle - 設(shè)置或獲取整個(gè)餅圖的起始角度.
- pie.endAngle - 設(shè)置或獲取整個(gè)餅圖的終止角度.
堆疊圖(Stack)
- d3.layout.stack - 構(gòu)建一個(gè)默認(rèn)的堆疊圖(用來(lái)展示一系列x軸相同的面積圖或者立方圖).
- stack - 計(jì)算每一層的基線(xiàn).
- stack.values - 設(shè)置或者獲取每層的值訪問(wèn)器.
- stack.order - 設(shè)置每層的排序.
- stack.offset - 指定總的基線(xiàn)算法.
- stack.x - 設(shè)置或獲取每層的x軸訪問(wèn)器.
- stack.y - 設(shè)置或獲取每層的y軸訪問(wèn)器.
- stack.out - 設(shè)置或獲取用來(lái)儲(chǔ)存基線(xiàn)的輸出函數(shù).
樹(shù)(Tree)
- d3.layout.tree - position a tree of nodes tidily.
- tree.sort - 設(shè)置或獲取一個(gè)函數(shù), 用來(lái)給兄弟節(jié)點(diǎn)(同一父結(jié)點(diǎn)的子結(jié)點(diǎn))排序.
- tree.children - 設(shè)置或獲取子結(jié)點(diǎn)的訪問(wèn)器.
- tree.nodes - 計(jì)算并返回指定結(jié)點(diǎn)的子結(jié)點(diǎn)信息.
- tree.links - 指定一個(gè)子結(jié)點(diǎn)數(shù)組(通常是nodes函數(shù)返回值), 計(jì)算它們與父結(jié)點(diǎn)的連接信息.
- tree.separation - 設(shè)置或獲取相隔結(jié)點(diǎn)之間的間隔計(jì)算函數(shù).
- tree.size - 指定整個(gè)布局的寬和高.
- tree.nodeSize - 給全部結(jié)點(diǎn)指定一個(gè)固定的大小(會(huì)導(dǎo)致tree.size失效).
矩陣樹(shù)(Treemap)
- d3.layout.treemap - 返回一個(gè)矩陣樹(shù)對(duì)象(用矩陣來(lái)展示一顆樹(shù)).
- treemap.sort - 設(shè)置或獲取一個(gè)函數(shù), 用來(lái)給兄弟節(jié)點(diǎn)(同一父結(jié)點(diǎn)的子結(jié)點(diǎn))排序.
- treemap.children - 設(shè)置或獲取子結(jié)點(diǎn)的訪問(wèn)器.
- treemap.nodes - 計(jì)算并返回指定結(jié)點(diǎn)的子結(jié)點(diǎn)信息.
- treemap.links - 指定一個(gè)子結(jié)點(diǎn)數(shù)組(通常是nodes函數(shù)返回值), 計(jì)算它們與父結(jié)點(diǎn)的連接信息.
- treemap.value - 設(shè)置或獲取一個(gè)用來(lái)計(jì)算單元格大小的值訪問(wèn)器.
- treemap.size - 指定整個(gè)布局的寬和高.
- treemap.padding - 指定父結(jié)點(diǎn)和子結(jié)點(diǎn)的間距.
- treemap.round - 禁用或啟用邊界補(bǔ)償.
- treemap.sticky - 讓布局更”粘”以保證在更新數(shù)據(jù)時(shí)有平滑的動(dòng)畫(huà)效果.
- treemap.mode - 更改矩陣樹(shù)的布局算法.
d3.geo (Geography)
Paths
- d3.geo.path - 創(chuàng)建一個(gè)新的地理路徑生成器.
- path - 投射指定的特性并且渲染到上下文.
- path.projection - 獲取活設(shè)置地理投影.
- path.context - 獲取活設(shè)置渲染上下文.
- path.pointRadius -獲取或設(shè)置半徑去現(xiàn)實(shí)點(diǎn)的特性.
- path.area - 計(jì)算指定特性的投射區(qū)域.
- path.centroid - 計(jì)算指定特性的投射重心點(diǎn).
- path.bounds - 計(jì)算指定特性的投射邊界.
- d3.geo.graticule - 創(chuàng)建地理坐標(biāo)網(wǎng)生成器.
- graticule - 生產(chǎn)一個(gè)子午線(xiàn)或平行線(xiàn)的MultiLineStrings.
- graticule.lines - 生成一個(gè)子午線(xiàn)和平行線(xiàn)的LineString的數(shù)組.
- graticule.outline - 生成一個(gè)表示該坐標(biāo)網(wǎng)的外框多邊形.
- graticule.extent - 獲取或設(shè)置主要的和次要的范圍.
- graticule.majorExtent - 獲取或設(shè)置主要范圍.
- graticule.minorExtent - 獲取或設(shè)置次要范圍.
- graticule.step - 獲取或設(shè)置主要和次要的步間隔.
- graticule.majorStep - 獲取或設(shè)置主要的步間隔.
- graticule.minorStep - 獲取或設(shè)置次要的步間隔.
- graticule.precision - 設(shè)置或者獲取橫向精度.
- d3.geo.circle - 創(chuàng)建一個(gè)圓形的生成器.
- circle - 使用多邊形來(lái)生成一個(gè)分段的圓形.
- circle.origin - 通過(guò)橫向和縱向坐標(biāo)來(lái)指定原點(diǎn).
- circle.angle - 指定以度為單位的角半徑.
- circle.precision - 指定分段圓的精度.
- d3.geo.area - 根據(jù)給定特征計(jì)算球面面積.
- d3.geo.bounds - compute the latitude-longitude bounding box for a given feature.
- d3.geo.centroid - compute the spherical centroid of a given feature.
- d3.geo.distance - compute the great-arc distance between two points.
- d3.geo.interpolate - interpolate between two points along a great arc.
- d3.geo.length - compute the length of a line string or the circumference of a polygon.
- d3.geo.rotation - create a rotation function for the specified angles [λ, φ, γ].
- rotation - rotate the given location around the sphere.
- rotation.invert - inverse-rotate the given location around the sphere.
Projections
- d3.geo.projection - create a standard projection from a raw projection.
- projection - project the specified location.
- projection.invert - invert the projection for the specified point.
- projection.rotate - get or set the projection's three-axis rotation.
- projection.center - get or set the projection's center location.
- projection.translate - get or set the projection's translation position.
- projection.scale - get or set the projection's scale factor.
- projection.clipAngle - get or set the radius of the projection's clip circle.
- projection.clipExtent - get or set the projection's viewport clip extent, in pixels.
- projection.precision - get or set the precision threshold for adaptive resampling.
- projection.stream - wrap the specified stream listener, projecting input geometry.
- d3.geo.projectionMutator - create a standard projection from a mutable raw projection.
- d3.geo.albers - the Albers equal-area conic projection.
- albers.parallels - get or set the projection's two standard parallels.
- d3.geo.albersUsa - a composite Albers projection for the United States.
- d3.geo.azimuthalEqualArea - the azimuthal equal-area projection.
- d3.geo.azimuthalEquidistant - the azimuthal equidistant projection.
- d3.geo.conicConformal - the conic conformal projection.
- d3.geo.conicEquidistant - the conic equidistant projection.
- d3.geo.conicEqualArea the conic equal-area (a.k.a. Albers) projection.
- d3.geo.equirectangular - the equirectangular (plate carreé) projection.
- d3.geo.gnomonic - the gnomonic projection.
- d3.geo.mercator - the spherical Mercator projection.
- d3.geo.orthographic - the azimuthal orthographic projection.
- d3.geo.stereographic - the azimuthal stereographic projection.
- d3.geo.azimuthalEqualArea.raw - the raw azimuthal equal-area projection.
- d3.geo.azimuthalEquidistant.raw - the azimuthal equidistant projection.
- d3.geo.conicConformal.raw - the raw conic conformal projection.
- d3.geo.conicEquidistant.raw - the raw conic equidistant projection.
- d3.geo.conicEqualArea.raw the raw conic equal-area (a.k.a. Albers) projection.
- d3.geo.equirectangular.raw - the raw equirectangular (plate carrée) projection.
- d3.geo.gnomonic.raw - the raw gnomonic projection.
- d3.geo.mercator.raw - the raw Mercator projection.
- d3.geo.orthographic.raw - the raw azimuthal orthographic projection.
- d3.geo.stereographic.raw - the raw azimuthal stereographic projection.
- d3.geo.transverseMercator.raw - the raw transverse Mercator projection.
Streams
- d3.geo.stream - convert a GeoJSON object to a geometry stream.
- stream.point - indicate an x, y (and optionally z) coordinate.
- stream.lineStart - indicate the start of a line or ring.
- stream.lineEnd - indicate the end of a line or ring.
- stream.polygonStart - indicate the start of a polygon.
- stream.polygonEnd - indicate the end of a polygon.
- stream.sphere - indicate a sphere.
- d3.geo.transform - transform streaming geometries.
- transform.stream - wraps a given stream.
- d3.geo.clipExtent - a stream transform that clips geometries to a given axis-aligned rectangle.
- clipExtent.extent - sets the clip extent.
d3.geom (Geometry)
Voronoi
- d3.geom.voronoi - create a Voronoi layout with default accessors.
- voronoi - compute the Voronoi tessellation for the specified points.
- voronoi.x - get or set the x-coordinate accessor for each point.
- voronoi.y - get or set the y-coordinate accessor for each point.
- voronoi.clipExent - get or set the clip extent for the tesselation.
- voronoi.links - compute the Delaunay mesh as a network of links.
- voronoi.triangles - compute the Delaunay mesh as a triangular tessellation.
Quadtree
- d3.geom.quadtree - constructs a quadtree for an array of points.
- quadtree.add - add a point to the quadtree.
- quadtree.visit - recursively visit nodes in the quadtree.
Polygon
- d3.geom.polygon - create a polygon from the specified array of points.
- polygon.area - compute the counterclockwise area of this polygon.
- polygon.centroid - compute the area centroid of this polygon.
- polygon.clip - clip the specified polygon to this polygon.
Hull
- d3.geom.hull - create a convex hull layout with default accessors.
- hull - compute the convex hull for the given array of points.
- hull.x - get or set the x-coordinate accessor.
- hull.y - get or set the y-coordinate accessor.
d3.behavior (Behaviors)
Drag
縮放 Zoom
- d3.behavior.zoom - 創(chuàng)建一個(gè)縮放行為.
- zoom - 對(duì)指定元素應(yīng)用縮放.
- zoom.scale - the current scale factor.
- zoom.translate - the current translate offset.
- zoom.scaleExtent - optional limits on the scale factor.
- zoom.center - an optional focal point for mousewheel zooming.
- zoom.size - the dimensions of the viewport.
- zoom.x - an optional scale whose domain is bound to the x extent of the viewport.
- zoom.y - an optional scale whose domain is bound to the y extent of the viewport.
- zoom.on - listeners for when the scale or translate changes.
- zoom.event - dispatch zoom events after setting the scale or translate.
- 如何實(shí)現(xiàn)json數(shù)據(jù)可視化詳解
- Highcharts+NodeJS搭建數(shù)據(jù)可視化平臺(tái)示例
- JS 音頻可視化插件Wavesurfer.js的使用教程
- JS實(shí)現(xiàn)可視化音頻效果的實(shí)例代碼
- JavaScript數(shù)據(jù)可視化:ECharts制作地圖
- 交互式可視化js庫(kù)gojs使用介紹及技巧
- vue使用wavesurfer.js解決音頻可視化播放問(wèn)題
- 配合Swagger使用絕佳的兩款直觀易用JSON可視化工具
- JS前端可視化GraphQL使用詳解
- 相關(guān)JavaScript在覽器中實(shí)現(xiàn)可視化的四種方式
相關(guān)文章
FastAdmin表單驗(yàn)證data-rule插件—Nice-validator的使用方法
FastAdmin的表單驗(yàn)證data-rule非常方便,也很炫酷,采用的Nice-validator是一款非常強(qiáng)大的表單驗(yàn)證插件,通過(guò)簡(jiǎn)單在元素上配置規(guī)則,即可達(dá)到驗(yàn)證的效果,怎么使用Nice-validator插件呢2023-09-09TypeScript 高級(jí)數(shù)據(jù)類(lèi)型實(shí)例詳解
這篇文章主要為大家介紹了TypeScript 高級(jí)數(shù)據(jù)類(lèi)型實(shí)例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-01-01基于Javascript實(shí)現(xiàn)頁(yè)面商品個(gè)數(shù)增減功能
本文給大家介紹基于Javascript實(shí)現(xiàn)頁(yè)面商品個(gè)數(shù)增減功能,通過(guò)點(diǎn)擊數(shù)量增減個(gè)數(shù),代碼分為前端頁(yè)面,后臺(tái)返回代碼,代碼簡(jiǎn)單易懂,對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友參考下吧2019-07-07TypeScript學(xué)習(xí)輕松玩轉(zhuǎn)類(lèi)型操作
這篇文章主要為大家介紹了TypeScript學(xué)習(xí)輕松玩轉(zhuǎn)類(lèi)型操作,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-07-07rollup?cli開(kāi)發(fā)全面系統(tǒng)性rollup源碼分析
這篇文章主要為大家介紹了rollup?cli開(kāi)發(fā)全網(wǎng)系統(tǒng)性rollup源碼分析,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-01-01