source: node_modules/recharts/lib/util/scale/CartesianScaleHelper.js@ a762898

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

Added visualizations

  • Property mode set to 100644
File size: 2.0 KB
RevLine 
[a762898]1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.CartesianScaleHelperImpl = void 0;
7/**
8 * Groups X and Y scale functions together and provides helper methods.
9 */
10class CartesianScaleHelperImpl {
11 constructor(_ref) {
12 var {
13 x,
14 y
15 } = _ref;
16 this.xAxisScale = x;
17 this.yAxisScale = y;
18 }
19 map(value, _ref2) {
20 var _this$xAxisScale$map, _this$yAxisScale$map;
21 var {
22 position
23 } = _ref2;
24 return {
25 x: (_this$xAxisScale$map = this.xAxisScale.map(value.x, {
26 position
27 })) !== null && _this$xAxisScale$map !== void 0 ? _this$xAxisScale$map : 0,
28 y: (_this$yAxisScale$map = this.yAxisScale.map(value.y, {
29 position
30 })) !== null && _this$yAxisScale$map !== void 0 ? _this$yAxisScale$map : 0
31 };
32 }
33 mapWithFallback(value, _ref3) {
34 var _this$xAxisScale$map2, _this$yAxisScale$map2;
35 var {
36 position,
37 fallback
38 } = _ref3;
39 var fallbackY, fallbackX;
40 if (fallback === 'rangeMin') {
41 fallbackY = this.yAxisScale.rangeMin();
42 } else if (fallback === 'rangeMax') {
43 fallbackY = this.yAxisScale.rangeMax();
44 } else {
45 fallbackY = 0;
46 }
47 if (fallback === 'rangeMin') {
48 fallbackX = this.xAxisScale.rangeMin();
49 } else if (fallback === 'rangeMax') {
50 fallbackX = this.xAxisScale.rangeMax();
51 } else {
52 fallbackX = 0;
53 }
54 return {
55 x: (_this$xAxisScale$map2 = this.xAxisScale.map(value.x, {
56 position
57 })) !== null && _this$xAxisScale$map2 !== void 0 ? _this$xAxisScale$map2 : fallbackX,
58 y: (_this$yAxisScale$map2 = this.yAxisScale.map(value.y, {
59 position
60 })) !== null && _this$yAxisScale$map2 !== void 0 ? _this$yAxisScale$map2 : fallbackY
61 };
62 }
63 isInRange(_ref4) {
64 var {
65 x,
66 y
67 } = _ref4;
68 var xInRange = x == null || this.xAxisScale.isInRange(x);
69 var yInRange = y == null || this.yAxisScale.isInRange(y);
70 return xInRange && yInRange;
71 }
72}
73exports.CartesianScaleHelperImpl = CartesianScaleHelperImpl;
Note: See TracBrowser for help on using the repository browser.