@emerson-eps/color-tables 0.2.11 → 0.2.14
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/ColorSelector/ColorSelectorAccordion.js +2 -2
- package/dist/component/ColorSelector/ColorSelectorAccordion.js.map +1 -1
- package/dist/component/ColorSelector/ColorSelectorComponent.d.ts +1 -2
- package/dist/component/ColorSelector/ColorSelectorComponent.js +7 -7
- package/dist/component/ColorSelector/ColorSelectorComponent.js.map +1 -1
- package/dist/component/ColorSelector/ColorSelectorWrapper.d.ts +6 -2
- package/dist/component/ColorSelector/ColorSelectorWrapper.js +10 -10
- package/dist/component/ColorSelector/ColorSelectorWrapper.js.map +1 -1
- package/dist/component/Legend/ColorLegend.js +13 -5
- package/dist/component/Legend/ColorLegend.js.map +1 -1
- package/dist/component/Legend/ContinuousLegend.d.ts +1 -1
- package/dist/component/Legend/ContinuousLegend.js +18 -4
- package/dist/component/Legend/ContinuousLegend.js.map +1 -1
- package/dist/component/Legend/DiscreteLegend.d.ts +1 -1
- package/dist/component/Legend/DiscreteLegend.js +25 -16
- package/dist/component/Legend/DiscreteLegend.js.map +1 -1
- package/dist/component/Utils/continousLegend.d.ts +2 -2
- package/dist/component/Utils/continousLegend.js.map +1 -1
- package/dist/component/Utils/discreteLegend.js +14 -27
- package/dist/component/Utils/discreteLegend.js.map +1 -1
- package/dist/component/{Utils/ColorTableTypes.d.ts → colorTableTypes.d.ts} +0 -0
- package/dist/component/colorTableTypes.js +2 -0
- package/dist/component/colorTableTypes.js.map +1 -0
- package/dist/index.d.ts +2 -4
- package/dist/index.js +1 -3
- package/dist/index.js.map +1 -1
- package/package.json +6 -3
- package/.storybook/main.js +0 -11
- package/.storybook/preview.js +0 -9
- package/.vscode/settings.json +0 -3
- package/dist/component/Utils/ColorTableTypes.js +0 -2
- package/dist/component/Utils/ColorTableTypes.js.map +0 -1
- package/dist/stories/ColorLegends/ColorSelector/Selector.stories.d.ts +0 -7
- package/dist/stories/ColorLegends/ColorSelector/Selector.stories.js +0 -11
- package/dist/stories/ColorLegends/ColorSelector/Selector.stories.js.map +0 -1
- package/dist/stories/ColorLegends/ContinousLegends/MD.stories.d.ts +0 -7
- package/dist/stories/ColorLegends/ContinousLegends/MD.stories.js +0 -38
- package/dist/stories/ColorLegends/ContinousLegends/MD.stories.js.map +0 -1
- package/dist/stories/ColorLegends/ContinousLegends/NTG.stories.d.ts +0 -7
- package/dist/stories/ColorLegends/ContinousLegends/NTG.stories.js +0 -38
- package/dist/stories/ColorLegends/ContinousLegends/NTG.stories.js.map +0 -1
- package/dist/stories/ColorLegends/ContinousLegends/PermTot.stories.d.ts +0 -7
- package/dist/stories/ColorLegends/ContinousLegends/PermTot.stories.js +0 -38
- package/dist/stories/ColorLegends/ContinousLegends/PermTot.stories.js.map +0 -1
- package/dist/stories/ColorLegends/ContinousLegends/Permeability.stories.d.ts +0 -7
- package/dist/stories/ColorLegends/ContinousLegends/Permeability.stories.js +0 -38
- package/dist/stories/ColorLegends/ContinousLegends/Permeability.stories.js.map +0 -1
- package/dist/stories/ColorLegends/ContinousLegends/PoroTot.stories.d.ts +0 -7
- package/dist/stories/ColorLegends/ContinousLegends/PoroTot.stories.js +0 -38
- package/dist/stories/ColorLegends/ContinousLegends/PoroTot.stories.js.map +0 -1
- package/dist/stories/ColorLegends/ContinousLegends/Porosity.stories.d.ts +0 -7
- package/dist/stories/ColorLegends/ContinousLegends/Porosity.stories.js +0 -38
- package/dist/stories/ColorLegends/ContinousLegends/Porosity.stories.js.map +0 -1
- package/dist/stories/ColorLegends/ContinousLegends/SW.stories.d.ts +0 -7
- package/dist/stories/ColorLegends/ContinousLegends/SW.stories.js +0 -38
- package/dist/stories/ColorLegends/ContinousLegends/SW.stories.js.map +0 -1
- package/dist/stories/ColorLegends/DiscreteLegends/Facies.stories.d.ts +0 -7
- package/dist/stories/ColorLegends/DiscreteLegends/Facies.stories.js +0 -47
- package/dist/stories/ColorLegends/DiscreteLegends/Facies.stories.js.map +0 -1
- package/dist/stories/ColorLegends/DiscreteLegends/FaciesNoCalcite.stories.d.ts +0 -7
- package/dist/stories/ColorLegends/DiscreteLegends/FaciesNoCalcite.stories.js +0 -47
- package/dist/stories/ColorLegends/DiscreteLegends/FaciesNoCalcite.stories.js.map +0 -1
- package/dist/stories/ColorLegends/DiscreteLegends/FaultDistanceHum.stories.d.ts +0 -7
- package/dist/stories/ColorLegends/DiscreteLegends/FaultDistanceHum.stories.js +0 -39
- package/dist/stories/ColorLegends/DiscreteLegends/FaultDistanceHum.stories.js.map +0 -1
- package/dist/stories/ColorLegends/DiscreteLegends/FaultProximityFlag.stories.d.ts +0 -7
- package/dist/stories/ColorLegends/DiscreteLegends/FaultProximityFlag.stories.js +0 -39
- package/dist/stories/ColorLegends/DiscreteLegends/FaultProximityFlag.stories.js.map +0 -1
- package/dist/stories/ColorLegends/DiscreteLegends/RDE.stories.d.ts +0 -7
- package/dist/stories/ColorLegends/DiscreteLegends/RDE.stories.js +0 -42
- package/dist/stories/ColorLegends/DiscreteLegends/RDE.stories.js.map +0 -1
- package/dist/stories/ColorLegends/DiscreteLegends/RDE_Orig.stories.d.ts +0 -7
- package/dist/stories/ColorLegends/DiscreteLegends/RDE_Orig.stories.js +0 -53
- package/dist/stories/ColorLegends/DiscreteLegends/RDE_Orig.stories.js.map +0 -1
- package/dist/stories/ColorLegends/DiscreteLegends/ZoneMain.stories.d.ts +0 -7
- package/dist/stories/ColorLegends/DiscreteLegends/ZoneMain.stories.js +0 -42
- package/dist/stories/ColorLegends/DiscreteLegends/ZoneMain.stories.js.map +0 -1
- package/dist/stories/ColorLegends/DiscreteLegends/Zonelog.stories.d.ts +0 -7
- package/dist/stories/ColorLegends/DiscreteLegends/Zonelog.stories.js +0 -52
- package/dist/stories/ColorLegends/DiscreteLegends/Zonelog.stories.js.map +0 -1
- package/dist/stories/ColorLegends/LegendWithSelector/DiscreteLegendWithSelector.stories.d.ts +0 -7
- package/dist/stories/ColorLegends/LegendWithSelector/DiscreteLegendWithSelector.stories.js +0 -52
- package/dist/stories/ColorLegends/LegendWithSelector/DiscreteLegendWithSelector.stories.js.map +0 -1
- package/dist/stories/ColorLegends/LegendWithSelector/LegendWithSelector.stories.d.ts +0 -7
- package/dist/stories/ColorLegends/LegendWithSelector/LegendWithSelector.stories.js +0 -38
- package/dist/stories/ColorLegends/LegendWithSelector/LegendWithSelector.stories.js.map +0 -1
- package/dist/stories/ColorLegends/SingleComponent/Single.stories.d.ts +0 -7
- package/dist/stories/ColorLegends/SingleComponent/Single.stories.js +0 -58
- package/dist/stories/ColorLegends/SingleComponent/Single.stories.js.map +0 -1
- package/src/component/ColorSelector/ColorSelectorAccordion.tsx +0 -54
- package/src/component/ColorSelector/ColorSelectorComponent.tsx +0 -312
- package/src/component/ColorSelector/ColorSelectorWrapper.tsx +0 -119
- package/src/component/Legend/ColorLegend.tsx +0 -89
- package/src/component/Legend/ContinuousLegend.tsx +0 -220
- package/src/component/Legend/DiscreteLegend.tsx +0 -195
- package/src/component/Utils/ColorTableTypes.ts +0 -6
- package/src/component/Utils/continousLegend.ts +0 -73
- package/src/component/Utils/d3ColorScale.ts +0 -84
- package/src/component/Utils/discreteLegend.ts +0 -84
- package/src/component/color-tables.json +0 -203
- package/src/custom.d.ts +0 -1
- package/src/index.ts +0 -26
- package/src/stories/ColorLegends/ColorSelector/Selector.stories.jsx +0 -12
- package/src/stories/ColorLegends/ContinousLegends/MD.stories.jsx +0 -29
- package/src/stories/ColorLegends/ContinousLegends/NTG.stories.jsx +0 -29
- package/src/stories/ColorLegends/ContinousLegends/PermTot.stories.jsx +0 -29
- package/src/stories/ColorLegends/ContinousLegends/Permeability.stories.jsx +0 -29
- package/src/stories/ColorLegends/ContinousLegends/PoroTot.stories.jsx +0 -29
- package/src/stories/ColorLegends/ContinousLegends/Porosity.stories.jsx +0 -29
- package/src/stories/ColorLegends/ContinousLegends/SW.stories.jsx +0 -29
- package/src/stories/ColorLegends/DiscreteLegends/Facies.stories.jsx +0 -39
- package/src/stories/ColorLegends/DiscreteLegends/FaciesNoCalcite.stories.jsx +0 -39
- package/src/stories/ColorLegends/DiscreteLegends/FaultDistanceHum.stories.jsx +0 -31
- package/src/stories/ColorLegends/DiscreteLegends/FaultProximityFlag.stories.jsx +0 -31
- package/src/stories/ColorLegends/DiscreteLegends/RDE.stories.jsx +0 -34
- package/src/stories/ColorLegends/DiscreteLegends/RDE_Orig.stories.jsx +0 -45
- package/src/stories/ColorLegends/DiscreteLegends/ZoneMain.stories.jsx +0 -34
- package/src/stories/ColorLegends/DiscreteLegends/Zonelog.stories.jsx +0 -46
- package/src/stories/ColorLegends/LegendWithSelector/DiscreteLegendWithSelector.stories.jsx +0 -44
- package/src/stories/ColorLegends/LegendWithSelector/LegendWithSelector.stories.jsx +0 -30
- package/src/stories/ColorLegends/SingleComponent/Single.stories.jsx +0 -51
- package/tsconfig.json +0 -23
|
@@ -16,12 +16,12 @@ export var ColorSelectorAccordion = function (props) {
|
|
|
16
16
|
React.createElement(Accordion.Item, null,
|
|
17
17
|
React.createElement(Accordion.Header, null, "Geologic Color Scale"),
|
|
18
18
|
React.createElement(Accordion.Panel, null,
|
|
19
|
-
React.createElement(ColorSelectorWrapper, { useColorTableColors: true,
|
|
19
|
+
React.createElement(ColorSelectorWrapper, { useColorTableColors: true, newColorScaleData: props === null || props === void 0 ? void 0 : props.newColorScaleData })))),
|
|
20
20
|
React.createElement(Accordion, null,
|
|
21
21
|
React.createElement(Accordion.Item, null,
|
|
22
22
|
React.createElement(Accordion.Header, null, "D3 Color Scale"),
|
|
23
23
|
React.createElement(Accordion.Panel, null,
|
|
24
|
-
React.createElement(ColorSelectorWrapper, {
|
|
24
|
+
React.createElement(ColorSelectorWrapper, { useColorTableColors: false, newColorScaleData: props === null || props === void 0 ? void 0 : props.newColorScaleData })))),
|
|
25
25
|
React.createElement(Accordion, null,
|
|
26
26
|
React.createElement(Accordion.Item, null,
|
|
27
27
|
React.createElement(Accordion.Header, null, "Custom Color Scale"),
|
|
@@ -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,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,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;YAClC,KAAK,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG;SAClC;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,
|
|
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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
2
|
declare type legendProps = {
|
|
3
|
-
position: number[];
|
|
4
3
|
colorsObject?: any;
|
|
5
4
|
legendColor?: any;
|
|
6
5
|
legendColorName?: string | undefined;
|
|
7
6
|
useContColorTable?: boolean;
|
|
8
7
|
useDiscColorTable?: boolean;
|
|
9
|
-
|
|
8
|
+
uniqueId?: number;
|
|
10
9
|
colorScaleData: any;
|
|
11
10
|
};
|
|
12
11
|
export declare const ColorSelectorComponent: React.FC<legendProps>;
|
|
@@ -7,7 +7,7 @@ import * as d3 from "d3";
|
|
|
7
7
|
import discreteLegendUtil from "../Utils/discreteLegend";
|
|
8
8
|
import { color } from "d3-color";
|
|
9
9
|
export var ColorSelectorComponent = function (_a) {
|
|
10
|
-
var colorsObject = _a.colorsObject, legendColor = _a.legendColor, legendColorName = _a.legendColorName, useContColorTable = _a.useContColorTable, useDiscColorTable = _a.useDiscColorTable,
|
|
10
|
+
var colorsObject = _a.colorsObject, legendColor = _a.legendColor, legendColorName = _a.legendColorName, useContColorTable = _a.useContColorTable, useDiscColorTable = _a.useDiscColorTable, uniqueId = _a.uniqueId, colorScaleData = _a.colorScaleData;
|
|
11
11
|
var divRef = useRef(null);
|
|
12
12
|
// create an array of steps based on the color scale
|
|
13
13
|
// returns an array of evenly-spaced numbers. Returns the integers from zero to the specified end minus one.
|
|
@@ -25,7 +25,7 @@ export var ColorSelectorComponent = function (_a) {
|
|
|
25
25
|
var handleChange = React.useCallback(function () {
|
|
26
26
|
// continous legend with colortable colors
|
|
27
27
|
if (colorsObject && Object.keys(colorsObject).length > 0 && useContColorTable) {
|
|
28
|
-
colorScaleData(colorsObject, true);
|
|
28
|
+
colorScaleData ? colorScaleData(colorsObject, true) : null;
|
|
29
29
|
}
|
|
30
30
|
// continous legend with d3 colors
|
|
31
31
|
else if (data && !useContColorTable) {
|
|
@@ -34,15 +34,15 @@ export var ColorSelectorComponent = function (_a) {
|
|
|
34
34
|
var _a, _b, _c;
|
|
35
35
|
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]);
|
|
36
36
|
});
|
|
37
|
-
colorScaleData({ arrayData: arrayData_1, legendColorName: legendColorName }, true);
|
|
37
|
+
colorScaleData ? colorScaleData({ arrayData: arrayData_1, legendColorName: legendColorName }, true) : null;
|
|
38
38
|
}
|
|
39
39
|
// discrete legend with colortable colors
|
|
40
40
|
else if (colorsObject && Object.keys(colorsObject).length > 0 && useDiscColorTable) {
|
|
41
|
-
colorScaleData(colorsObject, false);
|
|
41
|
+
colorScaleData ? colorScaleData(colorsObject, false) : null;
|
|
42
42
|
}
|
|
43
43
|
// discrete legend with d3 colors
|
|
44
44
|
else {
|
|
45
|
-
colorScaleData({ colorsObject: colorsObject, legendColorName: legendColorName }, false);
|
|
45
|
+
colorScaleData ? colorScaleData({ colorsObject: colorsObject, legendColorName: legendColorName }, false) : null;
|
|
46
46
|
}
|
|
47
47
|
}, []);
|
|
48
48
|
React.useEffect(function () {
|
|
@@ -94,7 +94,7 @@ export var ColorSelectorComponent = function (_a) {
|
|
|
94
94
|
.append("svg")
|
|
95
95
|
.style("height", "30px");
|
|
96
96
|
var defs = svgLegend.append("defs");
|
|
97
|
-
var currentIndex = "linear-gradient-" +
|
|
97
|
+
var currentIndex = "linear-gradient-" + uniqueId + "0";
|
|
98
98
|
// append a linearGradient element to the defs and give it a unique id
|
|
99
99
|
var linearGradient = defs
|
|
100
100
|
.append("linearGradient")
|
|
@@ -145,7 +145,7 @@ export var ColorSelectorComponent = function (_a) {
|
|
|
145
145
|
.append("svg")
|
|
146
146
|
.style("height", "50px");
|
|
147
147
|
var defs = svgLegend.append("defs");
|
|
148
|
-
var currentIndex = "linear-gradient-" +
|
|
148
|
+
var currentIndex = "linear-gradient-" + uniqueId;
|
|
149
149
|
// append a linearGradient element to the defs and give it a unique id
|
|
150
150
|
var linearGradient = defs
|
|
151
151
|
.append("linearGradient")
|
|
@@ -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;AACzB,OAAO,kBAAkB,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,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;AACzB,OAAO,kBAAkB,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAiBjC,MAAM,CAAC,IAAM,sBAAsB,GAA0B,UAAC,EAQhD;QAPV,YAAY,kBAAA,EACZ,WAAW,iBAAA,EACX,eAAe,qBAAA,EACf,iBAAiB,uBAAA,EACjB,iBAAiB,uBAAA,EACjB,QAAQ,cAAA,EACR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IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC;aAC5C,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;aACZ,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC;aACtB,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC;aACtB,KAAK,CAAC,QAAQ,EAAE,UAAU,CAAC;aAC3B,KAAK,CAAC,WAAW,EAAE,SAAS,CAAC;aAC7B,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;QACjC,cAAc;aACT,MAAM,CAAC,KAAK,CAAC;aACb,KAAK,CAAC,YAAY,EAAE,MAAM,CAAC;aAC3B,KAAK,CAAC,aAAa,EAAE,MAAM,CAAC;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"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
export declare type colorScaleObj = {
|
|
3
|
+
name: string;
|
|
4
|
+
color: [number, number, number, number][] | ((t: number) => string | string[]);
|
|
5
|
+
};
|
|
6
|
+
export declare type colorScaleArray = Array<colorScaleObj>;
|
|
2
7
|
declare type legendProps = {
|
|
3
8
|
useColorTableColors: boolean;
|
|
4
|
-
|
|
5
|
-
colorScaleObject: any;
|
|
9
|
+
newColorScaleData: any;
|
|
6
10
|
};
|
|
7
11
|
export declare const ColorSelectorWrapper: React.FC<legendProps>;
|
|
8
12
|
export {};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import
|
|
2
|
+
import colorTables from "../color-tables.json";
|
|
3
3
|
import { d3ColorScales } from "../Utils/d3ColorScale";
|
|
4
4
|
import { ColorSelectorComponent } from "./ColorSelectorComponent";
|
|
5
|
-
var position = [16, 206];
|
|
6
5
|
var continuosColorData = [];
|
|
7
6
|
var continuosD3ColorData = [];
|
|
8
7
|
var discreteColorData = [];
|
|
@@ -36,28 +35,29 @@ d3discreteData.forEach(function (element) {
|
|
|
36
35
|
discreteD3ColorData.push({ color: element.colors, name: element.name });
|
|
37
36
|
});
|
|
38
37
|
export var ColorSelectorWrapper = function (_a) {
|
|
39
|
-
var useColorTableColors = _a.useColorTableColors,
|
|
38
|
+
var useColorTableColors = _a.useColorTableColors, newColorScaleData = _a.newColorScaleData;
|
|
40
39
|
var continuousLegend;
|
|
41
40
|
var discreteLegend;
|
|
42
41
|
// return continuous and discrete legend which uses d3 data
|
|
43
|
-
if (
|
|
42
|
+
if (!useColorTableColors) {
|
|
44
43
|
continuousLegend = continuosD3ColorData.map(function (val, key) {
|
|
45
|
-
return React.createElement(ColorSelectorComponent, {
|
|
44
|
+
return React.createElement(ColorSelectorComponent, { legendColor: val.color, legendColorName: val.name, useContColorTable: false, uniqueId: key, colorScaleData: newColorScaleData });
|
|
46
45
|
});
|
|
47
|
-
discreteLegend = d3discreteData.map(function (val
|
|
48
|
-
return React.createElement(ColorSelectorComponent, {
|
|
46
|
+
discreteLegend = d3discreteData.map(function (val) {
|
|
47
|
+
return React.createElement(ColorSelectorComponent, { colorsObject: val.colors, legendColorName: val.name, useDiscColorTable: false, colorScaleData: newColorScaleData });
|
|
49
48
|
});
|
|
50
49
|
}
|
|
51
50
|
// return continuous and discrete legend which uses colortable data
|
|
52
|
-
if (useColorTableColors) {
|
|
51
|
+
else if (useColorTableColors) {
|
|
53
52
|
continuousLegend = continuosColorData.map(function (value, key) {
|
|
54
53
|
return React.createElement("div", null,
|
|
55
|
-
React.createElement(ColorSelectorComponent, {
|
|
54
|
+
React.createElement(ColorSelectorComponent, { colorsObject: value, useContColorTable: true, uniqueId: key, colorScaleData: newColorScaleData }));
|
|
56
55
|
});
|
|
57
56
|
discreteLegend = discreteColorData.map(function (val, key) {
|
|
58
|
-
return React.createElement(ColorSelectorComponent, {
|
|
57
|
+
return React.createElement(ColorSelectorComponent, { colorsObject: discreteColorData[key], legendColorName: val.name, useDiscColorTable: true, colorScaleData: newColorScaleData });
|
|
59
58
|
});
|
|
60
59
|
}
|
|
60
|
+
//}
|
|
61
61
|
return (React.createElement("div", { className: "legendWrapper", style: { height: 200, overflow: "auto", display: "flex", flexDirection: "column", overflowX: "hidden" } },
|
|
62
62
|
continuousLegend,
|
|
63
63
|
discreteLegend));
|
|
@@ -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,
|
|
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,WAAW,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAC,sBAAsB,EAAC,MAAM,0BAA0B,CAAC;AAQhE,IAAM,kBAAkB,GAAoB,EAAE,CAAC;AAC/C,IAAM,oBAAoB,GAAoB,EAAE,CAAC;AACjD,IAAM,iBAAiB,GAAoB,EAAE,CAAC;AAC9C,IAAM,mBAAmB,GAAoB,EAAE,CAAC;AAOhD,4CAA4C;AAC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AsB,IAClB,YAAY,EAAE,iBAAiB,CAAC,GAAG,CAAC,EACpC,eAAe,EAAE,GAAG,CAAC,IAAI,EACzB,iBAAiB,EAAE,IAAI,EACvB,cAAc,EAAE,iBAAiB,GACnC,CAAA;QACd,CAAC,CAAC,CAAC;KACN;IACL,GAAG;IAEH,OAAO,CACH,6BAAK,SAAS,EAAC,eAAe,EAC1B,KAAK,EAAE,EAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAC;QAEpG,gBAAgB;QAChB,cAAc,CACb,CACT,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { DiscreteColorLegend } from "./DiscreteLegend";
|
|
|
3
3
|
import { ContinuousLegend } from "./ContinuousLegend";
|
|
4
4
|
import { useCallback } from "react";
|
|
5
5
|
import { ColorSelectorAccordion } from "../ColorSelector/ColorSelectorAccordion";
|
|
6
|
+
import { d3ColorScales } from "../Utils/d3ColorScale";
|
|
6
7
|
// Todo: Adapt it for other layers too
|
|
7
8
|
export var ColorLegend = function (_a) {
|
|
8
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;
|
|
@@ -11,9 +12,16 @@ export var ColorLegend = function (_a) {
|
|
|
11
12
|
setIsToggled(true);
|
|
12
13
|
}, []);
|
|
13
14
|
var _c = React.useState([]), updateLegend = _c[0], setUpdateLegendColor = _c[1];
|
|
14
|
-
var
|
|
15
|
+
var isColortableColors = colorTables.find(function (value) {
|
|
16
|
+
return (value === null || value === void 0 ? void 0 : value.name) == colorName;
|
|
17
|
+
});
|
|
18
|
+
var isD3Colors = d3ColorScales.find(function (value) {
|
|
19
|
+
return (value === null || value === void 0 ? void 0 : value.name) == colorName;
|
|
20
|
+
});
|
|
21
|
+
var _d = React.useState((isColortableColors || isD3Colors) &&
|
|
22
|
+
((isColortableColors === null || isColortableColors === void 0 ? void 0 : isColortableColors.discrete) == false || (isD3Colors === null || isD3Colors === void 0 ? void 0 : isD3Colors.discrete) == false) ? true : false), isCont = _d[0], setIsCont = _d[1];
|
|
15
23
|
// Get new colorscale from colorselector and update legend
|
|
16
|
-
var
|
|
24
|
+
var getSelectedColorScale = React.useCallback(function (data, value) {
|
|
17
25
|
// update color map layer
|
|
18
26
|
if (data.name && getColorMapname) {
|
|
19
27
|
getColorMapname(data.name);
|
|
@@ -27,8 +35,8 @@ export var ColorLegend = function (_a) {
|
|
|
27
35
|
}, []);
|
|
28
36
|
return (React.createElement("div", null,
|
|
29
37
|
React.createElement("div", { onClick: handleClick },
|
|
30
|
-
isCont && (React.createElement(ContinuousLegend, { min: min, max: max, dataObjectName: dataObjectName, position: position, colorName: colorName, colorTables: colorTables, horizontal: horizontal, updateLegend: updateLegend })),
|
|
31
|
-
|
|
32
|
-
React.createElement("div", null, isToggled && (React.createElement(ColorSelectorAccordion, {
|
|
38
|
+
isCont == true && (React.createElement(ContinuousLegend, { min: min, max: max, dataObjectName: dataObjectName, position: position, colorName: colorName, colorTables: colorTables, horizontal: horizontal, updateLegend: updateLegend })),
|
|
39
|
+
isCont == false && (React.createElement(DiscreteColorLegend, { discreteData: discreteData, dataObjectName: dataObjectName, position: position, colorName: colorName, colorTables: colorTables, horizontal: horizontal, updateLegend: updateLegend }))),
|
|
40
|
+
React.createElement("div", null, isToggled && (React.createElement(ColorSelectorAccordion, { newColorScaleData: getSelectedColorScale, isHorizontal: horizontal })))));
|
|
33
41
|
};
|
|
34
42
|
//# 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,OA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UAAU,EACtB,YAAY,EAAE,YAAY,GAC5B,CACL;YACA,MAAM,IAAI,KAAK,IAAI,CAChB,oBAAC,mBAAmB,IAChB,YAAY,EAAE,YAAY,EAC1B,cAAc,EAAE,cAAc,EAC9B,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,YAAY,GAC5B,CACL,CACC;QACN,iCACK,SAAS,IAAI,CACV,oBAAC,sBAAsB,IAAC,iBAAiB,EAAE,qBAAqB,EAAE,YAAY,EAAE,UAAU,GAAI,CACjG,CACC,CACJ,CAET,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -38,6 +38,9 @@ import * as React from "react";
|
|
|
38
38
|
import { useRef } from "react";
|
|
39
39
|
import { RGBToHex, colorsArray } from "../Utils/continousLegend";
|
|
40
40
|
import { select, scaleLinear, scaleSequential, axisBottom, axisRight } from "d3";
|
|
41
|
+
import { d3ColorScales } from "../Utils/d3ColorScale";
|
|
42
|
+
import { color } from "d3-color";
|
|
43
|
+
import { range } from "d3";
|
|
41
44
|
export var ContinuousLegend = function (_a) {
|
|
42
45
|
var min = _a.min, max = _a.max, dataObjectName = _a.dataObjectName, position = _a.position, colorName = _a.colorName, colorTables = _a.colorTables, horizontal = _a.horizontal, updateLegend = _a.updateLegend;
|
|
43
46
|
var divRef = useRef(null);
|
|
@@ -53,7 +56,7 @@ export var ContinuousLegend = function (_a) {
|
|
|
53
56
|
}, [min, max, colorName, colorTables, horizontal, updateLegend]);
|
|
54
57
|
function continuousLegend() {
|
|
55
58
|
return __awaiter(this, void 0, void 0, function () {
|
|
56
|
-
var itemColor, dataSet, res, legendColors, colorScale, svgLegend, defs, linearGradient, xLeg, yLeg, horizontalAxisLeg, VerticalAxisLeg, error_1;
|
|
59
|
+
var itemColor, dataSet, res, legendColors, arrayData_1, d3ColorArrays_1, data, colorScale, svgLegend, defs, linearGradient, xLeg, yLeg, horizontalAxisLeg, VerticalAxisLeg, error_1;
|
|
57
60
|
return __generator(this, function (_a) {
|
|
58
61
|
switch (_a.label) {
|
|
59
62
|
case 0:
|
|
@@ -76,7 +79,7 @@ export var ContinuousLegend = function (_a) {
|
|
|
76
79
|
colorsArray(colorName, colorTables);
|
|
77
80
|
// Update color of legend based on color selector scales
|
|
78
81
|
// data is passed on click upon color scales
|
|
79
|
-
if (updateLegend) {
|
|
82
|
+
if (updateLegend && Object.keys(updateLegend).length > 0) {
|
|
80
83
|
// legend using color table data
|
|
81
84
|
if (updateLegend.color) {
|
|
82
85
|
legendColors = updateLegend.color;
|
|
@@ -86,9 +89,20 @@ export var ContinuousLegend = function (_a) {
|
|
|
86
89
|
legendColors = updateLegend.arrayData;
|
|
87
90
|
}
|
|
88
91
|
}
|
|
89
|
-
// main continuous legend
|
|
92
|
+
// main continuous legend for colortable colors
|
|
93
|
+
if (legendColors.length > 0) {
|
|
94
|
+
legendColors = legendColors;
|
|
95
|
+
}
|
|
96
|
+
// main continuous legend for d3 colors
|
|
90
97
|
else {
|
|
91
|
-
|
|
98
|
+
arrayData_1 = [];
|
|
99
|
+
d3ColorArrays_1 = colorsArray(colorName, d3ColorScales);
|
|
100
|
+
data = range(10).map(function (d) { return ({ color: d3ColorArrays_1(d / 10) }); });
|
|
101
|
+
data.forEach(function (colorsObject, index) {
|
|
102
|
+
var _a, _b, _c;
|
|
103
|
+
arrayData_1.push([0 + "." + index, (_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]);
|
|
104
|
+
});
|
|
105
|
+
legendColors = arrayData_1;
|
|
92
106
|
}
|
|
93
107
|
legendColors.forEach(function (value) {
|
|
94
108
|
// return the color and offset needed to draw the legend
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContinuousLegend.js","sourceRoot":"","sources":["../../../src/component/Legend/ContinuousLegend.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,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,eAAe,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"ContinuousLegend.js","sourceRoot":"","sources":["../../../src/component/Legend/ContinuousLegend.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,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,eAAe,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAEjF,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;AAkB3B,MAAM,CAAC,IAAM,gBAAgB,GAA0B,UAAC,EAS1C;QARV,GAAG,SAAA,EACH,GAAG,SAAA,EACH,cAAc,oBAAA,EACd,QAAQ,cAAA,EACR,SAAS,eAAA,EACT,WAAW,iBAAA,EACX,UAAU,gBAAA,EACV,YAAY,kBAAA;IAEZ,IAAM,MAAM,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAE5C,KAAK,CAAC,SAAS,CAAC;QACZ,IAAI,MAAM,CAAC,OAAO,EAAE;YAChB,gBAAgB,EAAE,CAAC;SACtB;Q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AC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG;YACjC,MAAM,EAAE,GAAG;SACd;QAED,6BAAK,EAAE,EAAC,QAAQ,EAAC,GAAG,EAAE,MAAM,GAAQ,CAClC,CACT,CAAC;AACN,CAAC,CAAC;AAEF,gBAAgB,CAAC,YAAY,GAAG;IAC5B,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC;CACpB,CAAC"}
|
|
@@ -39,13 +39,12 @@ import { useRef } from "react";
|
|
|
39
39
|
import discreteLegendUtil from "../Utils/discreteLegend";
|
|
40
40
|
import { select, scaleOrdinal } from "d3";
|
|
41
41
|
import { colorsArray } from "../Utils/continousLegend";
|
|
42
|
+
import { d3ColorScales } from "../Utils/d3ColorScale";
|
|
42
43
|
export var DiscreteColorLegend = function (_a) {
|
|
43
44
|
var discreteData = _a.discreteData, dataObjectName = _a.dataObjectName, position = _a.position, colorName = _a.colorName, colorTables = _a.colorTables, horizontal = _a.horizontal, updateLegend = _a.updateLegend;
|
|
44
45
|
var divRef = useRef(null);
|
|
45
46
|
var itemName = [];
|
|
46
47
|
var itemColor = [];
|
|
47
|
-
var testColor = [];
|
|
48
|
-
var testName = [];
|
|
49
48
|
React.useEffect(function () {
|
|
50
49
|
if (divRef.current) {
|
|
51
50
|
select(divRef.current).select("div").remove();
|
|
@@ -59,7 +58,7 @@ export var DiscreteColorLegend = function (_a) {
|
|
|
59
58
|
}, [discreteData, colorName, colorTables, horizontal, updateLegend]);
|
|
60
59
|
function discreteLegend() {
|
|
61
60
|
return __awaiter(this, void 0, void 0, function () {
|
|
62
|
-
var dataSet, useSelectorLegend, res, arrayOfColors_1, ordinalValues, colorLegend, currentDiv, totalRect, svgLegend, error_1;
|
|
61
|
+
var dataSet, useSelectorLegend, res, arrayOfColors_1, d3ColorArrays_1, ordinalValues, colorLegend, currentDiv, totalRect, svgLegend, error_1;
|
|
63
62
|
return __generator(this, function (_a) {
|
|
64
63
|
switch (_a.label) {
|
|
65
64
|
case 0:
|
|
@@ -79,30 +78,41 @@ export var DiscreteColorLegend = function (_a) {
|
|
|
79
78
|
arrayOfColors_1 = typeof colorTables === "string"
|
|
80
79
|
? colorsArray(colorName, dataSet)
|
|
81
80
|
: colorsArray(colorName, colorTables);
|
|
81
|
+
d3ColorArrays_1 = colorsArray(colorName, d3ColorScales);
|
|
82
82
|
// Main discrete legend
|
|
83
83
|
if (!updateLegend || updateLegend.length == 0) {
|
|
84
84
|
Object.keys(discreteData).forEach(function (key) {
|
|
85
85
|
//eslint-disable-next-line
|
|
86
86
|
var code = discreteData[key][1];
|
|
87
|
-
//
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
itemColor.push({
|
|
93
|
-
color: RGBToHex(matchedColorsArrays),
|
|
87
|
+
// for colortable colors
|
|
88
|
+
if (arrayOfColors_1.length > 0) {
|
|
89
|
+
//compare the first value in colorarray(colortable) and code from discreteData
|
|
90
|
+
var matchedColorsArrays_1 = arrayOfColors_1.find(function (value) {
|
|
91
|
+
return value[0] == code;
|
|
94
92
|
});
|
|
95
|
-
|
|
93
|
+
if (matchedColorsArrays_1)
|
|
94
|
+
itemColor.push({
|
|
95
|
+
color: RGBToHex(matchedColorsArrays_1),
|
|
96
|
+
name: key
|
|
97
|
+
});
|
|
98
|
+
itemName.push(key);
|
|
99
|
+
}
|
|
100
|
+
// for d3 colors
|
|
101
|
+
else {
|
|
102
|
+
var matchedColorsArrays = d3ColorArrays_1.find(function (_value, index) {
|
|
103
|
+
return index == code;
|
|
104
|
+
});
|
|
105
|
+
if (matchedColorsArrays)
|
|
106
|
+
itemColor.push({ color: matchedColorsArrays });
|
|
107
|
+
}
|
|
96
108
|
});
|
|
97
109
|
useSelectorLegend = false;
|
|
98
110
|
}
|
|
99
111
|
// Discrete legend using Colortable colors
|
|
100
112
|
else if (updateLegend === null || updateLegend === void 0 ? void 0 : updateLegend.color) {
|
|
101
113
|
updateLegend.color.forEach(function (key) {
|
|
102
|
-
|
|
114
|
+
itemColor.push({ color: RGBToHex(key) });
|
|
103
115
|
});
|
|
104
|
-
itemColor = testColor;
|
|
105
|
-
itemName = testName;
|
|
106
116
|
useSelectorLegend = true;
|
|
107
117
|
}
|
|
108
118
|
// Discrete legend using d3 colors
|
|
@@ -110,7 +120,6 @@ export var DiscreteColorLegend = function (_a) {
|
|
|
110
120
|
updateLegend.colorsObject.forEach(function (key) {
|
|
111
121
|
itemColor.push({ color: key });
|
|
112
122
|
});
|
|
113
|
-
//itemColor = itemColor;
|
|
114
123
|
itemName = updateLegend.legendColorName;
|
|
115
124
|
useSelectorLegend = true;
|
|
116
125
|
}
|
|
@@ -178,7 +187,7 @@ export var DiscreteColorLegend = function (_a) {
|
|
|
178
187
|
top: position ? position[1] : " ",
|
|
179
188
|
backgroundColor: "#ffffffcc",
|
|
180
189
|
borderRadius: "5px",
|
|
181
|
-
zIndex:
|
|
190
|
+
zIndex: 999,
|
|
182
191
|
} },
|
|
183
192
|
React.createElement("div", { id: "legend", ref: divRef })));
|
|
184
193
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DiscreteLegend.js","sourceRoot":"","sources":["../../../src/component/Legend/DiscreteLegend.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,kBAAkB,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAE1C,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"DiscreteLegend.js","sourceRoot":"","sources":["../../../src/component/Legend/DiscreteLegend.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,KAAK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ray(colorName: string, colorTables:
|
|
1
|
+
import { colorTablesArray } from "../colorTableTypes";
|
|
2
|
+
export declare function colorsArray(colorName: string, colorTables: any): any;
|
|
3
3
|
export declare function rgbValues(point: number, colorName: string, colorTables: colorTablesArray): number[] | {
|
|
4
4
|
r: number;
|
|
5
5
|
g: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"continousLegend.js","sourceRoot":"","sources":["../../../src/component/Utils/continousLegend.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAMhD,0EAA0E;AAC1E,MAAM,UAAU,WAAW,CACvB,SAAiB,EACjB,
|
|
1
|
+
{"version":3,"file":"continousLegend.js","sourceRoot":"","sources":["../../../src/component/Utils/continousLegend.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAMhD,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,WAA6B;;IAE7B,IAAM,gBAAgB,GAAG,WAAW,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IAC7D,0DAA0D;IAC1D,IAAM,WAAW,GAAG,gBAAgB,CAAC,IAAI,CAC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,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,EACnC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACxC,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC;QAAE,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC;IAC/B,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC;QAAE,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC;IAC/B,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC;QAAE,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC;IAC/B,IAAM,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;IAE9B,OAAO,EAAE,KAAK,EAAE,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AACtD,CAAC"}
|
|
@@ -6,12 +6,15 @@ export default function discreteLegendUtil(itemColor, isSelectorLegend, horizont
|
|
|
6
6
|
function drawLegend() {
|
|
7
7
|
// Code to fill the color
|
|
8
8
|
// Styling for color selector legend
|
|
9
|
-
//if (isSelectorLegend) {
|
|
10
9
|
g.selectAll("g.legendCells")
|
|
11
10
|
.data(itemColor)
|
|
12
11
|
.enter()
|
|
13
12
|
.append("g")
|
|
14
13
|
.append("rect")
|
|
14
|
+
.append("title")
|
|
15
|
+
.text(function (d) {
|
|
16
|
+
return d["name"];
|
|
17
|
+
})
|
|
15
18
|
.attr("class", "rectLabel")
|
|
16
19
|
.style("cursor", "pointer")
|
|
17
20
|
.style("pointer-events", "all");
|
|
@@ -23,52 +26,36 @@ export default function discreteLegendUtil(itemColor, isSelectorLegend, horizont
|
|
|
23
26
|
});
|
|
24
27
|
if (horizontal && !isSelectorLegend) {
|
|
25
28
|
g.selectAll("rect")
|
|
26
|
-
.attr("x", function (
|
|
27
|
-
|
|
28
|
-
if (i)
|
|
29
|
-
return i;
|
|
30
|
-
else if (d)
|
|
31
|
-
return null;
|
|
29
|
+
.attr("x", function (_d, i) {
|
|
30
|
+
return i;
|
|
32
31
|
})
|
|
33
32
|
.attr("y", 0);
|
|
34
33
|
}
|
|
35
34
|
else if (!horizontal && !isSelectorLegend) {
|
|
36
35
|
g.selectAll("rect")
|
|
37
|
-
.attr("y", function (
|
|
38
|
-
|
|
39
|
-
return i;
|
|
40
|
-
else if (d)
|
|
41
|
-
return null;
|
|
36
|
+
.attr("y", function (_d, i) {
|
|
37
|
+
return i;
|
|
42
38
|
})
|
|
43
39
|
.attr("x", 0);
|
|
44
40
|
}
|
|
45
41
|
else if (horizontal == true && isSelectorLegend) {
|
|
46
42
|
g.selectAll("rect")
|
|
47
|
-
.attr("x", function (
|
|
48
|
-
|
|
49
|
-
return i;
|
|
50
|
-
else if (d)
|
|
51
|
-
return null;
|
|
43
|
+
.attr("x", function (_d, i) {
|
|
44
|
+
return i;
|
|
52
45
|
})
|
|
53
46
|
.attr("y", 0);
|
|
54
47
|
}
|
|
55
48
|
else if (horizontal == false && isSelectorLegend) {
|
|
56
49
|
g.selectAll("rect")
|
|
57
|
-
.attr("y", function (
|
|
58
|
-
|
|
59
|
-
return i;
|
|
60
|
-
else if (d)
|
|
61
|
-
return null;
|
|
50
|
+
.attr("y", function (_d, i) {
|
|
51
|
+
return i;
|
|
62
52
|
})
|
|
63
53
|
.attr("x", 0);
|
|
64
54
|
}
|
|
65
55
|
else {
|
|
66
56
|
g.selectAll("rect")
|
|
67
|
-
.attr("x", function (
|
|
68
|
-
|
|
69
|
-
return i;
|
|
70
|
-
else if (d)
|
|
71
|
-
return null;
|
|
57
|
+
.attr("x", function (_d, i) {
|
|
58
|
+
return i;
|
|
72
59
|
})
|
|
73
60
|
.attr("y", 0);
|
|
74
61
|
}
|