Skip to content

Commit 48c7a19

Browse files
committed
docs for more scales.
1 parent 89c3e58 commit 48c7a19

1 file changed

Lines changed: 13 additions & 8 deletions

File tree

api/index.markdown

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -154,34 +154,39 @@ tickFormat), log (invert, rangeRound, interpolate, ticks, tickFormat), pow
154154
category20b, category20c, quantile (quantiles), quantize.
155155

156156
####`d3.scale.linear`
157-
Map the domain to the range with a linear function.
157+
Map the domain (a number) to the range (a number) with a linear function.
158158
s = d3.scale.linear().domain([0,100]).range([10,20])
159159
s(50) == 15
160160

161161
####`d3.scale.pow`
162-
Map the domain to the range with a power function
162+
Map the domain (a number) to the range (a number) with a power function.
163163
s = d3.scale.pow().domain([0,10]).range([0,10]).exponent(2)
164164
s(5) == 2.5
165165

166166
####`d3.scale.sqrt`
167-
Map the domain to the range with a square root function. Equivalent to pow.exponent(0.5)
167+
Map the domain (a number) to the range (a number) with a square root function. Equivalent to pow.exponent(0.5)
168168

169169
####`d3.scale.log`
170-
Map the domain to the range with a logarithmic function.
170+
Map the domain (a number) to the range (a number) with a logarithmic function.
171171

172172
s = d3.scale.log().domain([1,10]).range([0,10])
173173
s(5) == 6.9897000433601875
174174

175-
####`d3.scale.category`
176-
177175
####`d3.scale.ordinal`
176+
Map the domain (an element of a set) to the range (an element of a set).
177+
s = d3.scale.ordinal().domain(["a", "b", "c"]).range(["one", "two", "three"])
178+
s("b") == "two"
178179

179-
####`d3.scale.quantile`
180+
####`d3.scale.category10`, `d3.scale.category20`, `d3.scale.category20b`, `d3.scale.category20c`
181+
A set of ordinal scales that map the domain to a range of 10 or 20 colours defined by a <a href="http://colorbrewer.org/">ColorBrewer</a> scale.
180182

181183
####`d3.scale.quantize`
182184

183-
####`d3.scale.scale
185+
Map the domain (a number) to the range (an element of a set).
186+
s = d3.scale.quantize().domain([0,4]).range(["zero", "one", "two", "three"])
187+
s(2.7) == "two"
184188

189+
####`d3.scale.quantile`
185190

186191

187192

0 commit comments

Comments
 (0)