@@ -155,27 +155,29 @@ The version number of the scatterplot.
155155
156156** Properties:**
157157
158- | Name | Type | Default | Constraints | Settable | Nullifiable |
159- | ----------------- | --------------- | ---------------------------------- | ---------------------- | -------- | ----------- |
160- | canvas | object | ` document.createElement('canvas') ` | | ` true ` | ` false ` |
161- | regl | object | ` createRegl(canvas) ` | | ` true ` | ` false ` |
162- | version | string | | | ` false ` | ` false ` |
163- | width | number | ` 300 ` | > 0 | ` true ` | ` false ` |
164- | height | number | ` 200 ` | > 0 | ` true ` | ` false ` |
165- | aspectRatio | number | ` 1.0 ` | > 0 | ` true ` | ` false ` |
166- | background | string or array | rgba(0,0,0,1) | hex, rgb, rgba | ` true ` | ` false ` |
167- | backgroundImage | function | ` null ` | Regl texture | ` true ` | ` true ` |
168- | colorBy | string | ` null ` | ` category ` or ` value ` | ` true ` | ` true ` |
169- | colors | array | _ see below_ | list of hex, rgb, rgba | ` true ` | ` false ` |
170- | opacity | number | ` 1 ` | > 0 | ` true ` | ` false ` |
171- | pointOutlineWidth | number | ` 2 ` | >= 0 | ` true ` | ` false ` |
172- | pointSize | number | ` 6 ` | > 0 | ` true ` | ` false ` |
173- | pointSizeSelected | number | ` 2 ` | >= 0 | ` true ` | ` false ` |
174- | lassoColor | array | rgba(0, 0.667, 1, 1) | hex, rgb, rgba | ` true ` | ` false ` |
175- | lassoMinDelay | number | 15 | >= 0 | ` true ` | ` false ` |
176- | lassoMinDist | number | 4 | >= 0 | ` true ` | ` false ` |
177- | showRecticle | boolean | ` false ` | ` true ` or ` false ` | ` true ` | ` false ` |
178- | recticleColor | array | rgba(1,1,1,.5) | hex, rgb, rgba | ` true ` | ` false ` |
158+ | Name | Type | Default | Constraints | Settable | Nullifiable |
159+ | ----------------- | --------------- | ---------------------------------- | -------------------------------------- | -------- | ----------- |
160+ | canvas | object | ` document.createElement('canvas') ` | | ` true ` | ` false ` |
161+ | regl | object | ` createRegl(canvas) ` | | ` true ` | ` false ` |
162+ | version | string | | | ` false ` | ` false ` |
163+ | width | number | ` 300 ` | > 0 | ` true ` | ` false ` |
164+ | height | number | ` 200 ` | > 0 | ` true ` | ` false ` |
165+ | aspectRatio | number | ` 1.0 ` | > 0 | ` true ` | ` false ` |
166+ | background | string or array | rgba(0,0,0,1) | hex, rgb, rgba | ` true ` | ` false ` |
167+ | backgroundImage | function | ` null ` | Regl texture | ` true ` | ` true ` |
168+ | colorBy | string | ` null ` | ` category ` or ` value ` | ` true ` | ` true ` |
169+ | opacity | number | ` 1 ` | > 0 | ` true ` | ` false ` |
170+ | pointColor | number | ` [0.66, 0.66, 0.66, 1] ` | single value or list of hex, rgb, rgba | ` true ` | ` false ` |
171+ | pointColorActive | number | ` [0, 0.55, 1, 1] ` | single value or list of hex, rgb, rgba | ` true ` | ` false ` |
172+ | pointColorHover | number | ` [1, 1, 1, 1] ` | single value or list of hex, rgb, rgba | ` true ` | ` false ` |
173+ | pointOutlineWidth | number | ` 2 ` | >= 0 | ` true ` | ` false ` |
174+ | pointSize | number | ` 6 ` | > 0 | ` true ` | ` false ` |
175+ | pointSizeSelected | number | ` 2 ` | >= 0 | ` true ` | ` false ` |
176+ | lassoColor | array | rgba(0, 0.667, 1, 1) | hex, rgb, rgba | ` true ` | ` false ` |
177+ | lassoMinDelay | number | 15 | >= 0 | ` true ` | ` false ` |
178+ | lassoMinDist | number | 4 | >= 0 | ` true ` | ` false ` |
179+ | showRecticle | boolean | ` false ` | ` true ` or ` false ` | ` true ` | ` false ` |
180+ | recticleColor | array | rgba(1,1,1,.5) | hex, rgb, rgba | ` true ` | ` false ` |
179181
180182** Notes:**
181183
@@ -191,16 +193,12 @@ The version number of the scatterplot.
191193- The background image must be a Regl texture. To easily set a remote
192194 image as the background please use [ ` createTextureFromUrl ` ] ( #const-texture--createTextureFromUrlregl-url-isCrossOrigin ) .
193195
194- - The scatterplot stores 4 colors per color representing 4 states, representing:
196+ - The scatterplot understan 4 colors per color representing 4 states, representing:
195197
196- - normal: used by default [ default: ` [0.66, 0.66, 0.66, 1] ` ]
197- - active: used when selecting a point [ default: ` [0, 0.55, 1, 1] ` ]
198- - hover: used when mousing over a point _ not implemented yet_ [ default: ` [1, 1, 1, 1] ` ]
199- - background: used as the background color [ default: ` [0, 0, 0, 1] ` ]
200-
201- When defining colors you can either pass in a flat array of _ normal_ colors
202- and regl-scatterplot will fill in the rest or you provide a list of quadruples
203- where each quadruple defines the colors for all 4 states.
198+ - normal (` pointColor ` ): the normal color of points.
199+ - active (` pointColorActive ` ): used for coloring selected points.
200+ - hover (` pointColorHover ` ): used when mousing over a point.
201+ - background (` backgroundColor ` ): used as the background color.
204202
205203- Points can currently by colored by _ category_ and _ value_ .
206204
@@ -223,15 +221,15 @@ const width = scatterplot.get('width');
223221// in which case you'd have to set the aspect ratio as follows to `2`.
224222scatterplot .set ({ aspectRatio: 2.0 });
225223
226- // Set background color red
227- scatterplot .set ({ background : ' #00ff00' });
228- scatterplot .set ({ background : [255 , 0 , 0 ] });
229- scatterplot .set ({ background : [255 , 0 , 0 , 1.0 ] });
230- scatterplot .set ({ background : [1 , 0 , 0 , 1.0 ] }); // normalized rgba
224+ // Set background color to red
225+ scatterplot .set ({ backgroundColor : ' #00ff00' }); // hex string
226+ scatterplot .set ({ backgroundColor : [255 , 0 , 0 ] }); // rgb array
227+ scatterplot .set ({ backgroundColor : [255 , 0 , 0 , 1.0 ] }); // rgba array
228+ scatterplot .set ({ backgroundColor : [1.0 , 0 , 0 , 1.0 ] }); // normalized rgba
231229
232- // Set background image to an image with the same origin
230+ // Set background image to an image from the same origin
233231scatterplot .set ({ backgroundImage: ' my-image.png' });
234- // Set background image to an image with a different origin
232+ // Set background image to an image from a different origin
235233scatterplot .set ({ backgroundImage: { src: ' https://server.com/my-image.png' , crossOrigin: true } });
236234// Set background image to some regl texture
237235const image = new Image ();
@@ -242,7 +240,11 @@ image.onload = () => { scatterplot.set({ backgroundImage: scatterplot.regl.textu
242240scatterplot .set ({ colorBy: ' category' });
243241
244242// Set color map
245- scatterplot .set ({ colors: [' #ff0000' , ' #00ff00' , ' #0000ff' ] });
243+ scatterplot .set ({
244+ pointColor: [' #ff0000' , ' #00ff00' , ' #0000ff' ],
245+ pointColorActive: [' #ff0000' , ' #00ff00' , ' #0000ff' ], // optional
246+ pointColorHover: [' #ff0000' , ' #00ff00' , ' #0000ff' ], // optional
247+ });
246248
247249// Set base opacity
248250scatterplot .set ({ opacity: 0.5 });
0 commit comments