@emerson-eps/color-tables 0.2.4 → 0.2.5
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 +1 -1
- package/dist/component/ColorSelector/ColorSelectorAccordion.js.map +1 -1
- package/dist/component/ColorSelector/ColorSelectorComponent.js +46 -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/Legend/ColorLegend.js +7 -6
- package/dist/component/Legend/ColorLegend.js.map +1 -1
- package/dist/component/Legend/ContinuousLegend.js +185 -147
- package/dist/component/Legend/ContinuousLegend.js.map +1 -1
- package/dist/component/Legend/DiscreteLegend.js +154 -113
- 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.js +1 -1
- 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/Legend/ContinuousLegend.tsx +5 -2
- package/src/component/Legend/DiscreteLegend.tsx +2 -1
- package/tsconfig.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Accordion } from "@equinor/eds-core-react";
|
|
3
3
|
import { ColorSelectorWrapper } from "./ColorSelectorWrapper";
|
|
4
|
-
export
|
|
4
|
+
export var ColorSelectorAccordion = function (props) {
|
|
5
5
|
return (React.createElement("div", { className: "Container", style: { width: "316px",
|
|
6
6
|
position: "absolute",
|
|
7
7
|
zIndex: 1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorSelectorAccordion.js","sourceRoot":"","sources":["../../../src/component/ColorSelector/ColorSelectorAccordion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAG,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"ColorSelectorAccordion.js","sourceRoot":"","sources":["../../../src/component/ColorSelector/ColorSelectorAccordion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAG,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,MAAM,CAAC,IAAM,sBAAsB,GAAG,UAAC,KAAU;IAC7C,OAAO,CACH,6BAAK,SAAS,EAAC,WAAW,EAAC,KAAK,EAAE,EAAC,KAAK,EAAE,OAAO;YACjD,QAAQ,EAAE,UAAU;YACpB,MAAM,EAAE,CAAC;YACT,GAAG,EAAE,GAAG;YACR,KAAK,EAAE,CAAC;SACP;QACG,oBAAC,SAAS;YACN,oBAAC,SAAS,CAAC,IAAI,IAAC,UAAU;gBACtB,oBAAC,SAAS,CAAC,MAAM,uBAEE;gBACnB,oBAAC,SAAS,CAAC,KAAK;oBACZ,oBAAC,SAAS;wBACN,oBAAC,SAAS,CAAC,IAAI;4BACX,oBAAC,SAAS,CAAC,MAAM,+BAEE;4BACnB,oBAAC,SAAS,CAAC,KAAK;gCACZ,oBAAC,oBAAoB,IAAC,mBAAmB,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,GAAG,CACjF,CACL,CACT;oBACZ,oBAAC,SAAS;wBACN,oBAAC,SAAS,CAAC,IAAI;4BACX,oBAAC,SAAS,CAAC,MAAM,yBAEE;4BACnB,oBAAC,SAAS,CAAC,KAAK;gCACZ,oBAAC,oBAAoB,IAAC,WAAW,EAAE,IAAI,EAAE,mBAAmB,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,GAAG,CACjF,CACL,CACT;oBACZ,oBAAC,SAAS;wBACN,oBAAC,SAAS,CAAC,IAAI;4BACX,oBAAC,SAAS,CAAC,MAAM,6BAEE;4BACnB,oBAAC,SAAS,CAAC,KAAK,yBAEE,CACL,CACT,CACE,CACL,CACT,CACV,CACT,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -6,33 +6,32 @@ import { select, range } from "d3";
|
|
|
6
6
|
import * as d3 from "d3";
|
|
7
7
|
import discreteLegendUtil from "../Utils/discreteLegend";
|
|
8
8
|
import { color } from "d3-color";
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const divRef = useRef(null);
|
|
9
|
+
export var ColorSelectorComponent = function (_a) {
|
|
10
|
+
var
|
|
11
|
+
// position,
|
|
12
|
+
colorsObject = _a.colorsObject, legendColor = _a.legendColor, legendColorName = _a.legendColorName, useContColorTable = _a.useContColorTable, useDiscColorTable = _a.useDiscColorTable, valueIndex = _a.valueIndex, colorScaleData = _a.colorScaleData;
|
|
13
|
+
var divRef = useRef(null);
|
|
15
14
|
// create an array of steps based on the color scale
|
|
16
15
|
// returns an array of evenly-spaced numbers. Returns the integers from zero to the specified end minus one.
|
|
17
16
|
// d3.range(start, stop, step)
|
|
18
17
|
if (legendColor) {
|
|
19
|
-
var data = range(10).map(d
|
|
18
|
+
var data = range(10).map(function (d) { return ({ color: legendColor(d / 10), value: d }); });
|
|
20
19
|
// get the array's min and max value
|
|
21
|
-
var extent = d3.extent(data, d
|
|
20
|
+
var extent = d3.extent(data, function (d) { return d.value; });
|
|
22
21
|
}
|
|
23
|
-
|
|
22
|
+
var handleChange = React.useCallback(function () {
|
|
24
23
|
// continous legend with colortable colors
|
|
25
24
|
if (colorsObject && Object.keys(colorsObject).length > 0 && useContColorTable) {
|
|
26
25
|
colorScaleData(colorsObject, true);
|
|
27
26
|
}
|
|
28
27
|
// continous legend with d3 colors
|
|
29
28
|
else if (data && !useContColorTable) {
|
|
30
|
-
|
|
31
|
-
data.forEach((colorsObject)
|
|
29
|
+
var arrayData_1 = [];
|
|
30
|
+
data.forEach(function (colorsObject) {
|
|
32
31
|
var _a, _b, _c;
|
|
33
|
-
|
|
32
|
+
arrayData_1.push([0 + "." + colorsObject.value, (_a = color(colorsObject.color)) === null || _a === void 0 ? void 0 : _a.rgb().r, (_b = color(colorsObject.color)) === null || _b === void 0 ? void 0 : _b.rgb().g, (_c = color(colorsObject.color)) === null || _c === void 0 ? void 0 : _c.rgb().b]);
|
|
34
33
|
});
|
|
35
|
-
colorScaleData(
|
|
34
|
+
colorScaleData(arrayData_1, true);
|
|
36
35
|
}
|
|
37
36
|
// discrete legend with colortable colors
|
|
38
37
|
else if (colorsObject && Object.keys(colorsObject).length > 0 && useDiscColorTable) {
|
|
@@ -40,10 +39,10 @@ colorsObject, legendColor, legendColorName, useContColorTable, useDiscColorTable
|
|
|
40
39
|
}
|
|
41
40
|
// discrete legend with d3 colors
|
|
42
41
|
else {
|
|
43
|
-
colorScaleData({ colorsObject, legendColorName }, false);
|
|
42
|
+
colorScaleData({ colorsObject: colorsObject, legendColorName: legendColorName }, false);
|
|
44
43
|
}
|
|
45
44
|
}, []);
|
|
46
|
-
React.useEffect(()
|
|
45
|
+
React.useEffect(function () {
|
|
47
46
|
// continuous legend using color table colors
|
|
48
47
|
if (useContColorTable == true && divRef.current) {
|
|
49
48
|
contColortableLegend();
|
|
@@ -79,8 +78,8 @@ colorsObject, legendColor, legendColorName, useContColorTable, useDiscColorTable
|
|
|
79
78
|
}, [useContColorTable]);
|
|
80
79
|
// continuous legend using color table colors (using linear gradiend)
|
|
81
80
|
function contColortableLegend() {
|
|
82
|
-
|
|
83
|
-
colorsObject.color.forEach((value)
|
|
81
|
+
var itemColor = [];
|
|
82
|
+
colorsObject.color.forEach(function (value) {
|
|
84
83
|
// return the color and offset needed to draw the legend
|
|
85
84
|
itemColor.push({
|
|
86
85
|
offset: RGBToHex(value).offset,
|
|
@@ -88,13 +87,13 @@ colorsObject, legendColor, legendColorName, useContColorTable, useDiscColorTable
|
|
|
88
87
|
});
|
|
89
88
|
});
|
|
90
89
|
// append a defs (for definition) element to your SVG
|
|
91
|
-
|
|
90
|
+
var svgLegend = select(divRef.current)
|
|
92
91
|
.append("svg")
|
|
93
92
|
.style("height", "30px");
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
var defs = svgLegend.append("defs");
|
|
94
|
+
var currentIndex = "linear-gradient-" + valueIndex;
|
|
96
95
|
// append a linearGradient element to the defs and give it a unique id
|
|
97
|
-
|
|
96
|
+
var linearGradient = defs
|
|
98
97
|
.append("linearGradient")
|
|
99
98
|
.attr("id", currentIndex)
|
|
100
99
|
.attr("x1", "0%")
|
|
@@ -134,19 +133,19 @@ colorsObject, legendColor, legendColorName, useContColorTable, useDiscColorTable
|
|
|
134
133
|
}
|
|
135
134
|
// continuous legend using d3 colors (using linear gradiend)
|
|
136
135
|
function contD3Legend() {
|
|
137
|
-
|
|
138
|
-
d3ColorScales.forEach((value)
|
|
136
|
+
var itemColor = [];
|
|
137
|
+
d3ColorScales.forEach(function (value) {
|
|
139
138
|
// return the color and offset needed to draw the legend
|
|
140
139
|
itemColor.push(value.colors);
|
|
141
140
|
});
|
|
142
141
|
// append a defs (for definition) element to your SVG
|
|
143
|
-
|
|
142
|
+
var svgLegend = select(divRef.current)
|
|
144
143
|
.append("svg")
|
|
145
144
|
.style("height", "50px");
|
|
146
|
-
|
|
147
|
-
|
|
145
|
+
var defs = svgLegend.append("defs");
|
|
146
|
+
var currentIndex = "linear-gradient-" + valueIndex;
|
|
148
147
|
// append a linearGradient element to the defs and give it a unique id
|
|
149
|
-
|
|
148
|
+
var linearGradient = defs
|
|
150
149
|
.append("linearGradient")
|
|
151
150
|
.attr("id", currentIndex)
|
|
152
151
|
.attr("x1", "0%")
|
|
@@ -157,8 +156,8 @@ colorsObject, legendColor, legendColorName, useContColorTable, useDiscColorTable
|
|
|
157
156
|
linearGradient.selectAll("stop")
|
|
158
157
|
.data(data)
|
|
159
158
|
.enter().append("stop")
|
|
160
|
-
.attr("offset", d
|
|
161
|
-
.attr("stop-color", d
|
|
159
|
+
.attr("offset", function (d) { return ((d.value - extent[0]) / (extent[1] - extent[0]) * 100) + "%"; })
|
|
160
|
+
.attr("stop-color", function (d) { return d.color; });
|
|
162
161
|
// append title
|
|
163
162
|
svgLegend
|
|
164
163
|
.append("text")
|
|
@@ -179,14 +178,14 @@ colorsObject, legendColor, legendColorName, useContColorTable, useDiscColorTable
|
|
|
179
178
|
}
|
|
180
179
|
// discrete legend using color table colors
|
|
181
180
|
function discColorTableLegend() {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
colorsObject.color.forEach((element, key)
|
|
181
|
+
var itemColor = [];
|
|
182
|
+
var itemName = [];
|
|
183
|
+
colorsObject.color.forEach(function (element, key) {
|
|
185
184
|
itemColor.push({ color: RGBToHex(element) });
|
|
186
185
|
itemName.push(key);
|
|
187
186
|
});
|
|
188
187
|
function RGBToHex(rgb) {
|
|
189
|
-
|
|
188
|
+
var r = rgb[1].toString(16), g = rgb[2].toString(16), b = rgb[3].toString(16);
|
|
190
189
|
if (r.length == 1)
|
|
191
190
|
r = "0" + r;
|
|
192
191
|
if (g.length == 1)
|
|
@@ -196,10 +195,10 @@ colorsObject, legendColor, legendColorName, useContColorTable, useDiscColorTable
|
|
|
196
195
|
return "#" + r + g + b;
|
|
197
196
|
}
|
|
198
197
|
//const ordinalValues = scaleOrdinal().domain(itemName);
|
|
199
|
-
|
|
200
|
-
|
|
198
|
+
var count = itemName.length;
|
|
199
|
+
var colorLegend = discreteLegendUtil(itemColor, true);
|
|
201
200
|
//const calcLegendHeight = 22 * itemColor.length + 4 * itemColor.length;
|
|
202
|
-
|
|
201
|
+
var selectedLegend = select(divRef.current);
|
|
203
202
|
// colorname as label for the legend (ex: facies)
|
|
204
203
|
selectedLegend
|
|
205
204
|
.append("label")
|
|
@@ -215,7 +214,7 @@ colorsObject, legendColor, legendColorName, useContColorTable, useDiscColorTable
|
|
|
215
214
|
.append("svg")
|
|
216
215
|
.style("margin-top", "13px")
|
|
217
216
|
.style("margin-left", "70px")
|
|
218
|
-
.attr("viewBox",
|
|
217
|
+
.attr("viewBox", "0 0 ".concat(count, " 1"))
|
|
219
218
|
.attr("preserveAspectRatio", "none")
|
|
220
219
|
.style("width", "109px")
|
|
221
220
|
.style("height", "20px")
|
|
@@ -223,17 +222,17 @@ colorsObject, legendColor, legendColorName, useContColorTable, useDiscColorTable
|
|
|
223
222
|
}
|
|
224
223
|
// discrete legend using d3 colors
|
|
225
224
|
function discD3legend() {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
colorsObject.forEach((element, key)
|
|
225
|
+
var itemName = [];
|
|
226
|
+
var itemColor = [];
|
|
227
|
+
colorsObject.forEach(function (element, key) {
|
|
229
228
|
itemColor.push({ color: element });
|
|
230
229
|
itemName.push(key);
|
|
231
230
|
});
|
|
232
231
|
//const ordinalValues = scaleOrdinal(colorsObject).domain(itemName);
|
|
233
|
-
|
|
234
|
-
|
|
232
|
+
var count = itemName.length;
|
|
233
|
+
var discreteLegend = discreteLegendUtil(itemColor, true);
|
|
235
234
|
select("svg").append("g").attr("transform", "translate(50,70)").attr("class", "legend").call(discreteLegend);
|
|
236
|
-
|
|
235
|
+
var selectedLegend = select(divRef.current);
|
|
237
236
|
selectedLegend
|
|
238
237
|
.append("text")
|
|
239
238
|
.text(legendColorName ? legendColorName : '')
|
|
@@ -248,7 +247,7 @@ colorsObject, legendColor, legendColorName, useContColorTable, useDiscColorTable
|
|
|
248
247
|
.style("margin-top", "13px")
|
|
249
248
|
.style("margin-left", "70px")
|
|
250
249
|
.style("background", "grey")
|
|
251
|
-
.attr("viewBox",
|
|
250
|
+
.attr("viewBox", "0 0 ".concat(count, " 1"))
|
|
252
251
|
.attr("preserveAspectRatio", "none")
|
|
253
252
|
.style("width", "109px")
|
|
254
253
|
.style("height", "20px")
|
|
@@ -259,7 +258,9 @@ colorsObject, legendColor, legendColorName, useContColorTable, useDiscColorTable
|
|
|
259
258
|
};
|
|
260
259
|
// Based on name return the colors array from color.tables.json file
|
|
261
260
|
export function colorTableData(colorName, colorTables) {
|
|
262
|
-
|
|
261
|
+
var colorTableData = colorTables.filter(function (value) {
|
|
262
|
+
return value.name.toLowerCase() == colorName.toLowerCase();
|
|
263
|
+
});
|
|
263
264
|
return colorTableData.length > 0 ? colorTableData[0].colors : [];
|
|
264
265
|
}
|
|
265
266
|
//# sourceMappingURL=ColorSelectorComponent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorSelectorComponent.js","sourceRoot":"","sources":["../../../src/component/ColorSelector/ColorSelectorComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAC,MAAM,IAAI,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAEzB,OAAO,kBAAkB,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAmBjC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"ColorSelectorComponent.js","sourceRoot":"","sources":["../../../src/component/ColorSelector/ColorSelectorComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAC,MAAM,IAAI,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAEzB,OAAO,kBAAkB,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAmBjC,MAAM,CAAC,IAAM,sBAAsB,GAA0B,UAAC,EAUhD;;IATV,YAAY;IACZ,YAAY,kBAAA,EACZ,WAAW,iBAAA,EACX,eAAe,qBAAA,EACf,iBAAiB,uBAAA,EACjB,iBAAiB,uBAAA,EACjB,UAAU,gBAAA,EACV,cAAc,oBAAA;IAId,IAAM,MAAM,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAC5C,oDAAoD;IAChD,4GAA4G;IAC5G,8BAA8B;IAClC,IAAI,WAAW,EAAE;QACb,IAAI,IAAI,GAAG,KAA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C;aAC5B,KAAK,CAAC,YAAY,EAAE,MAAM,CAAC;aAC3B,IAAI,CAAC,SAAS,EAAE,cAAO,KAAK,OAAI,CAAC;aACjC,IAAI,CAAC,qBAAqB,EAAE,MAAM,CAAC;aAEnC,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC;aACvB,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC;aACvB,IAAI,CAAC,cAAc,CAAC,CAAC;IAC9B,CAAC;IAED,OAAO,CACH;QACI,6BAAK,EAAE,EAAC,QAAQ,EAAC,KAAK,EAAE,EAAC,MAAM,EAAE,EAAE,EAAC,EAChC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAQ,CAC5C,CACT,CAAC;AACN,CAAC,CAAC;AAEF,oEAAoE;AACpE,MAAM,UAAU,cAAc,CAC1B,SAAiB,EACjB,WAA6B;IAE7B,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"}
|
|
@@ -2,58 +2,59 @@ import * as React from "react";
|
|
|
2
2
|
import * as colorTables from "../color-tables.json";
|
|
3
3
|
import { d3ColorScales } from "../Utils/d3ColorScale";
|
|
4
4
|
import { ColorSelectorComponent } from "./ColorSelectorComponent";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
var position = [16, 206];
|
|
6
|
+
var continuosColorData = [];
|
|
7
|
+
var continuosD3ColorData = [];
|
|
8
|
+
var discreteColorData = [];
|
|
9
|
+
var discreteD3ColorData = [];
|
|
10
10
|
// Continuous legend using color table data
|
|
11
|
-
var colorTableContinuousData = colorTables.filter((element)
|
|
11
|
+
var colorTableContinuousData = colorTables.filter(function (element) {
|
|
12
12
|
return element.discrete == false;
|
|
13
13
|
});
|
|
14
|
-
colorTableContinuousData.forEach((element)
|
|
14
|
+
colorTableContinuousData.forEach(function (element) {
|
|
15
15
|
continuosColorData.push({ color: element.colors, name: element.name });
|
|
16
16
|
});
|
|
17
17
|
// Continuous legend using d3 data
|
|
18
|
-
var d3continuousData = d3ColorScales.filter((element)
|
|
18
|
+
var d3continuousData = d3ColorScales.filter(function (element) {
|
|
19
19
|
return element.discrete == false;
|
|
20
20
|
});
|
|
21
|
-
d3continuousData.forEach((element)
|
|
21
|
+
d3continuousData.forEach(function (element) {
|
|
22
22
|
continuosD3ColorData.push({ color: element.colors, name: element.name });
|
|
23
23
|
});
|
|
24
24
|
// Discrete legend using color table data
|
|
25
|
-
var discreteData = colorTables.filter((element)
|
|
25
|
+
var discreteData = colorTables.filter(function (element) {
|
|
26
26
|
return element.discrete == true;
|
|
27
27
|
});
|
|
28
|
-
discreteData.forEach((element)
|
|
28
|
+
discreteData.forEach(function (element) {
|
|
29
29
|
discreteColorData.push({ color: element.colors, name: element.name });
|
|
30
30
|
});
|
|
31
31
|
// Discrete legend using d3 data
|
|
32
|
-
var d3discreteData = d3ColorScales.filter((element)
|
|
32
|
+
var d3discreteData = d3ColorScales.filter(function (element) {
|
|
33
33
|
return element.discrete == true;
|
|
34
34
|
});
|
|
35
|
-
d3discreteData.forEach((element)
|
|
35
|
+
d3discreteData.forEach(function (element) {
|
|
36
36
|
discreteD3ColorData.push({ color: element.colors, name: element.name });
|
|
37
37
|
});
|
|
38
|
-
export
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
export var ColorSelectorWrapper = function (_a) {
|
|
39
|
+
var useColorTableColors = _a.useColorTableColors, useD3Colors = _a.useD3Colors, colorScaleObject = _a.colorScaleObject;
|
|
40
|
+
var continuousLegend;
|
|
41
|
+
var discreteLegend;
|
|
41
42
|
// return continuous and discrete legend which uses colortable data
|
|
42
43
|
if (useColorTableColors) {
|
|
43
|
-
continuousLegend = continuosColorData.map((value, key)
|
|
44
|
+
continuousLegend = continuosColorData.map(function (value, key) {
|
|
44
45
|
return React.createElement("div", null,
|
|
45
46
|
React.createElement(ColorSelectorComponent, { position: position + key, colorsObject: value, useContColorTable: true, valueIndex: key, colorScaleData: colorScaleObject.colorScaleObject }));
|
|
46
47
|
});
|
|
47
|
-
discreteLegend = discreteColorData.map((val, key)
|
|
48
|
+
discreteLegend = discreteColorData.map(function (val, key) {
|
|
48
49
|
return React.createElement(ColorSelectorComponent, { position: position + key, colorsObject: discreteColorData[key], legendColorName: val.name, useDiscColorTable: true, colorScaleData: colorScaleObject.colorScaleObject });
|
|
49
50
|
});
|
|
50
51
|
}
|
|
51
52
|
// return continuous and discrete legend which uses d3 data
|
|
52
53
|
if (useD3Colors) {
|
|
53
|
-
continuousLegend = continuosD3ColorData.map((val, key)
|
|
54
|
+
continuousLegend = continuosD3ColorData.map(function (val, key) {
|
|
54
55
|
return React.createElement(ColorSelectorComponent, { position: position + key, legendColor: val.color, legendColorName: val.name, useContColorTable: false, valueIndex: key + "0", colorScaleData: colorScaleObject.colorScaleObject });
|
|
55
56
|
});
|
|
56
|
-
discreteLegend = d3discreteData.map((val, key)
|
|
57
|
+
discreteLegend = d3discreteData.map(function (val, key) {
|
|
57
58
|
return React.createElement(ColorSelectorComponent, { position: position + key, colorsObject: val.colors, legendColorName: val.name, useDiscColorTable: false, colorScaleData: colorScaleObject.colorScaleObject });
|
|
58
59
|
});
|
|
59
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorSelectorWrapper.js","sourceRoot":"","sources":["../../../src/component/ColorSelector/ColorSelectorWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,WAAW,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAC,aAAa,EAAC,MAAM,u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,gBAAgB;QAChB,cAAc,CACb,CACT,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -4,15 +4,16 @@ import { ContinuousLegend } from "./ContinuousLegend";
|
|
|
4
4
|
import { useCallback } from "react";
|
|
5
5
|
import { ColorSelectorAccordion } from "../ColorSelector/ColorSelectorAccordion";
|
|
6
6
|
// Todo: Adapt it for other layers too
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
var ColorLegend = function (_a) {
|
|
8
|
+
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;
|
|
9
|
+
var _b = React.useState(false), isToggled = _b[0], setIsToggled = _b[1];
|
|
10
|
+
var handleClick = useCallback(function () {
|
|
10
11
|
setIsToggled(true);
|
|
11
12
|
}, []);
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
var _c = React.useState([]), updateLegend = _c[0], setUpdateLegendColor = _c[1];
|
|
14
|
+
var _d = React.useState(true), isCont = _d[0], setIsCont = _d[1];
|
|
14
15
|
// Get new colorscale from colorselector and update legend
|
|
15
|
-
|
|
16
|
+
var colorScaleObject = React.useCallback(function (data, value) {
|
|
16
17
|
setUpdateLegendColor(data);
|
|
17
18
|
setIsCont(value);
|
|
18
19
|
}, []);
|
|
@@ -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,EAAC,WAAW,EAAC,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AAajF,sCAAsC;AACtC,
|
|
1
|
+
{"version":3,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