MCPcopy Create free account
hub / github.com/bqplot/bqplot / update_domains

Method update_domains

js/src/LinesModel.ts:158–204  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

156 }
157
158 update_domains() {
159 if (!this.mark_data) {
160 return;
161 }
162 const scales = this.getScales();
163 const x_scale = scales.x,
164 y_scale = scales.y;
165 const color_scale = scales.color;
166
167 if (!this.get('preserve_domain').x) {
168 x_scale.computeAndSetDomain(
169 this.mark_data.map((elem) => {
170 return elem.values.map((d) => {
171 return d.x;
172 });
173 }),
174 this.model_id + '_x'
175 );
176 } else {
177 x_scale.delDomain([], this.model_id + '_x');
178 }
179
180 if (!this.get('preserve_domain').y) {
181 y_scale.computeAndSetDomain(
182 this.mark_data.map((elem) => {
183 return elem.values.map((d) => {
184 return d.y;
185 });
186 }),
187 this.model_id + '_y'
188 );
189 } else {
190 y_scale.delDomain([], this.model_id + '_y');
191 }
192 if (color_scale !== null && color_scale !== undefined) {
193 if (!this.get('preserve_domain').color) {
194 color_scale.computeAndSetDomain(
195 this.mark_data.map((elem) => {
196 return elem.color;
197 }),
198 this.model_id + '_color'
199 );
200 } else {
201 color_scale.delDomain([], this.model_id + '_color');
202 }
203 }
204 }
205
206 get_data_dict(data, index) {
207 return data;

Callers 2

initializeMethod · 0.95
update_dataMethod · 0.95

Calls 1

getScalesMethod · 0.45

Tested by

no test coverage detected