pv.Scale.linear.html 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  4. <head>
  5. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  6. <meta name="generator" content="JsDoc Toolkit" />
  7. <title>JsDoc Reference - pv.Scale.linear</title>
  8. <style type="text/css">
  9. /* default.css */
  10. body
  11. {
  12. font: 12px "Lucida Grande", Tahoma, Arial, Helvetica, sans-serif;
  13. width: 800px;
  14. }
  15. .header
  16. {
  17. clear: both;
  18. background-color: #ccc;
  19. padding: 8px;
  20. }
  21. h1
  22. {
  23. font-size: 150%;
  24. font-weight: bold;
  25. padding: 0;
  26. margin: 1em 0 0 .3em;
  27. }
  28. hr
  29. {
  30. border: none 0;
  31. border-top: 1px solid #7F8FB1;
  32. height: 1px;
  33. }
  34. pre.code
  35. {
  36. display: block;
  37. padding: 8px;
  38. border: 1px dashed #ccc;
  39. }
  40. #index
  41. {
  42. margin-top: 24px;
  43. float: left;
  44. width: 160px;
  45. position: absolute;
  46. left: 8px;
  47. background-color: #F3F3F3;
  48. padding: 8px;
  49. }
  50. #content
  51. {
  52. margin-left: 190px;
  53. width: 600px;
  54. }
  55. .classList
  56. {
  57. list-style-type: none;
  58. padding: 0;
  59. margin: 0 0 0 8px;
  60. font-family: arial, sans-serif;
  61. font-size: 1em;
  62. overflow: auto;
  63. }
  64. .classList li
  65. {
  66. padding: 0;
  67. margin: 0 0 8px 0;
  68. }
  69. .summaryTable { width: 100%; }
  70. h1.classTitle
  71. {
  72. font-size:170%;
  73. line-height:130%;
  74. }
  75. h2 { font-size: 110%; }
  76. caption, div.sectionTitle
  77. {
  78. background-color: #7F8FB1;
  79. color: #fff;
  80. font-size:130%;
  81. text-align: left;
  82. padding: 2px 6px 2px 6px;
  83. border: 1px #7F8FB1 solid;
  84. }
  85. div.sectionTitle { margin-bottom: 8px; }
  86. .summaryTable thead { display: none; }
  87. .summaryTable td
  88. {
  89. vertical-align: top;
  90. padding: 4px;
  91. border-bottom: 1px #7F8FB1 solid;
  92. border-right: 1px #7F8FB1 solid;
  93. }
  94. /*col#summaryAttributes {}*/
  95. .summaryTable td.attributes
  96. {
  97. border-left: 1px #7F8FB1 solid;
  98. width: 140px;
  99. text-align: right;
  100. }
  101. td.attributes, .fixedFont
  102. {
  103. line-height: 15px;
  104. color: #002EBE;
  105. font-family: "Courier New",Courier,monospace;
  106. font-size: 13px;
  107. }
  108. .summaryTable td.nameDescription
  109. {
  110. text-align: left;
  111. font-size: 13px;
  112. line-height: 15px;
  113. }
  114. .summaryTable td.nameDescription, .description
  115. {
  116. line-height: 15px;
  117. padding: 4px;
  118. padding-left: 4px;
  119. }
  120. pre
  121. {
  122. border-left: solid 10px #ddd;
  123. padding-left: 1.5em;
  124. }
  125. .summaryTable { margin-bottom: 8px; }
  126. ul.inheritsList
  127. {
  128. list-style: square;
  129. margin-left: 20px;
  130. padding-left: 0;
  131. }
  132. .detailList {
  133. margin-left: 20px;
  134. line-height: 15px;
  135. }
  136. .detailList dt { margin-left: 20px; }
  137. .detailList .heading
  138. {
  139. font-weight: bold;
  140. padding-bottom: 6px;
  141. margin-left: 0;
  142. }
  143. .light, td.attributes, .light a:link, .light a:visited
  144. {
  145. color: #777;
  146. font-style: italic;
  147. }
  148. .fineprint
  149. {
  150. text-align: right;
  151. font-size: 10px;
  152. }
  153. </style>
  154. </head>
  155. <body>
  156. <!-- ============================== header ================================= -->
  157. <!-- begin static/header.html -->
  158. <div id="header">
  159. </div>
  160. <!-- end static/header.html -->
  161. <!-- ============================== classes index ============================ -->
  162. <div id="index">
  163. <!-- begin publish.classesIndex -->
  164. <div align="center"><a href="../index.html">Class Index</a>
  165. | <a href="../files.html">File Index</a></div>
  166. <hr />
  167. <h2>Classes</h2>
  168. <ul class="classList">
  169. <li><i><a href="../symbols/_global_.html">_global_</a></i></li>
  170. <li><a href="../symbols/Array.html">Array</a></li>
  171. <li><a href="../symbols/Date.html">Date</a></li>
  172. <li><a href="../symbols/pv.html">pv</a></li>
  173. <li><a href="../symbols/pv.Anchor.html">pv.Anchor</a></li>
  174. <li><a href="../symbols/pv.Area.html">pv.Area</a></li>
  175. <li><a href="../symbols/pv.Bar.html">pv.Bar</a></li>
  176. <li><a href="../symbols/pv.Color.html">pv.Color</a></li>
  177. <li><a href="../symbols/pv.Color.Hsl.html">pv.Color.Hsl</a></li>
  178. <li><a href="../symbols/pv.Color.Rgb.html">pv.Color.Rgb</a></li>
  179. <li><a href="../symbols/pv.Colors.html">pv.Colors</a></li>
  180. <li><a href="../symbols/pv.Dot.html">pv.Dot</a></li>
  181. <li><a href="../symbols/pv.Flatten.html">pv.Flatten</a></li>
  182. <li><a href="../symbols/pv.Image.html">pv.Image</a></li>
  183. <li><a href="../symbols/pv.Label.html">pv.Label</a></li>
  184. <li><a href="../symbols/pv.Layout.grid.html">pv.Layout.grid</a></li>
  185. <li><a href="../symbols/pv.Layout.icicle.html">pv.Layout.icicle</a></li>
  186. <li><a href="../symbols/pv.Layout.stack.html">pv.Layout.stack</a></li>
  187. <li><a href="../symbols/pv.Layout.sunburst.html">pv.Layout.sunburst</a></li>
  188. <li><a href="../symbols/pv.Layout.treemap.html">pv.Layout.treemap</a></li>
  189. <li><a href="../symbols/pv.Line.html">pv.Line</a></li>
  190. <li><a href="../symbols/pv.Mark.html">pv.Mark</a></li>
  191. <li><a href="../symbols/pv.Nest.html">pv.Nest</a></li>
  192. <li><a href="../symbols/pv.ns.html">pv.ns</a></li>
  193. <li><a href="../symbols/pv.Panel.html">pv.Panel</a></li>
  194. <li><a href="../symbols/pv.Rule.html">pv.Rule</a></li>
  195. <li><a href="../symbols/pv.Scale.linear.html">pv.Scale.linear</a></li>
  196. <li><a href="../symbols/pv.Scale.log.html">pv.Scale.log</a></li>
  197. <li><a href="../symbols/pv.Scale.ordinal.html">pv.Scale.ordinal</a></li>
  198. <li><a href="../symbols/pv.Tree.html">pv.Tree</a></li>
  199. <li><a href="../symbols/pv.Vector.html">pv.Vector</a></li>
  200. <li><a href="../symbols/pv.version.html">pv.version</a></li>
  201. <li><a href="../symbols/pv.Wedge.html">pv.Wedge</a></li>
  202. </ul>
  203. <hr />
  204. <!-- end publish.classesIndex -->
  205. </div>
  206. <div id="content">
  207. <!-- ============================== class title ============================ -->
  208. <h1 class="classTitle">
  209. Class pv.Scale.linear
  210. </h1>
  211. <!-- ============================== class summary ========================== -->
  212. <p class="description">
  213. Represents a linear scale. <style
  214. type="text/css">sub{line-height:0}</style> <img src="../linear.png"
  215. width="180" height="175" align="right"> Most commonly, a linear scale
  216. represents a 1-dimensional linear transformation from a numeric domain of
  217. input data [<i>d<sub>0</sub></i>, <i>d<sub>1</sub></i>] to a numeric range of
  218. pixels [<i>r<sub>0</sub></i>, <i>r<sub>1</sub></i>]. The equation for such a
  219. scale is:
  220. <blockquote><i>f(x) = (x - d<sub>0</sub>) / (d<sub>1</sub> - d<sub>0</sub>) *
  221. (r<sub>1</sub> - r<sub>0</sub>) + r<sub>0</sub></i></blockquote>
  222. For example, a linear scale from the domain [0, 100] to range [0, 640]:
  223. <blockquote><i>f(x) = (x - 0) / (100 - 0) * (640 - 0) + 0</i><br>
  224. <i>f(x) = x / 100 * 640</i><br>
  225. <i>f(x) = x * 6.4</i><br>
  226. </blockquote>
  227. Thus, saying
  228. <pre>.height(function(d) d * 6.4)</pre>
  229. is identical to
  230. <pre>.height(pv.Scale.linear(0, 100).range(0, 640))</pre>
  231. As you can see, scales do not always make code smaller, but they should make
  232. code more explicit and easier to maintain. In addition to readability, scales
  233. offer several useful features:
  234. <p>1. The range can be expressed in colors, rather than pixels. Changing the
  235. example above to
  236. <pre>.fillStyle(pv.Scale.linear(0, 100).range("red", "green"))</pre>
  237. will cause it to fill the marks "red" on an input value of 0, "green" on an
  238. input value of 100, and some color in-between for intermediate values.
  239. <p>2. The domain and range can be subdivided for a "poly-linear"
  240. transformation. For example, you may want a diverging color scale that is
  241. increasingly red for negative values, and increasingly green for positive
  242. values:
  243. <pre>.fillStyle(pv.Scale.linear(-1, 0, 1).range("red", "white", "green"))</pre>
  244. The domain can be specified as a series of <i>n</i> monotonically-increasing
  245. values; the range must also be specified as <i>n</i> values, resulting in
  246. <i>n - 1</i> contiguous linear scales.
  247. <p>3. Linear scales can be inverted for interaction. The <a href="#invert">#invert</a>
  248. method takes a value in the output range, and returns the corresponding value
  249. in the input domain. This is frequently used to convert the mouse location
  250. (see <a href="../symbols/pv.Mark.html#mouse">pv.Mark#mouse</a>) to a value in the input domain. Note that
  251. inversion is only supported for numeric ranges, and not colors.
  252. <p>4. A scale can be queried for reasonable "tick" values. The <a href="#ticks">#ticks</a>
  253. method provides a convenient way to get a series of evenly-spaced rounded
  254. values in the input domain. Frequently these are used in conjunction with
  255. <a href="../symbols/pv.Rule.html">pv.Rule</a> to display tick marks or grid lines.
  256. <p>5. A scale can be "niced" to extend the domain to suitable rounded
  257. numbers. If the minimum and maximum of the domain are messy because they are
  258. derived from data, you can use <a href="#nice">#nice</a> to round these values down and
  259. up to even numbers.
  260. <br /><i>Defined in: </i> <a href="../symbols/src/data_LinearScale.js.html">LinearScale.js</a>.
  261. </p>
  262. <!-- ============================== constructor summary ==================== -->
  263. <table class="summaryTable" cellspacing="0" summary="A summary of the constructor documented in the class pv.Scale.linear.">
  264. <caption>Class Summary</caption>
  265. <thead>
  266. <tr>
  267. <th scope="col">Constructor Attributes</th>
  268. <th scope="col">Constructor Name and Description</th>
  269. </tr>
  270. </thead>
  271. <tbody>
  272. <tr>
  273. <td class="attributes">&nbsp;</td>
  274. <td class="nameDescription" >
  275. <div class="fixedFont">
  276. <b><a href="../symbols/pv.Scale.linear.html#constructor">pv.Scale.linear</a></b>()
  277. </div>
  278. <div class="description">Returns a linear scale for the specified domain.</div>
  279. </td>
  280. </tr>
  281. </tbody>
  282. </table>
  283. <!-- ============================== properties summary ===================== -->
  284. <!-- ============================== methods summary ======================== -->
  285. <table class="summaryTable" cellspacing="0" summary="A summary of the methods documented in the class pv.Scale.linear.">
  286. <caption>Method Summary</caption>
  287. <thead>
  288. <tr>
  289. <th scope="col">Method Attributes</th>
  290. <th scope="col">Method Name and Description</th>
  291. </tr>
  292. </thead>
  293. <tbody>
  294. <tr>
  295. <td class="attributes">&nbsp;</td>
  296. <td class="nameDescription">
  297. <div class="fixedFont"><b><a href="../symbols/pv.Scale.linear.html#by">by</a></b>(f)
  298. </div>
  299. <div class="description">Returns a view of this scale by the specified accessor function <tt>f</tt>.</div>
  300. </td>
  301. </tr>
  302. <tr>
  303. <td class="attributes">&nbsp;</td>
  304. <td class="nameDescription">
  305. <div class="fixedFont"><b><a href="../symbols/pv.Scale.linear.html#domain">domain</a></b>()
  306. </div>
  307. <div class="description">Sets or gets the input domain.</div>
  308. </td>
  309. </tr>
  310. <tr>
  311. <td class="attributes">&nbsp;</td>
  312. <td class="nameDescription">
  313. <div class="fixedFont"><b><a href="../symbols/pv.Scale.linear.html#invert">invert</a></b>(y)
  314. </div>
  315. <div class="description">Inverts the specified value in the output range, returning the
  316. corresponding value in the input domain.</div>
  317. </td>
  318. </tr>
  319. <tr>
  320. <td class="attributes">&nbsp;</td>
  321. <td class="nameDescription">
  322. <div class="fixedFont"><b><a href="../symbols/pv.Scale.linear.html#nice">nice</a></b>()
  323. </div>
  324. <div class="description">"Nices" this scale, extending the bounds of the input domain to
  325. evenly-rounded values.</div>
  326. </td>
  327. </tr>
  328. <tr>
  329. <td class="attributes">&nbsp;</td>
  330. <td class="nameDescription">
  331. <div class="fixedFont"><b><a href="../symbols/pv.Scale.linear.html#range">range</a></b>()
  332. </div>
  333. <div class="description">Sets or gets the output range.</div>
  334. </td>
  335. </tr>
  336. <tr>
  337. <td class="attributes">&nbsp;</td>
  338. <td class="nameDescription">
  339. <div class="fixedFont"><b><a href="../symbols/pv.Scale.linear.html#tickFormat">tickFormat</a></b>(t)
  340. </div>
  341. <div class="description">Formats the specified tick value using the appropriate precision, based on
  342. the step interval between tick marks.</div>
  343. </td>
  344. </tr>
  345. <tr>
  346. <td class="attributes">&nbsp;</td>
  347. <td class="nameDescription">
  348. <div class="fixedFont"><b><a href="../symbols/pv.Scale.linear.html#ticks">ticks</a></b>()
  349. </div>
  350. <div class="description">Returns an array of evenly-spaced, suitably-rounded values in the input
  351. domain.</div>
  352. </td>
  353. </tr>
  354. </tbody>
  355. </table>
  356. <!-- ============================== events summary ======================== -->
  357. <!-- ============================== constructor details ==================== -->
  358. <div class="details"><a name="constructor"> </a>
  359. <div class="sectionTitle">
  360. Class Detail
  361. </div>
  362. <div class="fixedFont">
  363. <b>pv.Scale.linear</b>()
  364. </div>
  365. <div class="description">
  366. Returns a linear scale for the specified domain. The arguments to this
  367. constructor are optional, and equivalent to calling <a href="#domain">#domain</a>.
  368. </div>
  369. <dl class="detailList">
  370. <dt class="heading">Parameters:</dt>
  371. <dt>
  372. <span class="light fixedFont">{number...}</span> <b>domain...</b>
  373. </dt>
  374. <dd>domain values.</dd>
  375. </dl>
  376. <dl class="detailList">
  377. <dt class="heading">Returns:</dt>
  378. <dd><span class="light fixedFont">{<a href="../symbols/pv.Scale.linear.html">pv.Scale.linear</a>}</span> a linear scale.</dd>
  379. </dl>
  380. </div>
  381. <!-- ============================== field details ========================== -->
  382. <!-- ============================== method details ========================= -->
  383. <div class="sectionTitle">
  384. Method Detail
  385. </div>
  386. <a name="by"> </a>
  387. <div class="fixedFont">
  388. <span class="light">{<a href="../symbols/pv.Scale.linear.html">pv.Scale.linear</a>}</span>
  389. <b>by</b>(f)
  390. </div>
  391. <div class="description">
  392. Returns a view of this scale by the specified accessor function <tt>f</tt>.
  393. Given a scale <tt>y</tt>, <tt>y.by(function(d) d.foo)</tt> is equivalent to
  394. <tt>function(d) y(d.foo)</tt>.
  395. <p>This method is provided for convenience, such that scales can be
  396. succinctly defined inline. For example, given an array of data elements
  397. that have a <tt>score</tt> attribute with the domain [0, 1], the height
  398. property could be specified as:
  399. <pre>.height(pv.Scale.linear().range(0, 480).by(function(d) d.score))</pre>
  400. This is equivalent to:
  401. <pre>.height(function(d) d.score * 480)</pre>
  402. This method should be used judiciously; it is typically more clear to
  403. invoke the scale directly, passing in the value to be scaled.
  404. </div>
  405. <dl class="detailList">
  406. <dt class="heading">Parameters:</dt>
  407. <dt>
  408. <span class="light fixedFont">{function}</span> <b>f</b>
  409. </dt>
  410. <dd>an accessor function.</dd>
  411. </dl>
  412. <dl class="detailList">
  413. <dt class="heading">Returns:</dt>
  414. <dd><span class="light fixedFont">{<a href="../symbols/pv.Scale.linear.html">pv.Scale.linear</a>}</span> a view of this scale by the specified accessor
  415. function.</dd>
  416. </dl>
  417. <hr />
  418. <a name="domain"> </a>
  419. <div class="fixedFont">
  420. <span class="light">{<a href="../symbols/pv.Scale.linear.html">pv.Scale.linear</a>}</span>
  421. <b>domain</b>()
  422. </div>
  423. <div class="description">
  424. Sets or gets the input domain. This method can be invoked several ways:
  425. <p>1. <tt>domain(min, ..., max)</tt>
  426. <p>Specifying the domain as a series of numbers is the most explicit and
  427. recommended approach. Most commonly, two numbers are specified: the minimum
  428. and maximum value. However, for a diverging scale, or other subdivided
  429. poly-linear scales, multiple values can be specified. Values can be derived
  430. from data using <a href="../symbols/pv.html#.min">pv.min</a> and <a href="../symbols/pv.html#.max">pv.max</a>. For example:
  431. <pre>.domain(0, pv.max(array))</pre>
  432. An alternative method for deriving minimum and maximum values from data
  433. follows.
  434. <p>2. <tt>domain(array, minf, maxf)</tt>
  435. <p>When both the minimum and maximum value are derived from data, the
  436. arguments to the <tt>domain</tt> method can be specified as the array of
  437. data, followed by zero, one or two accessor functions. For example, if the
  438. array of data is just an array of numbers:
  439. <pre>.domain(array)</pre>
  440. On the other hand, if the array elements are objects representing stock
  441. values per day, and the domain should consider the stock's daily low and
  442. daily high:
  443. <pre>.domain(array, function(d) d.low, function(d) d.high)</pre>
  444. The first method of setting the domain is preferred because it is more
  445. explicit; setting the domain using this second method should be used only
  446. if brevity is required.
  447. <p>3. <tt>domain()</tt>
  448. <p>Invoking the <tt>domain</tt> method with no arguments returns the
  449. current domain as an array of numbers.
  450. </div>
  451. <dl class="detailList">
  452. <dt class="heading">Parameters:</dt>
  453. <dt>
  454. <span class="light fixedFont">{number...}</span> <b>domain...</b>
  455. </dt>
  456. <dd>domain values.</dd>
  457. </dl>
  458. <dl class="detailList">
  459. <dt class="heading">Returns:</dt>
  460. <dd><span class="light fixedFont">{<a href="../symbols/pv.Scale.linear.html">pv.Scale.linear</a>}</span> <tt>this</tt>, or the current domain.</dd>
  461. </dl>
  462. <hr />
  463. <a name="invert"> </a>
  464. <div class="fixedFont">
  465. <span class="light">{number}</span>
  466. <b>invert</b>(y)
  467. </div>
  468. <div class="description">
  469. Inverts the specified value in the output range, returning the
  470. corresponding value in the input domain. This is frequently used to convert
  471. the mouse location (see <a href="../symbols/pv.Mark.html#mouse">pv.Mark#mouse</a>) to a value in the input
  472. domain. Inversion is only supported for numeric ranges, and not colors.
  473. <p>Note that this method does not do any rounding or bounds checking. If
  474. the input domain is discrete (e.g., an array index), the returned value
  475. should be rounded. If the specified <tt>y</tt> value is outside the range,
  476. the returned value may be equivalently outside the input domain.
  477. </div>
  478. <dl class="detailList">
  479. <dt class="heading">Parameters:</dt>
  480. <dt>
  481. <span class="light fixedFont">{number}</span> <b>y</b>
  482. </dt>
  483. <dd>a value in the output range (a pixel location).</dd>
  484. </dl>
  485. <dl class="detailList">
  486. <dt class="heading">Returns:</dt>
  487. <dd><span class="light fixedFont">{number}</span> a value in the input domain.</dd>
  488. </dl>
  489. <hr />
  490. <a name="nice"> </a>
  491. <div class="fixedFont">
  492. <span class="light">{<a href="../symbols/pv.Scale.linear.html">pv.Scale.linear</a>}</span>
  493. <b>nice</b>()
  494. </div>
  495. <div class="description">
  496. "Nices" this scale, extending the bounds of the input domain to
  497. evenly-rounded values. Nicing is useful if the domain is computed
  498. dynamically from data, and may be irregular. For example, given a domain of
  499. [0.20147987687960267, 0.996679553296417], a call to <tt>nice()</tt> might
  500. extend the domain to [0.2, 1].
  501. <p>This method must be invoked each time after setting the domain.
  502. </div>
  503. <dl class="detailList">
  504. <dt class="heading">Returns:</dt>
  505. <dd><span class="light fixedFont">{<a href="../symbols/pv.Scale.linear.html">pv.Scale.linear</a>}</span> <tt>this</tt>.</dd>
  506. </dl>
  507. <hr />
  508. <a name="range"> </a>
  509. <div class="fixedFont">
  510. <span class="light">{<a href="../symbols/pv.Scale.linear.html">pv.Scale.linear</a>}</span>
  511. <b>range</b>()
  512. </div>
  513. <div class="description">
  514. Sets or gets the output range. This method can be invoked several ways:
  515. <p>1. <tt>range(min, ..., max)</tt>
  516. <p>The range may be specified as a series of numbers or colors. Most
  517. commonly, two numbers are specified: the minimum and maximum pixel values.
  518. For a color scale, values may be specified as <a href="../symbols/pv.Color.html">pv.Color</a>s or
  519. equivalent strings. For a diverging scale, or other subdivided poly-linear
  520. scales, multiple values can be specified. For example:
  521. <pre>.range("red", "white", "green")</pre>
  522. <p>Currently, only numbers and colors are supported as range values. The
  523. number of range values must exactly match the number of domain values, or
  524. the behavior of the scale is undefined.
  525. <p>2. <tt>range()</tt>
  526. <p>Invoking the <tt>range</tt> method with no arguments returns the current
  527. range as an array of numbers or colors.
  528. </div>
  529. <dl class="detailList">
  530. <dt class="heading">Parameters:</dt>
  531. <dt>
  532. <span class="light fixedFont">{...}</span> <b>range...</b>
  533. </dt>
  534. <dd>range values.</dd>
  535. </dl>
  536. <dl class="detailList">
  537. <dt class="heading">Returns:</dt>
  538. <dd><span class="light fixedFont">{<a href="../symbols/pv.Scale.linear.html">pv.Scale.linear</a>}</span> <tt>this</tt>, or the current range.</dd>
  539. </dl>
  540. <hr />
  541. <a name="tickFormat"> </a>
  542. <div class="fixedFont">
  543. <span class="light">{string}</span>
  544. <b>tickFormat</b>(t)
  545. </div>
  546. <div class="description">
  547. Formats the specified tick value using the appropriate precision, based on
  548. the step interval between tick marks.
  549. </div>
  550. <dl class="detailList">
  551. <dt class="heading">Parameters:</dt>
  552. <dt>
  553. <span class="light fixedFont">{number}</span> <b>t</b>
  554. </dt>
  555. <dd>a tick value.</dd>
  556. </dl>
  557. <dl class="detailList">
  558. <dt class="heading">Returns:</dt>
  559. <dd><span class="light fixedFont">{string}</span> a formatted tick value.</dd>
  560. </dl>
  561. <hr />
  562. <a name="ticks"> </a>
  563. <div class="fixedFont">
  564. <span class="light">{number[]}</span>
  565. <b>ticks</b>()
  566. </div>
  567. <div class="description">
  568. Returns an array of evenly-spaced, suitably-rounded values in the input
  569. domain. This method attempts to return between 5 and 10 tick values. These
  570. values are frequently used in conjunction with <a href="../symbols/pv.Rule.html">pv.Rule</a> to display
  571. tick marks or grid lines.
  572. </div>
  573. <dl class="detailList">
  574. <dt class="heading">Returns:</dt>
  575. <dd><span class="light fixedFont">{number[]}</span> an array input domain values to use as ticks.</dd>
  576. </dl>
  577. <!-- ============================== event details ========================= -->
  578. <hr />
  579. </div>
  580. <!-- ============================== footer ================================= -->
  581. <div class="fineprint" style="clear:both">
  582. Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.3.0 on Tue Oct 06 2009 09:59:02 GMT-0700 (PDT)
  583. </div>
  584. </body>
  585. </html>