@emerson-eps/color-tables 0.2.18 → 0.2.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/component/Legend/ColorLegend.js +10 -7
- package/dist/component/Legend/ColorLegend.js.map +1 -1
- package/dist/component/Legend/ContinuousLegend.js +0 -2
- package/dist/component/Legend/ContinuousLegend.js.map +1 -1
- package/dist/component/Utils/legendCommonFunction.d.ts +3 -2
- package/dist/component/Utils/legendCommonFunction.js +49 -24
- package/dist/component/Utils/legendCommonFunction.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { DiscreteColorLegend } from "./DiscreteLegend";
|
|
3
3
|
import { ContinuousLegend } from "./ContinuousLegend";
|
|
4
|
-
import { useCallback } from "react";
|
|
4
|
+
import { useCallback, useRef } from "react";
|
|
5
5
|
import { ColorSelectorAccordion } from "../ColorSelector/ColorSelectorAccordion";
|
|
6
6
|
import { d3ColorScales } from "../Utils/d3ColorScale";
|
|
7
7
|
// Todo: Adapt it for other layers too
|
|
8
8
|
export var ColorLegend = function (_a) {
|
|
9
9
|
var position = _a.position, horizontal = _a.horizontal, colorTables = _a.colorTables, min = _a.min, max = _a.max, dataObjectName = _a.dataObjectName, colorName = _a.colorName, discreteData = _a.discreteData, getColorMapname = _a.getColorMapname;
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
var divRef = useRef(null);
|
|
11
|
+
var _b = React.useState(false), isOpen = _b[0], setIsOpen = _b[1];
|
|
12
|
+
var toggleColorSelector = useCallback(function () {
|
|
13
|
+
if (divRef && divRef.current) {
|
|
14
|
+
isOpen ? setIsOpen(false) : setIsOpen(true);
|
|
15
|
+
}
|
|
16
|
+
}, [isOpen]);
|
|
14
17
|
var _c = React.useState([]), updateLegend = _c[0], setUpdateLegendColor = _c[1];
|
|
15
18
|
var isColortableColors = colorTables.find(function (value) {
|
|
16
19
|
return (value === null || value === void 0 ? void 0 : value.name) == colorName;
|
|
@@ -34,9 +37,9 @@ export var ColorLegend = function (_a) {
|
|
|
34
37
|
setIsCont(value);
|
|
35
38
|
}, []);
|
|
36
39
|
return (React.createElement("div", null,
|
|
37
|
-
React.createElement("div", { onClick:
|
|
40
|
+
React.createElement("div", { ref: divRef, onClick: toggleColorSelector },
|
|
38
41
|
isCont == true && (React.createElement(ContinuousLegend, { min: min, max: max, dataObjectName: dataObjectName, position: position, colorName: colorName, colorTables: colorTables, horizontal: horizontal, updateLegend: updateLegend })),
|
|
39
42
|
isCont == false && (React.createElement(DiscreteColorLegend, { discreteData: discreteData, dataObjectName: dataObjectName, position: position, colorName: colorName, colorTables: colorTables, horizontal: horizontal, updateLegend: updateLegend }))),
|
|
40
|
-
React.createElement("div", null,
|
|
43
|
+
React.createElement("div", null, isOpen && (React.createElement(ColorSelectorAccordion, { newColorScaleData: getSelectedColorScale, isHorizontal: horizontal })))));
|
|
41
44
|
};
|
|
42
45
|
//# sourceMappingURL=ColorLegend.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorLegend.js","sourceRoot":"","sources":["../../../src/component/Legend/ColorLegend.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,
|
|
1
|
+
{"version":3,"file":"ColorLegend.js","sourceRoot":"","sources":["../../../src/component/Legend/ColorLegend.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAA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EAAE,EAAE,CAAC;CACpB,CAAC"}
|
|
@@ -10,13 +10,14 @@ export declare function RGBToHex(rgb: number[]): {
|
|
|
10
10
|
color: string;
|
|
11
11
|
offset: number;
|
|
12
12
|
};
|
|
13
|
-
export declare function
|
|
13
|
+
export declare function getColors(colorName: string, colorTables: any, point: number): any;
|
|
14
|
+
export declare function sampledColor(colorScaleName: string, point: number, categorial?: boolean, min?: number, max?: number): number[] | {
|
|
14
15
|
r: number;
|
|
15
16
|
g: number;
|
|
16
17
|
b: number;
|
|
17
18
|
opacity: number;
|
|
18
19
|
} | undefined;
|
|
19
|
-
export declare function
|
|
20
|
+
export declare function createColorMapFunction(colorScaleName: string): (x: number, categorial: boolean, min: number, max: number) => number[] | {
|
|
20
21
|
r: number;
|
|
21
22
|
g: number;
|
|
22
23
|
b: number;
|
|
@@ -51,28 +51,49 @@ export function RGBToHex(rgb) {
|
|
|
51
51
|
var offset = rgb[0] * 100.0;
|
|
52
52
|
return { color: "#" + r + g + b, offset: offset };
|
|
53
53
|
}
|
|
54
|
-
export function
|
|
54
|
+
export function getColors(colorName, colorTables, point) {
|
|
55
|
+
var colorTableData = colorTables.filter(function (value) {
|
|
56
|
+
return value.name.toLowerCase() == colorName.toLowerCase();
|
|
57
|
+
});
|
|
58
|
+
var colorArrays = colorTableData.find(function (value) {
|
|
59
|
+
return value[0] == point;
|
|
60
|
+
});
|
|
61
|
+
return colorTableData.length > 0 ? colorArrays : [];
|
|
62
|
+
}
|
|
63
|
+
export function sampledColor(colorScaleName, point, categorial, min, max) {
|
|
55
64
|
var _a, _b;
|
|
56
|
-
// colortable
|
|
57
|
-
var
|
|
65
|
+
// get colortable colorscale data
|
|
66
|
+
var getColorTableScale = colorTables.find(function (value) {
|
|
58
67
|
return value.name == colorScaleName;
|
|
59
68
|
});
|
|
60
|
-
// d3
|
|
61
|
-
var
|
|
69
|
+
// get d3 colorscale data
|
|
70
|
+
var getD3Scale = d3ColorScales.find(function (value) {
|
|
62
71
|
return value.name == colorScaleName;
|
|
63
72
|
});
|
|
64
73
|
var rgb = rgbValues(point, colorScaleName, colorTables);
|
|
65
74
|
// colortable continuous scale
|
|
66
|
-
if ((
|
|
67
|
-
|
|
75
|
+
if ((getColorTableScale === null || getColorTableScale === void 0 ? void 0 : getColorTableScale.discrete) == false) {
|
|
76
|
+
// if log is discrete, then need to normalize
|
|
77
|
+
if (categorial && min && max) {
|
|
78
|
+
var normalizedPoint = (point - min) / (max - min);
|
|
79
|
+
rgb = rgbValues(normalizedPoint, colorScaleName, colorTables);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
rgb = rgbValues(point, colorScaleName, colorTables);
|
|
83
|
+
}
|
|
68
84
|
}
|
|
69
85
|
// d3 continuous scale
|
|
70
|
-
if (typeof (
|
|
71
|
-
var colorMappingRange =
|
|
86
|
+
if (typeof (getD3Scale === null || getD3Scale === void 0 ? void 0 : getD3Scale.colors) == "function") {
|
|
87
|
+
var colorMappingRange = getD3Scale === null || getD3Scale === void 0 ? void 0 : getD3Scale.colors(point);
|
|
88
|
+
// if log is discrete, then need to normalize
|
|
89
|
+
if (categorial && min && max) {
|
|
90
|
+
var normalizedPoint = (point - min) / (max - min);
|
|
91
|
+
colorMappingRange = (getD3Scale === null || getD3Scale === void 0 ? void 0 : getD3Scale.discrete) == true ? getD3Scale === null || getD3Scale === void 0 ? void 0 : getD3Scale.colors(point) : getD3Scale === null || getD3Scale === void 0 ? void 0 : getD3Scale.colors(normalizedPoint);
|
|
92
|
+
}
|
|
72
93
|
rgb = (_a = color(colorMappingRange)) === null || _a === void 0 ? void 0 : _a.rgb();
|
|
73
94
|
}
|
|
74
95
|
// colortable discrete scale
|
|
75
|
-
if ((
|
|
96
|
+
if ((getColorTableScale === null || getColorTableScale === void 0 ? void 0 : getColorTableScale.discrete) == true) {
|
|
76
97
|
if (categorial) {
|
|
77
98
|
// compare the code and first value from colorsArray(colortable)
|
|
78
99
|
var arrayOfColors = colorsArray(colorScaleName, colorTables);
|
|
@@ -82,10 +103,10 @@ export function sampledColor(colorScaleName, point, categorial) {
|
|
|
82
103
|
rgb = colorArrays;
|
|
83
104
|
}
|
|
84
105
|
else {
|
|
85
|
-
var getSelectedScaleLength =
|
|
106
|
+
var getSelectedScaleLength = getColorTableScale === null || getColorTableScale === void 0 ? void 0 : getColorTableScale.colors.length;
|
|
86
107
|
var minValue_1 = 0;
|
|
87
108
|
var maxValue_1 = getSelectedScaleLength - 1;
|
|
88
|
-
|
|
109
|
+
getColorTableScale === null || getColorTableScale === void 0 ? void 0 : getColorTableScale.colors.forEach(function (item, index) {
|
|
89
110
|
var _a, _b, _c;
|
|
90
111
|
var currentIndex = index;
|
|
91
112
|
var normalizedCurrentIndex = (currentIndex - minValue_1) / (maxValue_1 - minValue_1);
|
|
@@ -94,9 +115,9 @@ export function sampledColor(colorScaleName, point, categorial) {
|
|
|
94
115
|
//const t = (point - t0) / (t1 - t0); // t = 0.0 gives first color, t = 1.0 gives second color.
|
|
95
116
|
if (point >= normalizedCurrentIndex &&
|
|
96
117
|
point <= normalizedNextIndex) {
|
|
97
|
-
if ((item && (
|
|
118
|
+
if ((item && (getColorTableScale === null || getColorTableScale === void 0 ? void 0 : getColorTableScale.colors[nextIndex])) !=
|
|
98
119
|
undefined) {
|
|
99
|
-
var interpolate = interpolateRgb((_a = RGBToHex(item)) === null || _a === void 0 ? void 0 : _a.color, (_b = RGBToHex(
|
|
120
|
+
var interpolate = interpolateRgb((_a = RGBToHex(item)) === null || _a === void 0 ? void 0 : _a.color, (_b = RGBToHex(getColorTableScale === null || getColorTableScale === void 0 ? void 0 : getColorTableScale.colors[nextIndex])) === null || _b === void 0 ? void 0 : _b.color)(point);
|
|
100
121
|
rgb = (_c = color(interpolate)) === null || _c === void 0 ? void 0 : _c.rgb();
|
|
101
122
|
}
|
|
102
123
|
}
|
|
@@ -104,16 +125,20 @@ export function sampledColor(colorScaleName, point, categorial) {
|
|
|
104
125
|
}
|
|
105
126
|
}
|
|
106
127
|
// d3 discrete scale
|
|
107
|
-
if (typeof (
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
128
|
+
if (typeof (getD3Scale === null || getD3Scale === void 0 ? void 0 : getD3Scale.colors) == "object") {
|
|
129
|
+
// discrete log
|
|
130
|
+
if (categorial && min && max) {
|
|
131
|
+
var normalizedPoint = (point - min) / (max - min);
|
|
132
|
+
var code_1 = (getD3Scale === null || getD3Scale === void 0 ? void 0 : getD3Scale.discrete) == true ? point : normalizedPoint;
|
|
133
|
+
var d3ColorArrays = getD3Scale === null || getD3Scale === void 0 ? void 0 : getD3Scale.colors.find(function (_value, index) {
|
|
134
|
+
return index == code_1;
|
|
111
135
|
});
|
|
112
136
|
rgb = (_b = color(d3ColorArrays)) === null || _b === void 0 ? void 0 : _b.rgb();
|
|
113
137
|
}
|
|
138
|
+
// continous log
|
|
114
139
|
else {
|
|
115
|
-
var max_1 = (
|
|
116
|
-
|
|
140
|
+
var max_1 = (getD3Scale === null || getD3Scale === void 0 ? void 0 : getD3Scale.colors.length) - 1;
|
|
141
|
+
getD3Scale === null || getD3Scale === void 0 ? void 0 : getD3Scale.colors.forEach(function (item, index) {
|
|
117
142
|
var _a;
|
|
118
143
|
var currentIndex = index;
|
|
119
144
|
var normalizedCurrentIndex = (currentIndex - 0) / (max_1 - 0);
|
|
@@ -122,7 +147,7 @@ export function sampledColor(colorScaleName, point, categorial) {
|
|
|
122
147
|
//const t = (point - t0) / (t1 - t0); // t = 0.0 gives first color, t = 1.0 gives second color.
|
|
123
148
|
if (point >= normalizedCurrentIndex &&
|
|
124
149
|
point <= normalizedNextIndex) {
|
|
125
|
-
var interpolate = interpolateRgb(item,
|
|
150
|
+
var interpolate = interpolateRgb(item, getD3Scale[nextIndex])(point);
|
|
126
151
|
rgb = (_a = color(interpolate)) === null || _a === void 0 ? void 0 : _a.rgb();
|
|
127
152
|
}
|
|
128
153
|
});
|
|
@@ -130,9 +155,9 @@ export function sampledColor(colorScaleName, point, categorial) {
|
|
|
130
155
|
}
|
|
131
156
|
return rgb;
|
|
132
157
|
}
|
|
133
|
-
export function
|
|
134
|
-
return function (x, categorial) {
|
|
135
|
-
return sampledColor(colorScaleName, x, categorial);
|
|
158
|
+
export function createColorMapFunction(colorScaleName) {
|
|
159
|
+
return function (x, categorial, min, max) {
|
|
160
|
+
return sampledColor(colorScaleName, x, categorial, min, max);
|
|
136
161
|
};
|
|
137
162
|
}
|
|
138
163
|
//# sourceMappingURL=legendCommonFunction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legendCommonFunction.js","sourceRoot":"","sources":["../../../src/component/Utils/legendCommonFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAKhD,OAAO,WAAW,MAAM,mCAAmC,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,0EAA0E;AAC1E,MAAM,UAAU,WAAW,CACvB,SAAiB,EACjB,WAAgB;IAEhB,IAAM,cAAc,GAAG,WAAW,CAAC,MAAM,CACrC,UAAC,KAAqB;QAClB,OAAA,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,SAAS,CAAC,WAAW,EAAE;IAAnD,CAAmD,CAC1D,CAAC;IACF,OAAO,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;AACrE,CAAC;AAED,uCAAuC;AACvC,MAAM,UAAU,SAAS,CACrB,KAAa,EACb,SAAiB,EACjB,WAAmC;;IAEnC,IAAM,gBAAgB,GAAG,WAAW,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IAC7D,0DAA0D;IAC1D,IAAM,WAAW,GAAG,gBAAgB,CAAC,IAAI,CACrC,UAAC,KAAuC;QACpC,OAAO,KAAK,IAAI,KAAK,CAAC,C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EAAE,CAAC,EAAE,UAAU,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IACjE,CAAC,CAAC;AACN,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ColorSelectorAccordion } from './component/ColorSelector/ColorSelectorAccordion';
|
|
2
2
|
import { ColorLegend } from './component/Legend/ColorLegend';
|
|
3
|
-
import { colorsArray, rgbValues, RGBToHex } from './component/Utils/legendCommonFunction';
|
|
3
|
+
import { colorsArray, rgbValues, RGBToHex, createColorMapFunction, getColors } from './component/Utils/legendCommonFunction';
|
|
4
4
|
import { d3ColorScales } from './component/Utils/d3ColorScale';
|
|
5
5
|
import { colorTablesObj, colorTablesArray } from './component/colorTableTypes';
|
|
6
6
|
import { ContinuousLegend } from './component/Legend/ContinuousLegend';
|
|
7
7
|
import { DiscreteColorLegend } from './component/Legend/DiscreteLegend';
|
|
8
8
|
import * as colorTables from './component/color-tables.json';
|
|
9
|
-
export { ColorSelectorAccordion, ContinuousLegend, DiscreteColorLegend, ColorLegend, colorsArray, rgbValues, RGBToHex, d3ColorScales, colorTablesObj, colorTablesArray, colorTables, };
|
|
9
|
+
export { ColorSelectorAccordion, ContinuousLegend, DiscreteColorLegend, ColorLegend, colorsArray, rgbValues, RGBToHex, createColorMapFunction, getColors, d3ColorScales, colorTablesObj, colorTablesArray, colorTables, };
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ColorSelectorAccordion } from './component/ColorSelector/ColorSelectorAccordion';
|
|
2
2
|
import { ColorLegend } from './component/Legend/ColorLegend';
|
|
3
|
-
import { colorsArray, rgbValues, RGBToHex } from './component/Utils/legendCommonFunction';
|
|
3
|
+
import { colorsArray, rgbValues, RGBToHex, createColorMapFunction, getColors } from './component/Utils/legendCommonFunction';
|
|
4
4
|
import { d3ColorScales } from './component/Utils/d3ColorScale';
|
|
5
5
|
import { ContinuousLegend } from './component/Legend/ContinuousLegend';
|
|
6
6
|
import { DiscreteColorLegend } from './component/Legend/DiscreteLegend';
|
|
7
7
|
import * as colorTables from './component/color-tables.json';
|
|
8
|
-
export { ColorSelectorAccordion, ContinuousLegend, DiscreteColorLegend, ColorLegend, colorsArray, rgbValues, RGBToHex, d3ColorScales, colorTables, };
|
|
8
|
+
export { ColorSelectorAccordion, ContinuousLegend, DiscreteColorLegend, ColorLegend, colorsArray, rgbValues, RGBToHex, createColorMapFunction, getColors, d3ColorScales, colorTables, };
|
|
9
9
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,kDAAkD,CAAC;AAC1F,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,kDAAkD,CAAC;AAC1F,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,sBAAsB,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AAC7H,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAE/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,KAAK,WAAW,MAAM,+BAA+B,CAAC;AAE7D,OAAO,EACH,sBAAsB,EACtB,gBAAgB,EAChB,mBAAmB,EACnB,WAAW,EACX,WAAW,EACX,SAAS,EACT,QAAQ,EACR,sBAAsB,EACtB,SAAS,EACT,aAAa,EAGb,WAAW,GACd,CAAC"}
|