MCPcopy Index your code
hub / github.com/bqplot/bqplot / relayoutImpl

Method relayoutImpl

js/src/Figure.ts:935–1033  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

933 }
934
935 relayoutImpl() {
936 this.relayoutRequested = false; // reset relayout request
937 const figureSize = this.getFigureSize();
938
939 if (
940 (this.width == figureSize.width &&
941 this.height == figureSize.height &&
942 !this.should_relayout) ||
943 !this.visible
944 ) {
945 // Bypass relayout
946 return;
947 }
948 this.should_relayout = false;
949
950 this.width = figureSize.width;
951 this.height = figureSize.height;
952 this.offsetX = figureSize.x;
953 this.offsetY = figureSize.y;
954
955 // we hide it when the plot area is too small
956 if (this.plotareaWidth < 1 || this.plotareaHeight < 1) {
957 this.el.style.visibility = 'hidden';
958 return; // no need to continue setting properties, which can only produce errors in the js console
959 } else {
960 this.el.style.visibility = '';
961 }
962
963 if (this.scale_x !== undefined && this.scale_x !== null) {
964 this.scale_x.setRange([0, this.plotareaWidth]);
965 }
966
967 if (this.scale_y !== undefined && this.scale_y !== null) {
968 this.scale_y.setRange([this.plotareaHeight, 0]);
969 }
970
971 // transform figure
972 if (this.autoLayout) {
973 this.fig.attr('transform', `translate(${figureSize.x}, ${figureSize.y})`);
974 this.fig_background.attr(
975 'transform',
976 `translate(${figureSize.x}, ${figureSize.y})`
977 );
978
979 this.webGLCanvas.style.left = `${figureSize.x}px`;
980 this.webGLCanvas.style.top = `${figureSize.y}px`;
981
982 applyAttrs(this.title, {
983 x: 0.5 * this.width,
984 y: 0,
985 dy: '0em',
986 });
987
988 this.toolbar_div.node().style.top = `${this.offsetY / 2.0}px`;
989 this.toolbar_div.node().style.right = `${this.offsetX}px`;
990 } else {
991 this.fig.attr(
992 'transform',

Callers

nothing calls this directly

Calls 3

getFigureSizeMethod · 0.95
update_legendMethod · 0.95
applyAttrsFunction · 0.90

Tested by

no test coverage detected