()
| 133 | } |
| 134 | |
| 135 | private updatePosition() { |
| 136 | this.set_ranges(); |
| 137 | |
| 138 | if (this.scales.x && this.scales.y) { |
| 139 | // set x and y positions on mark data manually |
| 140 | // and redraw the force layout |
| 141 | this.model.mark_data.forEach((d) => { |
| 142 | d.x = this.scales.x.scale(d.xval) + this.scales.x.offset; |
| 143 | d.y = this.scales.y.scale(d.yval) + this.scales.y.offset; |
| 144 | }); |
| 145 | |
| 146 | if (this.force_layout) { |
| 147 | this.force_layout |
| 148 | .nodes(this.model.mark_data) |
| 149 | .force( |
| 150 | 'link', |
| 151 | d3 |
| 152 | .forceLink(this.model.link_data) |
| 153 | .distance(this.model.get('link_distance')) |
| 154 | ); |
| 155 | |
| 156 | if (this.links) { |
| 157 | this.links.data(this.model.link_data); |
| 158 | } |
| 159 | if (this.nodes) { |
| 160 | this.nodes.data(this.force_layout.nodes()); |
| 161 | } |
| 162 | |
| 163 | if (this.nodes && this.links) { |
| 164 | this.tick(); |
| 165 | } |
| 166 | } |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | initialize_additional_scales() { |
| 171 | const colorScale = this.scales.color; |
no test coverage detected