()
| 226 | } |
| 227 | |
| 228 | update_domains() { |
| 229 | if (!this.mark_data) { |
| 230 | return; |
| 231 | } |
| 232 | const scales = this.getScales(); |
| 233 | const dom_scale = scales.x; |
| 234 | const range_scale = scales.y; |
| 235 | |
| 236 | if (!this.get('preserve_domain').x) { |
| 237 | dom_scale.computeAndSetDomain( |
| 238 | this.mark_data.map((elem) => { |
| 239 | return elem.key; |
| 240 | }), |
| 241 | this.model_id + '_x' |
| 242 | ); |
| 243 | } else { |
| 244 | dom_scale.delDomain([], this.model_id + '_x'); |
| 245 | } |
| 246 | |
| 247 | if (!this.get('preserve_domain').y) { |
| 248 | if (this.get('type') === 'stacked') { |
| 249 | range_scale.computeAndSetDomain( |
| 250 | [ |
| 251 | d3.min(this.mark_data, (c: any) => { |
| 252 | return c.negMax; |
| 253 | }), |
| 254 | d3.max(this.mark_data, (c: any) => { |
| 255 | return c.posMax; |
| 256 | }), |
| 257 | this.baseValue, |
| 258 | ], |
| 259 | this.model_id + '_y' |
| 260 | ); |
| 261 | } else { |
| 262 | const min = d3.min(this.mark_data, (c: any) => { |
| 263 | return d3.min(c.values, (val: any) => { |
| 264 | return val.yRef; |
| 265 | }); |
| 266 | }); |
| 267 | const max = d3.max(this.mark_data, (c: any) => { |
| 268 | return d3.max(c.values, (val: any) => { |
| 269 | return val.yRef; |
| 270 | }); |
| 271 | }); |
| 272 | range_scale.computeAndSetDomain( |
| 273 | [min, max, this.baseValue], |
| 274 | this.model_id + '_y' |
| 275 | ); |
| 276 | } |
| 277 | } else { |
| 278 | range_scale.delDomain([], this.model_id + '_y'); |
| 279 | } |
| 280 | } |
| 281 | |
| 282 | static serializers = { |
| 283 | ...MarkModel.serializers, |
no test coverage detected