@emerson-eps/color-tables 0.2.4 → 0.2.7
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/.vscode/settings.json +3 -0
- package/dist/component/ColorSelector/ColorSelectorAccordion.js +3 -3
- package/dist/component/ColorSelector/ColorSelectorAccordion.js.map +1 -1
- package/dist/component/ColorSelector/ColorSelectorComponent.js +51 -45
- package/dist/component/ColorSelector/ColorSelectorComponent.js.map +1 -1
- package/dist/component/ColorSelector/ColorSelectorWrapper.js +21 -20
- package/dist/component/ColorSelector/ColorSelectorWrapper.js.map +1 -1
- package/dist/component/ColorTableTypes.d.ts +2 -2
- package/dist/component/Legend/ColorLegend.d.ts +4 -1
- package/dist/component/Legend/ColorLegend.js +16 -7
- package/dist/component/Legend/ColorLegend.js.map +1 -1
- package/dist/component/Legend/ContinuousLegend.d.ts +2 -2
- package/dist/component/Legend/ContinuousLegend.js +188 -153
- package/dist/component/Legend/ContinuousLegend.js.map +1 -1
- package/dist/component/Legend/DiscreteLegend.d.ts +2 -2
- package/dist/component/Legend/DiscreteLegend.js +162 -116
- package/dist/component/Legend/DiscreteLegend.js.map +1 -1
- package/dist/component/Utils/continousLegend.js +14 -12
- package/dist/component/Utils/continousLegend.js.map +1 -1
- package/dist/component/Utils/d3ColorScale.js +1 -1
- package/dist/component/Utils/d3ColorScale.js.map +1 -1
- package/dist/component/Utils/discreteLegend.d.ts +3 -3
- package/dist/component/Utils/discreteLegend.js +121 -64
- package/dist/component/Utils/discreteLegend.js.map +1 -1
- package/dist/stories/ColorLegends/ColorSelector/Selector.stories.js +2 -2
- package/dist/stories/ColorLegends/ColorSelector/Selector.stories.js.map +1 -1
- package/dist/stories/ColorLegends/ContinousLegends/MD.stories.js +27 -16
- package/dist/stories/ColorLegends/ContinousLegends/MD.stories.js.map +1 -1
- package/dist/stories/ColorLegends/ContinousLegends/NTG.stories.js +27 -16
- package/dist/stories/ColorLegends/ContinousLegends/NTG.stories.js.map +1 -1
- package/dist/stories/ColorLegends/ContinousLegends/PermTot.stories.js +27 -16
- package/dist/stories/ColorLegends/ContinousLegends/PermTot.stories.js.map +1 -1
- package/dist/stories/ColorLegends/ContinousLegends/Permeability.stories.js +27 -16
- package/dist/stories/ColorLegends/ContinousLegends/Permeability.stories.js.map +1 -1
- package/dist/stories/ColorLegends/ContinousLegends/PoroTot.stories.js +27 -16
- package/dist/stories/ColorLegends/ContinousLegends/PoroTot.stories.js.map +1 -1
- package/dist/stories/ColorLegends/ContinousLegends/Porosity.stories.js +27 -16
- package/dist/stories/ColorLegends/ContinousLegends/Porosity.stories.js.map +1 -1
- package/dist/stories/ColorLegends/ContinousLegends/SW.stories.js +27 -16
- package/dist/stories/ColorLegends/ContinousLegends/SW.stories.js.map +1 -1
- package/dist/stories/ColorLegends/DiscreteLegends/Facies.stories.js +25 -14
- package/dist/stories/ColorLegends/DiscreteLegends/Facies.stories.js.map +1 -1
- package/dist/stories/ColorLegends/DiscreteLegends/FaciesNoCalcite.stories.js +25 -14
- package/dist/stories/ColorLegends/DiscreteLegends/FaciesNoCalcite.stories.js.map +1 -1
- package/dist/stories/ColorLegends/DiscreteLegends/FaultDistanceHum.stories.js +25 -14
- package/dist/stories/ColorLegends/DiscreteLegends/FaultDistanceHum.stories.js.map +1 -1
- package/dist/stories/ColorLegends/DiscreteLegends/FaultProximityFlag.stories.js +25 -14
- package/dist/stories/ColorLegends/DiscreteLegends/FaultProximityFlag.stories.js.map +1 -1
- package/dist/stories/ColorLegends/DiscreteLegends/RDE.stories.js +25 -14
- package/dist/stories/ColorLegends/DiscreteLegends/RDE.stories.js.map +1 -1
- package/dist/stories/ColorLegends/DiscreteLegends/RDE_Orig.stories.js +25 -14
- package/dist/stories/ColorLegends/DiscreteLegends/RDE_Orig.stories.js.map +1 -1
- package/dist/stories/ColorLegends/DiscreteLegends/ZoneMain.stories.js +25 -14
- package/dist/stories/ColorLegends/DiscreteLegends/ZoneMain.stories.js.map +1 -1
- package/dist/stories/ColorLegends/DiscreteLegends/Zonelog.stories.js +25 -14
- package/dist/stories/ColorLegends/DiscreteLegends/Zonelog.stories.js.map +1 -1
- package/dist/stories/ColorLegends/LegendWithSelector/DiscreteLegendWithSelector.stories.js +25 -14
- package/dist/stories/ColorLegends/LegendWithSelector/DiscreteLegendWithSelector.stories.js.map +1 -1
- package/dist/stories/ColorLegends/LegendWithSelector/LegendWithSelector.stories.js +27 -16
- package/dist/stories/ColorLegends/LegendWithSelector/LegendWithSelector.stories.js.map +1 -1
- package/dist/stories/ColorLegends/SingleComponent/Single.stories.js +29 -18
- package/dist/stories/ColorLegends/SingleComponent/Single.stories.js.map +1 -1
- package/package.json +2 -1
- package/src/component/ColorSelector/ColorSelectorAccordion.tsx +2 -2
- package/src/component/ColorSelector/ColorSelectorComponent.tsx +17 -12
- package/src/component/ColorSelector/ColorSelectorWrapper.tsx +4 -4
- package/src/component/ColorTableTypes.ts +1 -1
- package/src/component/Legend/ColorLegend.tsx +13 -3
- package/src/component/Legend/ContinuousLegend.tsx +52 -54
- package/src/component/Legend/DiscreteLegend.tsx +118 -79
- package/src/component/Utils/discreteLegend.ts +125 -75
- package/tsconfig.json +1 -1
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
1
12
|
import React from "react";
|
|
2
13
|
import { DiscreteColorLegend } from "../../../component/Legend/DiscreteLegend";
|
|
3
14
|
import colorTables from "../../../component/color-tables.json";
|
|
@@ -5,7 +16,7 @@ export default {
|
|
|
5
16
|
component: DiscreteColorLegend,
|
|
6
17
|
title: "Legends/DiscreteLegendWithSelector",
|
|
7
18
|
};
|
|
8
|
-
|
|
19
|
+
var discreteData = {
|
|
9
20
|
"Above_BCU": [[], 0],
|
|
10
21
|
"ABOVE": [[], 1],
|
|
11
22
|
"H12": [[], 2],
|
|
@@ -22,20 +33,20 @@ const discreteData = {
|
|
|
22
33
|
"H1": [[], 13],
|
|
23
34
|
"BELOW": [[], 14]
|
|
24
35
|
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return React.createElement(DiscreteColorLegend,
|
|
36
|
+
var dataObjectName = "Wells / ZONELOG";
|
|
37
|
+
var position = [16, 10];
|
|
38
|
+
var horizontal = true;
|
|
39
|
+
var colorName = "Stratigraphy";
|
|
40
|
+
var Template = function (args) {
|
|
41
|
+
return React.createElement(DiscreteColorLegend, __assign({}, args));
|
|
31
42
|
};
|
|
32
|
-
export
|
|
43
|
+
export var discreteLegendWithSelector = Template.bind({});
|
|
33
44
|
discreteLegendWithSelector.args = {
|
|
34
|
-
discreteData,
|
|
35
|
-
dataObjectName,
|
|
36
|
-
position,
|
|
37
|
-
horizontal,
|
|
38
|
-
colorName,
|
|
39
|
-
colorTables,
|
|
45
|
+
discreteData: discreteData,
|
|
46
|
+
dataObjectName: dataObjectName,
|
|
47
|
+
position: position,
|
|
48
|
+
horizontal: horizontal,
|
|
49
|
+
colorName: colorName,
|
|
50
|
+
colorTables: colorTables,
|
|
40
51
|
};
|
|
41
52
|
//# sourceMappingURL=DiscreteLegendWithSelector.stories.js.map
|
package/dist/stories/ColorLegends/LegendWithSelector/DiscreteLegendWithSelector.stories.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DiscreteLegendWithSelector.stories.js","sourceRoot":"","sources":["../../../../src/stories/ColorLegends/LegendWithSelector/DiscreteLegendWithSelector.stories.jsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAC/E,OAAO,WAAW,MAAM,sCAAsC,CAAC;AAE/D,eAAe;IACX,SAAS,EAAE,mBAAmB;IAC9B,KAAK,EAAE,oCAAoC;CAC9C,CAAC;AAEF,
|
|
1
|
+
{"version":3,"file":"DiscreteLegendWithSelector.stories.js","sourceRoot":"","sources":["../../../../src/stories/ColorLegends/LegendWithSelector/DiscreteLegendWithSelector.stories.jsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAC/E,OAAO,WAAW,MAAM,sCAAsC,CAAC;AAE/D,eAAe;IACX,SAAS,EAAE,mBAAmB;IAC9B,KAAK,EAAE,oCAAoC;CAC9C,CAAC;AAEF,IAAM,YAAY,GAAG;IACjB,WAAW,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IACpB,OAAO,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IAChB,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IACd,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IACd,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IACd,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IACb,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IACb,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IACb,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IACb,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IACb,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;IACd,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;IACd,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;IACd,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;IACd,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;CACpB,CAAC;AACF,IAAM,cAAc,GAAG,iBAAiB,CAAC;AACzC,IAAM,QAAQ,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC1B,IAAM,UAAU,GAAG,IAAI,CAAC;AACxB,IAAM,SAAS,GAAG,cAAc,CAAC;AAEjC,IAAM,QAAQ,GAAG,UAAC,IAAI;IAClB,OAAO,oBAAC,mBAAmB,eAAK,IAAI,EAAI,CAAC;AAC7C,CAAC,CAAC;AAEF,MAAM,CAAC,IAAM,0BAA0B,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC5D,0BAA0B,CAAC,IAAI,GAAG;IAC9B,YAAY,cAAA;IACZ,cAAc,gBAAA;IACd,QAAQ,UAAA;IACR,UAAU,YAAA;IACV,SAAS,WAAA;IACT,WAAW,aAAA;CACd,CAAC"}
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
1
12
|
import React from "react";
|
|
2
13
|
import { ContinuousLegend } from "../../../component/Legend/ContinuousLegend";
|
|
3
14
|
import colorTables from "../../../component/color-tables.json";
|
|
@@ -5,23 +16,23 @@ export default {
|
|
|
5
16
|
component: ContinuousLegend,
|
|
6
17
|
title: "Legends/LegendWithSelector",
|
|
7
18
|
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return React.createElement(ContinuousLegend,
|
|
19
|
+
var min = 0;
|
|
20
|
+
var max = 0.35;
|
|
21
|
+
var dataObjectName = "Legend";
|
|
22
|
+
var position = [16, 10];
|
|
23
|
+
var horizontal = true;
|
|
24
|
+
var colorName = "Time/Depth";
|
|
25
|
+
var Template = function (args) {
|
|
26
|
+
return React.createElement(ContinuousLegend, __assign({}, args));
|
|
16
27
|
};
|
|
17
|
-
export
|
|
28
|
+
export var legendWithSelector = Template.bind({});
|
|
18
29
|
legendWithSelector.args = {
|
|
19
|
-
min,
|
|
20
|
-
max,
|
|
21
|
-
dataObjectName,
|
|
22
|
-
position,
|
|
23
|
-
horizontal,
|
|
24
|
-
colorName,
|
|
25
|
-
colorTables,
|
|
30
|
+
min: min,
|
|
31
|
+
max: max,
|
|
32
|
+
dataObjectName: dataObjectName,
|
|
33
|
+
position: position,
|
|
34
|
+
horizontal: horizontal,
|
|
35
|
+
colorName: colorName,
|
|
36
|
+
colorTables: colorTables,
|
|
26
37
|
};
|
|
27
38
|
//# sourceMappingURL=LegendWithSelector.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LegendWithSelector.stories.js","sourceRoot":"","sources":["../../../../src/stories/ColorLegends/LegendWithSelector/LegendWithSelector.stories.jsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC9E,OAAO,WAAW,MAAM,sCAAsC,CAAC;AAE/D,eAAe;IACX,SAAS,EAAE,gBAAgB;IAC3B,KAAK,EAAE,4BAA4B;CACtC,CAAC;AAEF,
|
|
1
|
+
{"version":3,"file":"LegendWithSelector.stories.js","sourceRoot":"","sources":["../../../../src/stories/ColorLegends/LegendWithSelector/LegendWithSelector.stories.jsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC9E,OAAO,WAAW,MAAM,sCAAsC,CAAC;AAE/D,eAAe;IACX,SAAS,EAAE,gBAAgB;IAC3B,KAAK,EAAE,4BAA4B;CACtC,CAAC;AAEF,IAAM,GAAG,GAAG,CAAC,CAAC;AACd,IAAM,GAAG,GAAG,IAAI,CAAC;AACjB,IAAM,cAAc,GAAG,QAAQ,CAAC;AAChC,IAAM,QAAQ,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC1B,IAAM,UAAU,GAAG,IAAI,CAAC;AACxB,IAAM,SAAS,GAAG,YAAY,CAAC;AAE/B,IAAM,QAAQ,GAAG,UAAC,IAAI;IAClB,OAAO,oBAAC,gBAAgB,eAAK,IAAI,EAAI,CAAC;AAC1C,CAAC,CAAC;AAEF,MAAM,CAAC,IAAM,kBAAkB,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACpD,kBAAkB,CAAC,IAAI,GAAG;IACtB,GAAG,KAAA;IACH,GAAG,KAAA;IACH,cAAc,gBAAA;IACd,QAAQ,UAAA;IACR,UAAU,YAAA;IACV,SAAS,WAAA;IACT,WAAW,aAAA;CACd,CAAC"}
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
1
12
|
import React from "react";
|
|
2
13
|
import colorTables from "../../../component/color-tables.json";
|
|
3
14
|
import ColorLegend from "../../../component/Legend/ColorLegend";
|
|
@@ -6,14 +17,14 @@ export default {
|
|
|
6
17
|
title: "Legends/SingleComponent",
|
|
7
18
|
};
|
|
8
19
|
// prop for continous legend
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
20
|
+
var min = 0;
|
|
21
|
+
var max = 0.35;
|
|
22
|
+
var dataObjectName = "Legend";
|
|
23
|
+
var position = [16, 10];
|
|
24
|
+
var horizontal = true;
|
|
25
|
+
var colorName = "Physics";
|
|
15
26
|
// prop for discrete data
|
|
16
|
-
|
|
27
|
+
var discreteData = {
|
|
17
28
|
"Above_BCU": [[], 0],
|
|
18
29
|
"ABOVE": [[], 1],
|
|
19
30
|
"H12": [[], 2],
|
|
@@ -30,18 +41,18 @@ const discreteData = {
|
|
|
30
41
|
"H1": [[], 13],
|
|
31
42
|
"BELOW": [[], 14]
|
|
32
43
|
};
|
|
33
|
-
|
|
34
|
-
return React.createElement(ColorLegend,
|
|
44
|
+
var Template = function (args) {
|
|
45
|
+
return React.createElement(ColorLegend, __assign({}, args));
|
|
35
46
|
};
|
|
36
|
-
export
|
|
47
|
+
export var legendWithSelector = Template.bind({});
|
|
37
48
|
legendWithSelector.args = {
|
|
38
|
-
min,
|
|
39
|
-
max,
|
|
40
|
-
dataObjectName,
|
|
41
|
-
position,
|
|
42
|
-
horizontal,
|
|
43
|
-
colorName,
|
|
44
|
-
colorTables,
|
|
45
|
-
discreteData,
|
|
49
|
+
min: min,
|
|
50
|
+
max: max,
|
|
51
|
+
dataObjectName: dataObjectName,
|
|
52
|
+
position: position,
|
|
53
|
+
horizontal: horizontal,
|
|
54
|
+
colorName: colorName,
|
|
55
|
+
colorTables: colorTables,
|
|
56
|
+
discreteData: discreteData,
|
|
46
57
|
};
|
|
47
58
|
//# sourceMappingURL=Single.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Single.stories.js","sourceRoot":"","sources":["../../../../src/stories/ColorLegends/SingleComponent/Single.stories.jsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,WAAW,MAAM,sCAAsC,CAAC;AAC/D,OAAO,WAAW,MAAM,uCAAuC,CAAC;AAEhE,eAAe;IACX,SAAS,EAAE,WAAW;IACtB,KAAK,EAAE,yBAAyB;CACnC,CAAC;AAEF,4BAA4B;AAC5B,
|
|
1
|
+
{"version":3,"file":"Single.stories.js","sourceRoot":"","sources":["../../../../src/stories/ColorLegends/SingleComponent/Single.stories.jsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,WAAW,MAAM,sCAAsC,CAAC;AAC/D,OAAO,WAAW,MAAM,uCAAuC,CAAC;AAEhE,eAAe;IACX,SAAS,EAAE,WAAW;IACtB,KAAK,EAAE,yBAAyB;CACnC,CAAC;AAEF,4BAA4B;AAC5B,IAAM,GAAG,GAAG,CAAC,CAAC;AACd,IAAM,GAAG,GAAG,IAAI,CAAC;AACjB,IAAM,cAAc,GAAG,QAAQ,CAAC;AAChC,IAAM,QAAQ,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC1B,IAAM,UAAU,GAAG,IAAI,CAAC;AACxB,IAAM,SAAS,GAAG,SAAS,CAAC;AAE5B,yBAAyB;AACzB,IAAM,YAAY,GAAG;IACjB,WAAW,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IACpB,OAAO,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IAChB,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IACd,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IACd,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IACd,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IACb,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IACb,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IACb,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IACb,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IACb,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;IACd,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;IACd,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;IACd,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;IACd,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;CACpB,CAAC;AAEF,IAAM,QAAQ,GAAG,UAAC,IAAI;IAClB,OAAO,oBAAC,WAAW,eAAK,IAAI,EAAI,CAAC;AACrC,CAAC,CAAC;AAEF,MAAM,CAAC,IAAM,kBAAkB,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACpD,kBAAkB,CAAC,IAAI,GAAG;IACtB,GAAG,KAAA;IACH,GAAG,KAAA;IACH,cAAc,gBAAA;IACd,QAAQ,UAAA;IACR,UAAU,YAAA;IACV,SAAS,WAAA;IACT,WAAW,aAAA;IACX,YAAY,cAAA;CACf,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@emerson-eps/color-tables",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"description": "Standard library of color tables for geological domain",
|
|
5
5
|
"release": {
|
|
6
6
|
"branches": [
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
"@types/d3": "^7.1.0",
|
|
61
61
|
"@types/styled-components": "^5.1.23",
|
|
62
62
|
"babel-loader": "^8.1.0",
|
|
63
|
+
"html-webpack-plugin": "^5.5.0",
|
|
63
64
|
"semantic-release": "^19.0.2",
|
|
64
65
|
"ts-loader": "^9.2.6",
|
|
65
66
|
"typescript": "^4.5.4"
|
|
@@ -7,8 +7,8 @@ export const ColorSelectorAccordion = (props: any) => {
|
|
|
7
7
|
<div className="Container" style={{width: "316px",
|
|
8
8
|
position: "absolute",
|
|
9
9
|
zIndex: 1,
|
|
10
|
-
top:
|
|
11
|
-
right: 5,
|
|
10
|
+
top: props.isHorizontal ? 100 : 30,
|
|
11
|
+
right: props.isHorizontal ? 5 : 165,
|
|
12
12
|
}}>
|
|
13
13
|
<Accordion >
|
|
14
14
|
<Accordion.Item isExpanded>
|
|
@@ -41,11 +41,16 @@ export const ColorSelectorComponent: React.FC<legendProps> = ({
|
|
|
41
41
|
// create an array of steps based on the color scale
|
|
42
42
|
// returns an array of evenly-spaced numbers. Returns the integers from zero to the specified end minus one.
|
|
43
43
|
// d3.range(start, stop, step)
|
|
44
|
-
|
|
45
|
-
var
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
let data: any;
|
|
45
|
+
var extent: any
|
|
46
|
+
if (legendColor) {
|
|
47
|
+
data = range(10).map((d) => ({
|
|
48
|
+
color: legendColor(d / 10),
|
|
49
|
+
value: d,
|
|
50
|
+
}));
|
|
51
|
+
// get the array's min and max value
|
|
52
|
+
extent = d3.extent(data, (d: any) => d?.value);
|
|
53
|
+
}
|
|
49
54
|
|
|
50
55
|
const handleChange = React.useCallback(() => {
|
|
51
56
|
// continous legend with colortable colors
|
|
@@ -54,11 +59,11 @@ export const ColorSelectorComponent: React.FC<legendProps> = ({
|
|
|
54
59
|
}
|
|
55
60
|
// continous legend with d3 colors
|
|
56
61
|
else if (data && !useContColorTable) {
|
|
57
|
-
|
|
62
|
+
const arrayData: any = []
|
|
58
63
|
data.forEach((colorsObject: any) => {
|
|
59
64
|
arrayData.push([0 + "." + colorsObject.value, color(colorsObject.color)?.rgb().r, color(colorsObject.color)?.rgb().g, color(colorsObject.color)?.rgb().b])
|
|
60
65
|
});
|
|
61
|
-
colorScaleData(arrayData, true);
|
|
66
|
+
colorScaleData({ arrayData, legendColorName }, true);
|
|
62
67
|
}
|
|
63
68
|
// discrete legend with colortable colors
|
|
64
69
|
else if (colorsObject && Object.keys(colorsObject).length > 0 && useDiscColorTable) {
|
|
@@ -123,7 +128,7 @@ export const ColorSelectorComponent: React.FC<legendProps> = ({
|
|
|
123
128
|
.style("height", "30px")
|
|
124
129
|
|
|
125
130
|
const defs = svgLegend.append("defs");
|
|
126
|
-
|
|
131
|
+
const currentIndex = "linear-gradient-" + valueIndex;
|
|
127
132
|
// append a linearGradient element to the defs and give it a unique id
|
|
128
133
|
const linearGradient = defs
|
|
129
134
|
.append("linearGradient")
|
|
@@ -182,7 +187,7 @@ export const ColorSelectorComponent: React.FC<legendProps> = ({
|
|
|
182
187
|
.style("height", "50px")
|
|
183
188
|
|
|
184
189
|
const defs = svgLegend.append("defs");
|
|
185
|
-
|
|
190
|
+
const currentIndex = "linear-gradient-" + valueIndex;
|
|
186
191
|
// append a linearGradient element to the defs and give it a unique id
|
|
187
192
|
const linearGradient = defs
|
|
188
193
|
.append("linearGradient")
|
|
@@ -196,8 +201,8 @@ export const ColorSelectorComponent: React.FC<legendProps> = ({
|
|
|
196
201
|
linearGradient.selectAll("stop")
|
|
197
202
|
.data(data)
|
|
198
203
|
.enter().append("stop")
|
|
199
|
-
.attr("offset", d => ((d.value - extent[0]) / (extent[1] - extent[0]) * 100) + "%")
|
|
200
|
-
.attr("stop-color", d => d.color);
|
|
204
|
+
.attr("offset", (d: any) => ((d.value - extent[0]) / (extent[1] - extent[0]) * 100) + "%")
|
|
205
|
+
.attr("stop-color", (d: any) => d.color);
|
|
201
206
|
|
|
202
207
|
// append title
|
|
203
208
|
svgLegend
|
|
@@ -277,7 +282,7 @@ export const ColorSelectorComponent: React.FC<legendProps> = ({
|
|
|
277
282
|
itemName.push(key);
|
|
278
283
|
});
|
|
279
284
|
//const ordinalValues = scaleOrdinal(colorsObject).domain(itemName);
|
|
280
|
-
|
|
285
|
+
const count = itemName.length
|
|
281
286
|
const discreteLegend = discreteLegendUtil(itemColor, true);
|
|
282
287
|
select("svg").append("g").attr("transform", "translate(50,70)").attr("class", "legend").call(discreteLegend);
|
|
283
288
|
const selectedLegend = select(divRef.current);
|
|
@@ -16,7 +16,7 @@ interface legendProps {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
// Continuous legend using color table data
|
|
19
|
-
|
|
19
|
+
const colorTableContinuousData = colorTables.filter((element: any) => {
|
|
20
20
|
return element.discrete == false;
|
|
21
21
|
});
|
|
22
22
|
|
|
@@ -25,7 +25,7 @@ colorTableContinuousData.forEach((element: any) => {
|
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
// Continuous legend using d3 data
|
|
28
|
-
|
|
28
|
+
const d3continuousData = d3ColorScales.filter((element: any) => {
|
|
29
29
|
return element.discrete == false;
|
|
30
30
|
});
|
|
31
31
|
|
|
@@ -34,7 +34,7 @@ d3continuousData.forEach((element: any) => {
|
|
|
34
34
|
});
|
|
35
35
|
|
|
36
36
|
// Discrete legend using color table data
|
|
37
|
-
|
|
37
|
+
const discreteData = colorTables.filter((element: any) => {
|
|
38
38
|
return element.discrete == true;
|
|
39
39
|
});
|
|
40
40
|
|
|
@@ -43,7 +43,7 @@ discreteData.forEach((element: any) => {
|
|
|
43
43
|
});
|
|
44
44
|
|
|
45
45
|
// Discrete legend using d3 data
|
|
46
|
-
|
|
46
|
+
const d3discreteData = d3ColorScales.filter((element: any) => {
|
|
47
47
|
return element.discrete == true;
|
|
48
48
|
});
|
|
49
49
|
|
|
@@ -12,7 +12,8 @@ interface ColorLegendProps {
|
|
|
12
12
|
position?: number[] | null;
|
|
13
13
|
colorName: string;
|
|
14
14
|
horizontal?: boolean | null;
|
|
15
|
-
discreteData:
|
|
15
|
+
discreteData: { objects: Record<string, [number[], number]> };
|
|
16
|
+
getColorMapname?: any;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
// Todo: Adapt it for other layers too
|
|
@@ -24,7 +25,8 @@ const ColorLegend: React.FC<ColorLegendProps> = ({
|
|
|
24
25
|
max,
|
|
25
26
|
dataObjectName,
|
|
26
27
|
colorName,
|
|
27
|
-
discreteData
|
|
28
|
+
discreteData,
|
|
29
|
+
getColorMapname
|
|
28
30
|
}: ColorLegendProps) => {
|
|
29
31
|
|
|
30
32
|
const [isToggled, setIsToggled] = React.useState(false);
|
|
@@ -37,6 +39,14 @@ const ColorLegend: React.FC<ColorLegendProps> = ({
|
|
|
37
39
|
|
|
38
40
|
// Get new colorscale from colorselector and update legend
|
|
39
41
|
const colorScaleObject = React.useCallback((data: any, value: any) => {
|
|
42
|
+
// update color map layer
|
|
43
|
+
if (data.name && getColorMapname) {
|
|
44
|
+
getColorMapname(data.name);
|
|
45
|
+
}
|
|
46
|
+
// d3 color name
|
|
47
|
+
else if (getColorMapname) {
|
|
48
|
+
getColorMapname(data.legendColorName);
|
|
49
|
+
}
|
|
40
50
|
setUpdateLegendColor(data);
|
|
41
51
|
setIsCont(value);
|
|
42
52
|
}, []);
|
|
@@ -70,7 +80,7 @@ const ColorLegend: React.FC<ColorLegendProps> = ({
|
|
|
70
80
|
</div>
|
|
71
81
|
<div>
|
|
72
82
|
{isToggled && (
|
|
73
|
-
<ColorSelectorAccordion colorScaleObject={colorScaleObject} />
|
|
83
|
+
<ColorSelectorAccordion colorScaleObject={colorScaleObject} isHorizontal={horizontal} />
|
|
74
84
|
)}
|
|
75
85
|
</div>
|
|
76
86
|
</div>
|
|
@@ -4,7 +4,7 @@ import { RGBToHex, colorsArray } from "../Utils/continousLegend";
|
|
|
4
4
|
import { select, scaleLinear, scaleSequential, axisBottom, axisRight } from "d3";
|
|
5
5
|
import { colorTablesArray } from "../ColorTableTypes";
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
interface legendProps {
|
|
8
8
|
min: number;
|
|
9
9
|
max: number;
|
|
10
10
|
dataObjectName: string;
|
|
@@ -15,7 +15,7 @@ declare type legendProps = {
|
|
|
15
15
|
updateLegend?: any;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
interface ItemColor {
|
|
19
19
|
color: string;
|
|
20
20
|
offset: number;
|
|
21
21
|
}
|
|
@@ -49,10 +49,10 @@ export const ContinuousLegend: React.FC<legendProps> = ({
|
|
|
49
49
|
try {
|
|
50
50
|
// fix for dash wrapper
|
|
51
51
|
if (typeof colorTables === "string") {
|
|
52
|
-
|
|
52
|
+
const res = await fetch(colorTables);
|
|
53
53
|
dataSet = await res.json()
|
|
54
54
|
}
|
|
55
|
-
//
|
|
55
|
+
//Return the matched colors array from color.tables.json file
|
|
56
56
|
let legendColors = typeof colorTables === "string" ?
|
|
57
57
|
colorsArray(colorName, dataSet)
|
|
58
58
|
:
|
|
@@ -66,8 +66,8 @@ export const ContinuousLegend: React.FC<legendProps> = ({
|
|
|
66
66
|
legendColors = updateLegend.color;
|
|
67
67
|
}
|
|
68
68
|
// legend using d3 data
|
|
69
|
-
else if (updateLegend.
|
|
70
|
-
legendColors = updateLegend
|
|
69
|
+
else if (updateLegend.arrayData) {
|
|
70
|
+
legendColors = updateLegend.arrayData;
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
// main continuous legend
|
|
@@ -82,7 +82,7 @@ export const ContinuousLegend: React.FC<legendProps> = ({
|
|
|
82
82
|
color: RGBToHex(value).color,
|
|
83
83
|
});
|
|
84
84
|
});
|
|
85
|
-
|
|
85
|
+
|
|
86
86
|
const colorScale = scaleSequential().domain([min, max]);
|
|
87
87
|
// append a defs (for definition) element to your SVG
|
|
88
88
|
const svgLegend = select(divRef.current)
|
|
@@ -98,31 +98,29 @@ export const ContinuousLegend: React.FC<legendProps> = ({
|
|
|
98
98
|
// .style("transform", "rotate(270deg)")
|
|
99
99
|
// .style("margin-top", "80px");
|
|
100
100
|
.attr("width", "100")
|
|
101
|
-
.attr("height", "
|
|
101
|
+
.attr("height", "190");
|
|
102
102
|
linearGradient = defs
|
|
103
103
|
.append("linearGradient")
|
|
104
104
|
.attr("id", "linear-gradient")
|
|
105
105
|
.attr("x1", "0%")
|
|
106
|
-
.attr("x2", "0%")
|
|
106
|
+
.attr("x2", "0%")
|
|
107
107
|
.attr("y1", "0%")
|
|
108
|
-
.attr("y2", "100%");
|
|
109
|
-
}
|
|
108
|
+
.attr("y2", "100%"); //since it's a vertical linear gradient
|
|
109
|
+
}
|
|
110
110
|
// horizontal legend
|
|
111
111
|
else {
|
|
112
|
-
svgLegend
|
|
113
|
-
|
|
114
|
-
.attr("height", "165")
|
|
115
|
-
|
|
112
|
+
svgLegend.attr("width", "200").attr("height", "90");
|
|
113
|
+
|
|
116
114
|
// append a linearGradient element to the defs and give it a unique id
|
|
117
115
|
linearGradient = defs
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
116
|
+
.append("linearGradient")
|
|
117
|
+
.attr("id", "linear-gradient")
|
|
118
|
+
.attr("x1", "0%")
|
|
119
|
+
.attr("x2", "100%") //since it's a horizontal linear gradient
|
|
120
|
+
.attr("y1", "0%")
|
|
121
|
+
.attr("y2", "0%");
|
|
124
122
|
}
|
|
125
|
-
|
|
123
|
+
|
|
126
124
|
// append multiple color stops by using D3's data/enter step
|
|
127
125
|
linearGradient
|
|
128
126
|
.selectAll("stop")
|
|
@@ -144,7 +142,7 @@ export const ContinuousLegend: React.FC<legendProps> = ({
|
|
|
144
142
|
.attr("y", 20)
|
|
145
143
|
.style("text-anchor", "left")
|
|
146
144
|
.text(dataObjectName);
|
|
147
|
-
|
|
145
|
+
|
|
148
146
|
// vertical legend
|
|
149
147
|
if (!horizontal) {
|
|
150
148
|
// draw the rectangle and fill with gradient
|
|
@@ -160,40 +158,43 @@ export const ContinuousLegend: React.FC<legendProps> = ({
|
|
|
160
158
|
else {
|
|
161
159
|
// draw the rectangle and fill with gradient
|
|
162
160
|
svgLegend
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
161
|
+
.append("rect")
|
|
162
|
+
.attr("x", 25)
|
|
163
|
+
.attr("y", 30)
|
|
164
|
+
.attr("width", "150")
|
|
165
|
+
.attr("height", 25)
|
|
166
|
+
.style("fill", "url(#linear-gradient)");
|
|
169
167
|
}
|
|
170
168
|
|
|
171
|
-
//create tick marks
|
|
169
|
+
// create tick marks
|
|
172
170
|
// range varies the size of the axis
|
|
173
171
|
const xLeg = scaleLinear().domain([min, max]).range([10, 158]);
|
|
174
|
-
const yLeg = scaleLinear().domain([min, max]).range([10,
|
|
175
|
-
|
|
176
|
-
const horizontalAxisLeg = axisBottom(xLeg).tickValues(colorScale.domain());
|
|
177
|
-
var VerticalAxisLeg = axisRight(yLeg).tickSize(24).tickValues(colorScale.domain());
|
|
172
|
+
const yLeg = scaleLinear().domain([min, max]).range([10, 158]);
|
|
178
173
|
|
|
174
|
+
const horizontalAxisLeg = axisBottom(xLeg).tickValues(
|
|
175
|
+
colorScale.domain()
|
|
176
|
+
);
|
|
177
|
+
const VerticalAxisLeg = axisRight(yLeg)
|
|
178
|
+
.tickSize(24)
|
|
179
|
+
.tickValues(colorScale.domain());
|
|
179
180
|
|
|
180
181
|
if (horizontal) {
|
|
181
182
|
svgLegend
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
183
|
+
.attr("class", "axis")
|
|
184
|
+
.append("g")
|
|
185
|
+
.attr("transform", "translate(15, 55)")
|
|
186
|
+
.style("font-size", "10px")
|
|
187
|
+
.style("font-weight", "700")
|
|
188
|
+
.call(horizontalAxisLeg)
|
|
189
|
+
.style("height", 25);
|
|
189
190
|
} else {
|
|
190
191
|
svgLegend
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
192
|
+
.attr("class", "axis")
|
|
193
|
+
.append("g")
|
|
194
|
+
.attr("transform", "translate(25, 20)")
|
|
195
|
+
.style("font-size", "10px")
|
|
196
|
+
.style("font-weight", "700")
|
|
197
|
+
.call(VerticalAxisLeg);
|
|
197
198
|
}
|
|
198
199
|
} catch (error) {
|
|
199
200
|
console.error(error);
|
|
@@ -204,15 +205,12 @@ export const ContinuousLegend: React.FC<legendProps> = ({
|
|
|
204
205
|
<div
|
|
205
206
|
style={{
|
|
206
207
|
position: "absolute",
|
|
207
|
-
right: position ? position[0] :
|
|
208
|
-
top: position ? position[1] :
|
|
208
|
+
right: position ? position[0] : " ",
|
|
209
|
+
top: position ? position[1] : " ",
|
|
210
|
+
zIndex: 999,
|
|
209
211
|
}}
|
|
210
212
|
>
|
|
211
|
-
<div id="legend" ref={divRef}
|
|
212
|
-
style={{
|
|
213
|
-
width: horizontal ? "220px" : "100px",
|
|
214
|
-
height: horizontal ? "165px" : "150px",
|
|
215
|
-
}}></div>
|
|
213
|
+
<div id="legend" ref={divRef}></div>
|
|
216
214
|
</div>
|
|
217
215
|
);
|
|
218
216
|
};
|