(key, opts)
| 2316 | |
| 2317 | // explicit, never re-ranged (is this actually true? for x and y) |
| 2318 | function setScale(key, opts) { |
| 2319 | let sc = scales[key]; |
| 2320 | |
| 2321 | if (sc.from == null) { |
| 2322 | if (dataLen == 0) { |
| 2323 | let minMax = sc.range(self, opts.min, opts.max, key); |
| 2324 | opts.min = minMax[0]; |
| 2325 | opts.max = minMax[1]; |
| 2326 | } |
| 2327 | |
| 2328 | if (opts.min > opts.max) { |
| 2329 | let _min = opts.min; |
| 2330 | opts.min = opts.max; |
| 2331 | opts.max = _min; |
| 2332 | } |
| 2333 | |
| 2334 | if (dataLen > 1 && opts.min != null && opts.max != null && opts.max - opts.min < 1e-16) |
| 2335 | return; |
| 2336 | |
| 2337 | if (key == xScaleKey) { |
| 2338 | if (sc.distr == 2 && dataLen > 0) { |
| 2339 | opts.min = closestIdx(opts.min, data[0]); |
| 2340 | opts.max = closestIdx(opts.max, data[0]); |
| 2341 | |
| 2342 | if (opts.min == opts.max) |
| 2343 | opts.max++; |
| 2344 | } |
| 2345 | } |
| 2346 | |
| 2347 | // log("setScale()", arguments); |
| 2348 | |
| 2349 | pendScales[key] = opts; |
| 2350 | |
| 2351 | shouldSetScales = true; |
| 2352 | commit(); |
| 2353 | } |
| 2354 | } |
| 2355 | |
| 2356 | self.setScale = setScale; |
| 2357 |
no test coverage detected
searching dependent graphs…