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

Method set_scale

js/src/ColorAxis.ts:125–147  ·  view source on GitHub ↗
(model: ColorScaleModel)

Source from the content-addressed store, hash-verified

123 }
124
125 set_scale(model: ColorScaleModel) {
126 // Sets the child scale
127 const that = this;
128 if (this.axis_scale) {
129 this.axis_scale.remove();
130 }
131 return this.create_child_view(model).then((view) => {
132 // Trigger the displayed event of the child view.
133 that.displayed.then(() => {
134 view.trigger('displayed');
135 });
136 that.axis_scale = view as WidgetView as ColorScale;
137 // TODO: eventually removes what follows
138 if (that.axis_scale.model.type === 'date_color_linear') {
139 that.axis_line_scale = d3.scaleUtc().nice();
140 } else if (that.axis_scale.model.type === 'ordinal') {
141 that.axis_line_scale = d3.scaleBand();
142 that.ordinal = true;
143 } else {
144 that.axis_line_scale = d3.scaleLinear();
145 }
146 });
147 }
148
149 append_axis() {
150 // The label is allocated a space of 100px. If the label

Callers 1

renderMethod · 0.95

Calls 1

removeMethod · 0.45

Tested by

no test coverage detected