()
| 433 | } |
| 434 | |
| 435 | rescale_axis() { |
| 436 | // rescale the axis |
| 437 | this.set_axisline_scale_range(); |
| 438 | // shifting the entire g of the color bar first. |
| 439 | this.d3el.attr('transform', this.get_topg_transform()); |
| 440 | const that = this; |
| 441 | const bar_width = this.get_color_bar_width() / this.colors.length; |
| 442 | if (this.ordinal) { |
| 443 | const rectangles = this.d3el |
| 444 | .select('#colorBarG' + this.cid) |
| 445 | .select('.g-rect') |
| 446 | .selectAll('rect') |
| 447 | .attr('width', bar_width); |
| 448 | if (this.vertical) { |
| 449 | rectangles.attr('x', (d, i) => { |
| 450 | return i * bar_width - (that.height - 2 * that.x_offset); |
| 451 | }); |
| 452 | } else { |
| 453 | rectangles.attr('x', (d, i) => { |
| 454 | return i * bar_width; |
| 455 | }); |
| 456 | } |
| 457 | } else { |
| 458 | this.d3el |
| 459 | .select('#colorBarG' + this.cid) |
| 460 | .select('.g-rect') |
| 461 | .selectAll('rect') |
| 462 | .attr('width', this.get_color_bar_width()) |
| 463 | .attr('x', this.vertical ? -(this.height - 2 * this.x_offset) : 0); |
| 464 | } |
| 465 | if ( |
| 466 | this.model.get('label') !== undefined && |
| 467 | this.model.get('label') !== null |
| 468 | ) { |
| 469 | this.d3el |
| 470 | .select('.label_g') |
| 471 | .attr('transform', this.get_label_transform()) |
| 472 | .select('#text_elem') |
| 473 | .style('text-anchor', this.vertical ? 'middle' : 'end'); |
| 474 | } |
| 475 | this.redraw_axisline(); |
| 476 | } |
| 477 | |
| 478 | redraw_axisline() { |
| 479 | if (this.axis) { |
no test coverage detected