| 187 | } |
| 188 | |
| 189 | update_domains() { |
| 190 | const scales = this.getScales(); |
| 191 | |
| 192 | if (scales.x) { |
| 193 | if (!this.get('preserve_domain').x && this.mark_data) { |
| 194 | scales.x.computeAndSetDomain( |
| 195 | this.mark_data.map((elem) => { |
| 196 | return elem.xval; |
| 197 | }), |
| 198 | this.model_id + '_x' |
| 199 | ); |
| 200 | } else { |
| 201 | scales.x.delDomain([], this.model_id + '_x'); |
| 202 | } |
| 203 | } |
| 204 | |
| 205 | if (scales.y) { |
| 206 | if (!this.get('preserve_domain').y && this.mark_data) { |
| 207 | scales.y.computeAndSetDomain( |
| 208 | this.mark_data.map((elem) => { |
| 209 | return elem.yval; |
| 210 | }), |
| 211 | this.model_id + '_y' |
| 212 | ); |
| 213 | } else { |
| 214 | scales.y.delDomain([], this.model_id + '_y'); |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | if (scales.color) { |
| 219 | if (!this.get('preserve_domain').color && this.mark_data) { |
| 220 | scales.color.computeAndSetDomain( |
| 221 | this.mark_data.map((elem) => { |
| 222 | return elem.color; |
| 223 | }), |
| 224 | this.model_id + '_color' |
| 225 | ); |
| 226 | } else { |
| 227 | scales.color.delDomain([], this.model_id + '_color'); |
| 228 | } |
| 229 | } |
| 230 | |
| 231 | if (scales.link_color) { |
| 232 | if (!this.get('preserve_domain').link_color && this.link_data) { |
| 233 | scales.link_color.computeAndSetDomain( |
| 234 | this.link_data.map((elem) => { |
| 235 | return elem.value; |
| 236 | }), |
| 237 | this.model_id + '_link_color' |
| 238 | ); |
| 239 | } else { |
| 240 | scales.link_color.delDomain([], this.model_id + '_link_color'); |
| 241 | } |
| 242 | } |
| 243 | } |
| 244 | |
| 245 | static serializers = { |
| 246 | ...MarkModel.serializers, |