From f8fa4dc69258a25147596478c9b5f0b5cf76327d Mon Sep 17 00:00:00 2001 From: Dave Landry Date: Wed, 19 May 2021 15:08:53 -0400 Subject: [PATCH] updates documentation --- README.md | 69 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 39 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 5ca3c18..93aab51 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,7 @@ This is a global class, and extends all of the methods and functionality of [# ColorScale.**render**([*callback*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L110) +# ColorScale.**render**([*callback*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L118) Renders the current ColorScale to the page. If a *callback* is specified, it will be called once the ColorScale is done drawing. @@ -86,7 +87,7 @@ Renders the current ColorScale to the page. If a *callback* is specified, it wil This is a static method of [ColorScale](#ColorScale), and is chainable with other methods of this Class. -# ColorScale.**axisConfig**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L524) +# ColorScale.**axisConfig**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L535) The [ColorScale](http://d3plus.org/docs/#ColorScale) is constructed by combining an [Axis](http://d3plus.org/docs/#Axis) for the ticks/labels and a [Rect](http://d3plus.org/docs/#Rect) for the actual color box (or multiple boxes, as in a jenks scale). Because of this, there are separate configs for the [Axis](http://d3plus.org/docs/#Axis) class used to display the text ([axisConfig](http://d3plus.org/docs/#ColorScale.axisConfig)) and the [Rect](http://d3plus.org/docs/#Rect) class used to draw the color breaks ([rectConfig](http://d3plus.org/docs/#ColorScale.rectConfig)). This method acts as a pass-through to the config method of the [Axis](http://d3plus.org/docs/#Axis). An example usage of this method can be seen [here](http://d3plus.org/examples/d3plus-legend/colorScale-dark/). @@ -94,7 +95,7 @@ The [ColorScale](http://d3plus.org/docs/#ColorScale) is constructed by combining This is a static method of [ColorScale](#ColorScale), and is chainable with other methods of this Class. -# ColorScale.**align**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L534) +# ColorScale.**align**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L545) If *value* is specified, sets the horizontal alignment to the specified value and returns the current class instance. If *value* is not specified, returns the current horizontal alignment. @@ -102,7 +103,7 @@ If *value* is specified, sets the horizontal alignment to the specified value an This is a static method of [ColorScale](#ColorScale), and is chainable with other methods of this Class. -# ColorScale.**buckets**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L544) +# ColorScale.**buckets**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L555) The number of discrete buckets to create in a bucketed color scale. Will be overridden by any custom Array of colors passed to the `color` method. Optionally, users can supply an Array of values used to separate buckets, such as `[0, 10, 25, 50, 90]` for a percentage scale. This value would create 4 buckets, with each value representing the break point between each bucket (so 5 values makes 4 buckets). @@ -110,7 +111,7 @@ The number of discrete buckets to create in a bucketed color scale. Will be over This is a static method of [ColorScale](#ColorScale), and is chainable with other methods of this Class. -# ColorScale.**bucketAxis**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L554) +# ColorScale.**bucketAxis**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L565) Determines whether or not to use an Axis to display bucket scales (both "buckets" and "jenks"). When set to `false`, bucketed scales will use the `Legend` class to display squares for each range of data. When set to `true`, bucketed scales will be displayed on an `Axis`, similar to "linear" scales. @@ -118,7 +119,7 @@ Determines whether or not to use an Axis to display bucket scales (both "buckets This is a static method of [ColorScale](#ColorScale), and is chainable with other methods of this Class. -# ColorScale.**bucketFormat**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L564) +# ColorScale.**bucketFormat**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L575) A function for formatting the labels associated to each bucket in a bucket-type scale ("jenks", "quantile", etc). The function is passed four arguments: the start value of the current bucket, it's index in the full Array of buckets, the full Array of buckets, and an Array of every value present in the data used to construct the buckets. Keep in mind that the end value for the bucket is not actually the next bucket in the list, but includes every value up until that next bucket value (less than, but not equal to). By default, d3plus will make the end value slightly less than it's current value, so that it does not overlap with the start label for the next bucket. @@ -126,7 +127,15 @@ A function for formatting the labels associated to each bucket in a bucket-type This is a static method of [ColorScale](#ColorScale), and is chainable with other methods of this Class. -# ColorScale.**centered**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L575) +# ColorScale.**bucketJoiner**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L585) + +A function that receives the minimum and maximum values of a bucket, and is expected to return the full label. + + +This is a static method of [ColorScale](#ColorScale), and is chainable with other methods of this Class. + + +# ColorScale.**centered**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L596) Determines whether or not to display a midpoint centered Axis. Does not apply to quantile scales. @@ -134,7 +143,7 @@ Determines whether or not to display a midpoint centered Axis. Does not apply to This is a static method of [ColorScale](#ColorScale), and is chainable with other methods of this Class. -# ColorScale.**color**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L585) +# ColorScale.**color**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L606) Overrides the default internal logic of `colorMin`, `colorMid`, and `colorMax` to only use just this specified color. If a single color is given as a String, then the scale is interpolated by lightening that color. Otherwise, the function expects an Array of color values to be used in order for the scale. @@ -142,7 +151,7 @@ Overrides the default internal logic of `colorMin`, `colorMid`, and `colorMax` t This is a static method of [ColorScale](#ColorScale), and is chainable with other methods of this Class. -# ColorScale.**colorMax**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L595) +# ColorScale.**colorMax**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L616) Defines the color to be used for numbers greater than the value of the `midpoint` on the scale (defaults to `0`). Colors in between this value and the value of `colorMid` will be interpolated, unless a custom Array of colors has been specified using the `color` method. @@ -150,7 +159,7 @@ Defines the color to be used for numbers greater than the value of the `midpoint This is a static method of [ColorScale](#ColorScale), and is chainable with other methods of this Class. -# ColorScale.**colorMid**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L605) +# ColorScale.**colorMid**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L626) Defines the color to be used for the midpoint of a diverging scale, based on the current value of the `midpoint` method (defaults to `0`). Colors in between this value and the values of `colorMin` and `colorMax` will be interpolated, unless a custom Array of colors has been specified using the `color` method. @@ -158,7 +167,7 @@ Defines the color to be used for the midpoint of a diverging scale, based on the This is a static method of [ColorScale](#ColorScale), and is chainable with other methods of this Class. -# ColorScale.**colorMin**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L615) +# ColorScale.**colorMin**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L636) Defines the color to be used for numbers less than the value of the `midpoint` on the scale (defaults to `0`). Colors in between this value and the value of `colorMid` will be interpolated, unless a custom Array of colors has been specified using the `color` method. @@ -166,7 +175,7 @@ Defines the color to be used for numbers less than the value of the `midpoint` o This is a static method of [ColorScale](#ColorScale), and is chainable with other methods of this Class. -# ColorScale.**data**([*data*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L625) +# ColorScale.**data**([*data*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L646) If *data* is specified, sets the data array to the specified array and returns the current class instance. If *data* is not specified, returns the current data array. A shape key will be drawn for each object in the array. @@ -174,7 +183,7 @@ If *data* is specified, sets the data array to the specified array and returns t This is a static method of [ColorScale](#ColorScale), and is chainable with other methods of this Class. -# ColorScale.**domain**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L635) +# ColorScale.**domain**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L656) In a linear scale, this Array of 2 values defines the min and max values used in the color scale. Any values outside of this range will be mapped to the nearest color value. @@ -182,7 +191,7 @@ In a linear scale, this Array of 2 values defines the min and max values used in This is a static method of [ColorScale](#ColorScale), and is chainable with other methods of this Class. -# ColorScale.**duration**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L645) +# ColorScale.**duration**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L666) If *value* is specified, sets the transition duration of the ColorScale and returns the current class instance. If *value* is not specified, returns the current duration. @@ -190,7 +199,7 @@ If *value* is specified, sets the transition duration of the ColorScale and retu This is a static method of [ColorScale](#ColorScale), and is chainable with other methods of this Class. -# ColorScale.**height**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L655) +# ColorScale.**height**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L676) If *value* is specified, sets the overall height of the ColorScale and returns the current class instance. If *value* is not specified, returns the current height value. @@ -198,7 +207,7 @@ If *value* is specified, sets the overall height of the ColorScale and returns t This is a static method of [ColorScale](#ColorScale), and is chainable with other methods of this Class. -# ColorScale.**labelConfig**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L665) +# ColorScale.**labelConfig**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L686) A pass-through for the [TextBox](http://d3plus.org/docs/#TextBox) class used to style the labelMin and labelMax text. @@ -206,7 +215,7 @@ A pass-through for the [TextBox](http://d3plus.org/docs/#TextBox) class used to This is a static method of [ColorScale](#ColorScale), and is chainable with other methods of this Class. -# ColorScale.**labelMin**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L675) +# ColorScale.**labelMin**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L696) Defines a text label to be displayed off of the end of the minimum point in the scale (currently only available in horizontal orientation). @@ -214,7 +223,7 @@ Defines a text label to be displayed off of the end of the minimum point in the This is a static method of [ColorScale](#ColorScale), and is chainable with other methods of this Class. -# ColorScale.**labelMax**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L685) +# ColorScale.**labelMax**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L706) Defines a text label to be displayed off of the end of the maximum point in the scale (currently only available in horizontal orientation). @@ -222,7 +231,7 @@ Defines a text label to be displayed off of the end of the maximum point in the This is a static method of [ColorScale](#ColorScale), and is chainable with other methods of this Class. -# ColorScale.**legendConfig**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L695) +# ColorScale.**legendConfig**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L716) The [ColorScale](http://d3plus.org/docs/#ColorScale) is constructed by combining an [Axis](http://d3plus.org/docs/#Axis) for the ticks/labels and a [Rect](http://d3plus.org/docs/#Rect) for the actual color box (or multiple boxes, as in a jenks scale). Because of this, there are separate configs for the [Axis](http://d3plus.org/docs/#Axis) class used to display the text ([axisConfig](http://d3plus.org/docs/#ColorScale.axisConfig)) and the [Rect](http://d3plus.org/docs/#Rect) class used to draw the color breaks ([rectConfig](http://d3plus.org/docs/#ColorScale.rectConfig)). This method acts as a pass-through to the config method of the [Axis](http://d3plus.org/docs/#Axis). An example usage of this method can be seen [here](http://d3plus.org/examples/d3plus-legend/colorScale-dark/). @@ -230,7 +239,7 @@ The [ColorScale](http://d3plus.org/docs/#ColorScale) is constructed by combining This is a static method of [ColorScale](#ColorScale), and is chainable with other methods of this Class. -# ColorScale.**midpoint**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L705) +# ColorScale.**midpoint**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L726) The number value to be used as the anchor for `colorMid`, and defines the center point of the diverging color scale. @@ -238,7 +247,7 @@ The number value to be used as the anchor for `colorMid`, and defines the center This is a static method of [ColorScale](#ColorScale), and is chainable with other methods of this Class. -# ColorScale.**orient**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L715) +# ColorScale.**orient**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L736) Sets the flow of the items inside the ColorScale. If no value is passed, the current flow will be returned. @@ -246,7 +255,7 @@ Sets the flow of the items inside the ColorScale. If no value is passed, the cur This is a static method of [ColorScale](#ColorScale), and is chainable with other methods of this Class. -# ColorScale.**outerBounds**() [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L725) +# ColorScale.**outerBounds**() [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L746) If called after the elements have been drawn to DOM, will returns the outer bounds of the ColorScale content. @@ -259,7 +268,7 @@ This is a static method of [ColorScale](#ColorScale). ``` -# ColorScale.**padding**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L735) +# ColorScale.**padding**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L756) If *value* is specified, sets the padding between each key to the specified number and returns the current class instance. If *value* is not specified, returns the current padding value. @@ -267,7 +276,7 @@ If *value* is specified, sets the padding between each key to the specified numb This is a static method of [ColorScale](#ColorScale), and is chainable with other methods of this Class. -# ColorScale.**rectConfig**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L745) +# ColorScale.**rectConfig**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L766) The [ColorScale](http://d3plus.org/docs/#ColorScale) is constructed by combining an [Axis](http://d3plus.org/docs/#Axis) for the ticks/labels and a [Rect](http://d3plus.org/docs/#Rect) for the actual color box (or multiple boxes, as in a jenks scale). Because of this, there are separate configs for the [Axis](http://d3plus.org/docs/#Axis) class used to display the text ([axisConfig](http://d3plus.org/docs/#ColorScale.axisConfig)) and the [Rect](http://d3plus.org/docs/#Rect) class used to draw the color breaks ([rectConfig](http://d3plus.org/docs/#ColorScale.rectConfig)). This method acts as a pass-through to the config method of the [Rect](http://d3plus.org/docs/#Rect). An example usage of this method can be seen [here](http://d3plus.org/examples/d3plus-legend/colorScale-dark/). @@ -275,7 +284,7 @@ The [ColorScale](http://d3plus.org/docs/#ColorScale) is constructed by combining This is a static method of [ColorScale](#ColorScale), and is chainable with other methods of this Class. -# ColorScale.**scale**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L755) +# ColorScale.**scale**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L776) If *value* is specified, sets the scale of the ColorScale and returns the current class instance. If *value* is not specified, returns the current scale value. @@ -283,7 +292,7 @@ If *value* is specified, sets the scale of the ColorScale and returns the curren This is a static method of [ColorScale](#ColorScale), and is chainable with other methods of this Class. -# ColorScale.**select**([*selector*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L765) +# ColorScale.**select**([*selector*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L786) If *selector* is specified, sets the SVG container element to the specified d3 selector or DOM element and returns the current class instance. If *selector* is not specified, returns the current SVG container element. @@ -291,7 +300,7 @@ If *selector* is specified, sets the SVG container element to the specified d3 s This is a static method of [ColorScale](#ColorScale), and is chainable with other methods of this Class. -# ColorScale.**size**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L775) +# ColorScale.**size**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L796) The height of horizontal color scales, and width when positioned vertical. @@ -299,7 +308,7 @@ The height of horizontal color scales, and width when positioned vertical. This is a static method of [ColorScale](#ColorScale), and is chainable with other methods of this Class. -# ColorScale.**value**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L789) +# ColorScale.**value**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L810) If *value* is specified, sets the value accessor to the specified function or string and returns the current class instance. If *value* is not specified, returns the current value accessor. @@ -314,7 +323,7 @@ function value(d) { ``` -# ColorScale.**width**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L799) +# ColorScale.**width**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L820) If *value* is specified, sets the overall width of the ColorScale and returns the current class instance. If *value* is not specified, returns the current width value. @@ -528,4 +537,4 @@ This is a static method of [Legend](#Legend), and is chainable with -###### Documentation generated on Fri, 12 Mar 2021 21:10:17 GMT +###### Documentation generated on Wed, 19 May 2021 19:08:53 GMT