# Class: scatter

## LocusZoom_DataLayers~scatter()

Scatter Data Layer Implements a standard scatter plot

## Constructor

#### new scatter()

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`layout.point_size` | number | Array.<module:LocusZoom_DataLayers~ScalableParameter> | <optional> | 40 | The size (area) of the point for each datum
`layout.point_shape` | string | Array.<module:LocusZoom_DataLayers~ScalableParameter> | <optional> | 'circle' | Shape of the point for each datum. Supported values map to the d3 SVG Symbol Types (i.e.: "circle", "cross", "diamond", "square", "triangle", "star", and "wye"), plus "triangledown".
`layout.color` | string | Array.<module:LocusZoom_DataLayers~ScalableParameter> | <optional> | '#888888' | The color of the point for each datum
`layout.coalesce` | module:LocusZoom_DataLayers~scatter~coalesce_options | <optional> |  | Options to control whether and how to combine adjacent insignificant ("within region of interest") points to improve rendering performance. These options are primarily aimed at GWAS region plots. Within a specified rectangle area (eg "insignificant point cutoff"), we choose only points far enough part to be seen. The defaults are specifically tuned for GWAS plots with -log(p) on the y-axis.
`layout.fill_opacity` | number | Array.<module:LocusZoom_DataLayers~ScalableParameter> | <optional> | 1 | Opacity (0..1) for each datum point
`layout.label.text` | string | <optional> |  | Similar to tooltips: a template string that can reference datum fields for label text.
`layout.label.spacing` | number | <optional> |  | Distance (in px) between the label and the center of the datum.
`layout.label.lines.style` | object | <optional> |  | CSS style options for how the line is rendered
`layout.label.filters` | number | <optional> |  | Filters that describe which points to label. For performance reasons, we recommend labeling only a small subset of most interesting points.
`layout.label.style` | object | <optional> |  | CSS style options for label text

Source:
  - components/data_layer/scatter.js, line 57

### Members

#### (static, constant) default_layout

Source:
  - components/data_layer/scatter.js, line 11

### Methods

#### makeLDReference(element) → {Promise}

Method to set a passed element as the LD reference variant in the plot-level state. Triggers a re-render so that the plot will update with the new LD information. This is useful in tooltips, eg the "make LD reference" action link for GWAS scatter plots.

##### Parameters:

Name | Type | Description
--- | --- | ---
`element` | object | The data associated with a particular plot element

Source:
  - components/data_layer/scatter.js, line 437

##### Fires:

- event:set_ldrefvar

##### Returns:

Type
  Promise

### Type Definitions

#### coalesce_options

Options that control point-coalescing in scatter plots

##### Type:

- object

##### Properties:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`active` | boolean | <optional> | false | Whether to use this feature. Typically used for GWAS plots, but not other scatter plots such as PheWAS.
`max_points` | number | <optional> | 800 | Only attempt to reduce DOM size if there are at least this many points. Many plots are 800-2400 px wide, so, more than 1 datum per pixel of average region width. For more sparse datasets, all points will be faithfully rendered even if coalesce.active=true.
`x_min` | number | <optional> | '-Infinity' | Min x coordinate of the region where points will be coalesced
`x_max` | number | <optional> | 'Infinity' | Max x coordinate of the region where points will be coalesced
`y_min` | number | <optional> | 0 | Min y coordinate of the region where points will be coalesced.
`y_max` | number | <optional> | 3.0 | Max y coordinate of the region where points will be coalesced
`x_gap` | number | <optional> | 7 | Max number of pixels between the center of two points that can be coalesced. For circles, area 40 = radius ~3.5; aim for ~1 diameter distance.
`y_gap` | number | <optional> | 7 |

Source:
  - components/data_layer/scatter.js, line 35