source: node_modules/victory-vendor/lib-vendor/d3-scale/src/symlog.js

Last change on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 6 months ago

Added visualizations

  • Property mode set to 100644
File size: 1006 bytes
Line 
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = symlog;
7exports.symlogish = symlogish;
8var _linear = require("./linear.js");
9var _continuous = require("./continuous.js");
10var _init = require("./init.js");
11function transformSymlog(c) {
12 return function (x) {
13 return Math.sign(x) * Math.log1p(Math.abs(x / c));
14 };
15}
16function transformSymexp(c) {
17 return function (x) {
18 return Math.sign(x) * Math.expm1(Math.abs(x)) * c;
19 };
20}
21function symlogish(transform) {
22 var c = 1,
23 scale = transform(transformSymlog(c), transformSymexp(c));
24 scale.constant = function (_) {
25 return arguments.length ? transform(transformSymlog(c = +_), transformSymexp(c)) : c;
26 };
27 return (0, _linear.linearish)(scale);
28}
29function symlog() {
30 var scale = symlogish((0, _continuous.transformer)());
31 scale.copy = function () {
32 return (0, _continuous.copy)(scale, symlog()).constant(scale.constant());
33 };
34 return _init.initRange.apply(scale, arguments);
35}
Note: See TracBrowser for help on using the repository browser.