MCPcopy
hub / github.com/plotly/plotly.js / aroFromParams

Function aroFromParams

test/jasmine/assets/domain_ref_components.js:168–211  ·  view source on GitHub ↗
(arotype, x0, y0, xref, yref, color, opts)

Source from the content-addressed store, hash-verified

166// images take xsize, ysize, xanchor, yanchor (sizing is set to stretch for simplicity
167// in computing the bounding box and source is something predetermined)
168function aroFromParams(arotype, x0, y0, xref, yref, color, opts) {
169 // fill with common values
170 var aro = {
171 xref: xref,
172 yref: yref
173 };
174 switch(arotype) {
175 case 'shape':
176 aro.x0 = x0;
177 aro.y0 = y0;
178 aro.x1 = opts.x1;
179 aro.y1 = opts.y1;
180 aro.type = opts.type;
181 aro.line = {
182 color: color
183 };
184 break;
185 case 'annotation':
186 aro.x = x0;
187 aro.y = y0;
188 aro.text = 'A';
189 aro.ax = opts.ax;
190 aro.ay = opts.ay;
191 aro.axref = opts.axref;
192 aro.ayref = opts.ayref;
193 aro.showarrow = true;
194 aro.arrowhead = 0;
195 aro.arrowcolor = color;
196 break;
197 case 'image':
198 aro.x = x0;
199 aro.y = y0;
200 aro.sizex = opts.sizex;
201 aro.sizey = opts.sizey;
202 aro.xanchor = opts.xanchor;
203 aro.yanchor = opts.yanchor;
204 aro.sizing = 'stretch';
205 aro.source = testImage;
206 break;
207 default:
208 throw 'Bad arotype: ' + arotype;
209 }
210 return aro;
211}
212
213// Calculate the ax value of an annotation given a particular desired scaling K
214// This also works with log axes by taking logs of each part of the sum, so that

Callers 1

annotationTestFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…