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

Method append_axis

js/src/ColorAxis.ts:149–208  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

147 }
148
149 append_axis() {
150 // The label is allocated a space of 100px. If the label
151 // occupies more than 100px then you are out of luck.
152 if (
153 this.model.get('label') !== undefined &&
154 this.model.get('label') !== null
155 ) {
156 this.d3el
157 .append('g')
158 .attr('transform', this.get_label_transform())
159 .attr('class', 'axis label_g')
160 .append('text')
161 .append('tspan')
162 .attr('id', 'text_elem')
163 .attr('dy', '0.5ex')
164 .attr('class', 'axislabel')
165 .style('text-anchor', this.vertical ? 'middle' : 'end')
166 .text(this.model.get('label'));
167 }
168 const colorBar = this.d3el.append('g').attr('id', 'colorBarG' + this.cid);
169
170 this.draw_color_bar();
171 this.set_axisline_domain();
172
173 this.g_axisline = colorBar.append('g').attr('class', 'axis');
174
175 if (this.vertical) {
176 this.axis =
177 this.side === 'right'
178 ? d3.axisRight(
179 this.axis_scale.scale as d3.ScaleLinear<
180 any,
181 any
182 > as d3.AxisScale<d3.AxisDomain>
183 )
184 : d3.axisLeft(
185 this.axis_scale.scale as d3.ScaleLinear<
186 any,
187 any
188 > as d3.AxisScale<d3.AxisDomain>
189 );
190 } else {
191 this.axis =
192 this.side === 'top'
193 ? d3.axisTop(
194 this.axis_scale.scale as d3.ScaleLinear<
195 any,
196 any
197 > as d3.AxisScale<d3.AxisDomain>
198 )
199 : d3.axisBottom(
200 this.axis_scale.scale as d3.ScaleLinear<
201 any,
202 any
203 > as d3.AxisScale<d3.AxisDomain>
204 );
205 }
206 this.axis = this.axis.tickFormat(this.tick_format);

Callers 1

renderMethod · 0.95

Calls 4

get_label_transformMethod · 0.95
draw_color_barMethod · 0.95
set_axisline_domainMethod · 0.95
redraw_axislineMethod · 0.95

Tested by

no test coverage detected