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

Method update_colors

js/src/Scatter.ts:50–87  ·  view source on GitHub ↗
(model, new_colors)

Source from the content-addressed store, hash-verified

48 }
49
50 update_colors(model, new_colors) {
51 if (!this.model.dirty) {
52 const stroke = this.model.get('stroke');
53 const len = new_colors.length;
54 this.d3el
55 .selectAll('.dot')
56 .style(
57 'fill',
58 this.model.get('fill') ? this.get_mark_color.bind(this) : 'none'
59 )
60 .style('stroke', stroke ? stroke : this.get_mark_color.bind(this));
61
62 if (this.legend_el) {
63 this.legend_el
64 .select('path')
65 .style('fill', (d, i) => {
66 return new_colors[i % len];
67 })
68 .style(
69 'stroke',
70 stroke
71 ? stroke
72 : (d, i) => {
73 return new_colors[i % len];
74 }
75 );
76 this.legend_el.select('text').style(
77 'fill',
78 this.model.get('fill')
79 ? (d, i) => {
80 return new_colors[i % len];
81 }
82 : 'none'
83 );
84 }
85 }
86 this.apply_styles();
87 }
88
89 update_fill(model, fill) {
90 const colors = this.model.get('colors');

Callers

nothing calls this directly

Calls 1

apply_stylesMethod · 0.45

Tested by

no test coverage detected