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

Method update_style

js/src/Lines.ts:216–274  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

214 }
215
216 update_style(): void {
217 const fill = this.model.get('fill'),
218 fillColor = this.model.get('fill_colors'),
219 fillOpacities = this.model.get('fill_opacities');
220 // update curve colors
221 const curves = this.d3el.selectAll('.curve');
222 curves
223 .select('.line')
224 .style('opacity', this.get_mark_opacity.bind(this))
225 .style('stroke', (d, i) => {
226 return this.get_mark_color(d, i) || fillColor[i];
227 })
228 .style('fill', (d, i) => {
229 return fill === 'inside' ? this.get_fill_color(d, i) : '';
230 })
231 .style('fill-opacity', (d, i) => {
232 return fill === 'inside' ? fillOpacities[i] : '';
233 });
234 curves
235 .select('.area')
236 .style('fill', (d, i) => {
237 return this.get_fill_color(d, i);
238 })
239 .style('opacity', (d, i) => {
240 return fillOpacities[i];
241 });
242 this.update_marker_style();
243 // update legend style
244 if (this.legendEl) {
245 this.legendEl
246 .select('.line')
247 .style('stroke', (d, i) => {
248 return this.get_mark_color(d, i) || fillColor[i];
249 })
250 .style('opacity', this.get_mark_opacity.bind(this))
251 .style('fill', (d, i) => {
252 return this.model.get('fill') === 'none'
253 ? ''
254 : this.get_fill_color(d, i);
255 });
256 this.legendEl
257 .select('.dot')
258 .style('stroke', (d, i) => {
259 return this.get_mark_color(d, i) || fillColor[i];
260 })
261 .style('opacity', this.get_mark_opacity.bind(this))
262 .style('fill', (d, i) => {
263 return this.get_mark_color(d, i) || fillColor[i];
264 });
265 this.legendEl
266 .select('text')
267 .style('fill', (d, i) => {
268 return this.get_mark_color(d, i) || fillColor[i];
269 })
270 .style('opacity', this.get_mark_opacity.bind(this));
271 }
272 this.update_stroke_width(this.model, this.model.get('stroke_width'));
273 this.update_line_style();

Callers 2

drawMethod · 0.95

Calls 5

get_fill_colorMethod · 0.95
update_marker_styleMethod · 0.95
update_stroke_widthMethod · 0.95
update_line_styleMethod · 0.95
get_mark_colorMethod · 0.80

Tested by

no test coverage detected