Skip to content

Commit

Permalink
Simplify DOM by cascading duplicate style calls
Browse files Browse the repository at this point in the history
  • Loading branch information
abought committed Sep 15, 2020
1 parent ec0434e commit 292a8cc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 4 additions & 2 deletions esm/components/data_layer/arcs.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ class Arcs extends BaseDataLayer {
.selectAll('path.lz-data_layer-arcs-hitarea')
.data(track_data, (d) => this.getElementId(d));

this.svg.group
.call(applyStyles, layout.style);

// Add new points as necessary
selection
.enter()
Expand All @@ -73,8 +76,7 @@ class Arcs extends BaseDataLayer {
.attr('id', (d) => this.getElementId(d))
.merge(selection)
.attr('stroke', (d, i) => this.resolveScalableParameter(this.layout.color, d, i))
.attr('d', (d, i) => _make_line(d))
.call(applyStyles, layout.style);
.attr('d', (d, i) => _make_line(d));

hitareas
.enter()
Expand Down
2 changes: 0 additions & 2 deletions esm/components/data_layer/scatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@ class Scatter extends BaseDataLayer {

this.label_texts = this.label_groups.merge(groups_enter)
.append('text')
.attr('class', style_class)
.text((d) => parseFields(d, data_layer.layout.label.text || ''))
.attr('x', (d) => {
let x = data_layer.parent[x_scale](d[data_layer.layout.x_axis.field])
Expand Down Expand Up @@ -279,7 +278,6 @@ class Scatter extends BaseDataLayer {
}
this.label_lines = this.label_groups.merge(groups_enter)
.append('line')
.attr('class', `lz-data_layer-${this.layout.type}-label`)
.attr('x1', (d) => {
let x = data_layer.parent[x_scale](d[data_layer.layout.x_axis.field]);
if (isNaN(x)) {
Expand Down

0 comments on commit 292a8cc

Please sign in to comment.